/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static void lock_socket_input_cb (gpointer data,
gint source,
GdkInputCondition condition);
-#ifndef CLAWS
-static
-#endif
+
gchar *get_socket_name (void);
GtkWidget *window = NULL;
if (alertpanel(_("Migration of configuration"),
message,
- GTK_STOCK_NO, GTK_STOCK_YES, NULL) != G_ALERTALTERNATE) {
+ GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL) != G_ALERTALTERNATE) {
return FALSE;
}
}
#endif
+static gboolean sc_exiting = FALSE;
+static gboolean sc_starting = FALSE;
+
int main(int argc, char *argv[])
{
gchar *userrc;
gint num_folder_class = 0;
START_TIMING("startup");
+ sc_starting = TRUE;
+
if (!claws_init(&argc, &argv)) {
return 0;
}
prefs_destroy_cache();
gboolean r = FALSE;
if (is_dir_exist(OLD_GTK2_RC_DIR))
- r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR, _("Sylpheed-Claws 2.6.0"));
+ r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR, "Sylpheed-Claws 2.6.0");
else if (is_dir_exist(OLDER_GTK2_RC_DIR))
- r = migrate_old_config(OLDER_GTK2_RC_DIR, RC_DIR, _("Sylpheed-Claws 1.9.15"));
+ r = migrate_old_config(OLDER_GTK2_RC_DIR, RC_DIR, "Sylpheed-Claws 1.9.15");
else if (is_dir_exist(OLD_GTK1_RC_DIR))
- r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR, _("Sylpheed-Claws 1.0.5"));
+ r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR, "Sylpheed-Claws 1.0.5");
if (r == FALSE && !is_dir_exist(RC_DIR) && make_dir(RC_DIR) < 0)
exit(1);
}
gtk_accel_map_load (userrc);
g_free(userrc);
- gtk_settings_set_long_property(gtk_settings_get_default(),
- "gtk-can-change-accels",
- (glong)TRUE, "XProperty");
-
CHDIR_RETURN_VAL_IF_FAIL(get_rc_dir(), 1);
MAKE_DIR_IF_NOT_EXIST(get_mail_base_dir());
gtkaspell_checkers_init();
prefs_spelling_init();
#endif
-
+
sock_set_io_timeout(prefs_common.io_timeout_secs);
#ifdef HAVE_LIBETPAN
imap_main_set_timeout(prefs_common.io_timeout_secs);
if (!run_wizard(mainwin, FALSE))
exit(1);
account_read_config_all();
- if(!account_get_list())
+ if(!account_get_list()) {
exit_claws(mainwin);
+ exit(1);
+ }
}
if (!folder_have_mailbox()) {
prefs_destroy_cache();
main_window_cursor_normal(mainwin);
- alertpanel_error(_("Claws Mail has detected a configured "
+ if (folder_get_list() != NULL) {
+ alertpanel_error(_("Claws Mail has detected a configured "
+ "mailbox, but is it incomplete. It is "
+ "possibly due to a failing IMAP account. Use "
+ "\"Rebuild folder tree\" on the mailbox's folder "
+ "to try to fix it."));
+ } else {
+ alertpanel_error(_("Claws Mail has detected a configured "
"mailbox, but could not load it. It is "
"probably provided by an out-of-date "
"external plugin. Please reinstall the "
"plugin and try again."));
- exit(1);
+ exit_claws(mainwin);
+ exit(1);
+ }
}
static_mainwindow = mainwin;
}
prefs_destroy_cache();
+
+ sc_starting = FALSE;
END_TIMING();
+
gtk_main();
exit_claws(mainwin);
folder_item_free_cache(item, TRUE);
}
-static gboolean sc_exiting = FALSE;
-
static void exit_claws(MainWindow *mainwin)
{
gchar *filename;
}
} else if (!strncmp(argv[i], "--send", 6)) {
cmd.send = TRUE;
- } else if (!strncmp(argv[i], "--version", 9)) {
+ } else if (!strncmp(argv[i], "--version", 9) ||
+ !strncmp(argv[i], "-v", 2)) {
puts("Claws Mail version " VERSION);
exit(0);
} else if (!strncmp(argv[i], "--status-full", 13)) {
cmd.online_mode = ONLINE_MODE_ONLINE;
} else if (!strncmp(argv[i], "--offline", 9)) {
cmd.online_mode = ONLINE_MODE_OFFLINE;
- } else if (!strncmp(argv[i], "--help", 6)) {
+ } else if (!strncmp(argv[i], "--help", 6) ||
+ !strncmp(argv[i], "-h", 2)) {
gchar *base = g_path_get_basename(argv[0]);
g_print(_("Usage: %s [OPTION]...\n"), base);
g_print("%s\n", _(" --status-full [folder]...\n"
" show the status of each folder"));
g_print("%s\n", _(" --select folder[/msg] jumps to the specified folder/message\n"
- " folder is a folder id like '#mh/Mailbox/inbox'"));
+ " folder is a folder id like 'folder/sub_folder'"));
g_print("%s\n", _(" --online switch to online mode"));
g_print("%s\n", _(" --offline switch to offline mode"));
- g_print("%s\n", _(" --exit exit Claws Mail"));
+ g_print("%s\n", _(" --exit --quit -q exit Claws Mail"));
g_print("%s\n", _(" --debug debug mode"));
- g_print("%s\n", _(" --help display this help and exit"));
- g_print("%s\n", _(" --version output version information and exit"));
+ g_print("%s\n", _(" --help -h display this help and exit"));
+ g_print("%s\n", _(" --version -v output version information and exit"));
g_print("%s\n", _(" --config-dir output configuration directory"));
g_free(base);
} else if (!strncmp(argv[i], "--config-dir", sizeof "--config-dir" - 1)) {
puts(RC_DIR);
exit(0);
- } else if (!strncmp(argv[i], "--exit", 6)) {
+ } else if (!strncmp(argv[i], "--exit", 6) ||
+ !strncmp(argv[i], "--quit", 6) ||
+ !strncmp(argv[i], "-q", 2)) {
cmd.exit = TRUE;
} else if (!strncmp(argv[i], "--select", 8) && i+1 < argc) {
cmd.target = argv[i+1];
cmd.subscribe = TRUE;
cmd.subscribe_uri = p;
}
+ } else {
+ g_print(_("Unknown option\n"));
+ exit(1);
}
}
-
}
if (cmd.attach_files && cmd.compose == FALSE) {
return sc_exiting;
}
+gboolean claws_is_starting(void)
+{
+ return sc_starting;
+}
+
/*
* CLAWS: want this public so crash dialog can delete the
* lock file too
*/
-#ifndef CLAWS
-static
-#endif
gchar *get_socket_name(void)
{
static gchar *filename = NULL;