gboolean crash;
int online_mode;
gchar *crash_params;
+ gboolean exit;
} cmd;
static void parse_cmd_opt(int argc, char *argv[]);
sn_launchee_context_unref(sn_context);
sn_display_unref(sn_display);
}
+ if (with_window)
+ gtk_widget_destroy(hack);
}
#endif /* HAVE_STARTUP_NOTIFICATION */
return FALSE;
}
+static gboolean migrate_old_config(const gchar *old_cfg_dir, const gchar *new_cfg_dir)
+{
+ gchar *message = g_strdup_printf(_("Configuration for Sylpheed-Claws %s found.\n"
+ "Do you want to migrate this configuration?"),
+ !strcmp(old_cfg_dir, OLD_GTK1_RC_DIR)?
+ _("1.0.5 or previous"):_("1.9.15 or previous"));
+ gint r = 0;
+ GtkWidget *window = NULL;
+ if (alertpanel(_("Migration of configuration"),
+ message,
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
+ return FALSE;
+
+ window = label_window_create(_("Copying configuration..."));
+ GTK_EVENTS_FLUSH();
+ r = copy_dir(old_cfg_dir, new_cfg_dir);
+ gtk_widget_destroy(window);
+ if (r != 0) {
+ alertpanel_error(_("Migration failed!"));
+ }
+ return (r == 0);
+}
+
int main(int argc, char *argv[])
{
gchar *userrc;
G_DIR_SEPARATOR_S, "gtkrc-2.0", NULL);
gtk_rc_parse(userrc);
g_free(userrc);
+
+ CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
+ if (!is_dir_exist(RC_DIR)) {
+ gboolean r = FALSE;
+ if (is_dir_exist(OLD_GTK2_RC_DIR))
+ r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR);
+ else if (is_dir_exist(OLD_GTK1_RC_DIR))
+ r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR);
+ if (r == FALSE && !is_dir_exist(RC_DIR) && make_dir(RC_DIR) < 0)
+ exit(1);
+ }
+
userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "gtkrc-2.0", NULL);
gtk_rc_parse(userrc);
g_free(userrc);
"gtk-can-change-accels",
(glong)TRUE, "XProperty");
- CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
-
- MAKE_DIR_IF_NOT_EXIST(RC_DIR);
-
CHDIR_RETURN_VAL_IF_FAIL(get_rc_dir(), 1);
MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir());
gtk_window_set_default_icon(icon);
folderview_initialize();
+
mh_gtk_init();
imap_gtk_init();
news_gtk_init();
(prefs_common.sep_folder | prefs_common.sep_msg << 1);
folderview = mainwin->folderview;
+ gtk_clist_freeze(GTK_CLIST(mainwin->folderview->ctree));
+ folder_item_update_freeze();
+
/* register the callback of unix domain socket input */
#ifdef G_OS_UNIX
lock_socket_tag = gdk_input_add(lock_socket,
exit_sylpheed(mainwin);
}
+ gtk_window_deiconify(GTK_WINDOW(mainwin->window));
+
#ifdef HAVE_LIBETPAN
imap_main_init();
#endif
/* make one all-folder processing before using sylpheed */
main_window_cursor_wait(mainwin);
folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
- main_window_cursor_normal(mainwin);
/* if Sylpheed crashed, rebuild caches */
if (!cmd.crash && crash_file_present) {
debug_print("Sylpheed crashed, checking for new messages in local folders\n");
+ folder_item_update_thaw();
folderview_check_new(NULL);
folder_clean_cache_memory_force();
+ folder_item_update_freeze();
}
/* make the crash-indicator file */
str_write_to_file("foo", get_crashfile_name());
#ifdef HAVE_STARTUP_NOTIFICATION
startup_notification_complete(FALSE);
#endif
+ folder_item_update_thaw();
+ gtk_clist_thaw(GTK_CLIST(mainwin->folderview->ctree));
+ main_window_cursor_normal(mainwin);
if (cmd.receive_all)
g_timeout_add(1000, defer_check_all, GINT_TO_POINTER(FALSE));
} else if (!strncmp(argv[i], "--send", 6)) {
cmd.send = TRUE;
} else if (!strncmp(argv[i], "--version", 9)) {
- puts("Sylpheed version " VERSION);
+ puts("Sylpheed-Claws version " VERSION);
exit(0);
} else if (!strncmp(argv[i], "--status-full", 13)) {
const gchar *p = argv[i + 1];
" show the status of each 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 Sylpheed-Claws"));
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"));
} else if (!strncmp(argv[i], "--config-dir", sizeof "--config-dir" - 1)) {
puts(RC_DIR);
exit(0);
+ } else if (!strncmp(argv[i], "--exit", 6)) {
+ cmd.exit = TRUE;
}
}
void app_will_exit(GtkWidget *widget, gpointer data)
{
MainWindow *mainwin = data;
-
+
if (compose_get_compose_list()) {
gint val = alertpanel(_("Really quit?"),
_("Composing message exists."),
- _("Draft them"), _("Discard them"), _("Don't quit"));
+ _("_Save to Draft"), _("_Discard them"), _("Do_n't quit"));
switch (val) {
case G_ALERTOTHER:
return;
default:
draft_all_messages();
}
-
+
manage_window_focus_in(mainwin->window, NULL, NULL);
}
static gchar *filename = NULL;
if (filename == NULL) {
- filename = g_strdup_printf("%s%csylpheed-%d",
+ filename = g_strdup_printf("%s%csylpheed-claws-%d",
g_get_tmp_dir(), G_DIR_SEPARATOR,
#if HAVE_GETUID
getuid());
if (!strncmp(buf, ".\n", 2)) break;
fputs(buf, stdout);
}
+ } else if (cmd.exit) {
+ fd_write_all(uxsock, "exit\n", 5);
} else
fd_write_all(uxsock, "popup\n", 6);
fd_write_all(sock, ".\n", 2);
g_free(status);
if (folders) g_ptr_array_free(folders, TRUE);
+ } else if (!strncmp(buf, "exit", 4)) {
+ app_will_exit(NULL, mainwin);
}
fd_close(sock);