# include <gdk/gdkx.h>
#endif
-#include "sylpheed.h"
+#include "claws.h"
#include "main.h"
#include "mainwindow.h"
#include "folderview.h"
static void initial_processing (FolderItem *item, gpointer data);
static void quit_signal_handler (int sig);
static void install_basic_sighandlers (void);
-static void exit_sylpheed (MainWindow *mainwin);
+static void exit_claws (MainWindow *mainwin);
#define MAKE_DIR_IF_NOT_EXIST(dir) \
{ \
}
#endif /* HAVE_STARTUP_NOTIFICATION */
-void sylpheed_gtk_idle(void)
+void claws_gtk_idle(void)
{
while(gtk_events_pending()) {
gtk_main_iteration();
return (r == 0);
}
+static void migrate_common_rc(const gchar *old_rc, const gchar *new_rc)
+{
+ FILE *oldfp, *newfp;
+ gchar *plugin_path, *old_plugin_path, *new_plugin_path;
+ gchar buf[BUFFSIZE];
+ oldfp = g_fopen(old_rc, "r");
+ if (!oldfp)
+ return;
+ newfp = g_fopen(new_rc, "w");
+ if (!newfp) {
+ fclose(oldfp);
+ return;
+ }
+
+ plugin_path = g_strdup(get_plugin_dir());
+ new_plugin_path = g_strdup(plugin_path);
+
+ if (strstr(plugin_path, "/claws-mail/")) {
+ gchar *end = g_strdup(strstr(plugin_path, "/claws-mail/")+strlen("/claws-mail/"));
+ *(strstr(plugin_path, "/claws-mail/")) = '\0';
+ old_plugin_path = g_strconcat(plugin_path, "/sylpheed-claws/", end, NULL);
+ g_free(end);
+ } else {
+ old_plugin_path = g_strdup(new_plugin_path);
+ }
+ debug_print("replacing %s with %s\n", old_plugin_path, new_plugin_path);
+ while (fgets(buf, sizeof(buf), oldfp)) {
+ if (strncmp(buf, old_plugin_path, strlen(old_plugin_path))) {
+ fputs(buf, newfp);
+ } else {
+ debug_print("->replacing %s", buf);
+ debug_print(" with %s%s", new_plugin_path, buf+strlen(old_plugin_path));
+ fputs(new_plugin_path, newfp);
+ fputs(buf+strlen(old_plugin_path), newfp);
+ }
+ }
+ g_free(plugin_path);
+ g_free(new_plugin_path);
+ g_free(old_plugin_path);
+ fclose(oldfp);
+ fclose(newfp);
+}
+
#ifdef HAVE_LIBSM
static void
sc_client_set_value (MainWindow *mainwin,
gint num_folder_class = 0;
START_TIMING("startup");
- if (!sylpheed_init(&argc, &argv)) {
+ if (!claws_init(&argc, &argv)) {
return 0;
}
parse_cmd_opt(argc, argv);
- if (!cmd.exit)
- plugin_load_all("Common");
-
#ifdef CRASH_DIALOG
if (cmd.crash) {
gtk_set_locale();
if (r == FALSE && !is_dir_exist(RC_DIR) && make_dir(RC_DIR) < 0)
exit(1);
}
+ if (!is_file_exist(RC_DIR G_DIR_SEPARATOR_S COMMON_RC) &&
+ is_file_exist(RC_DIR G_DIR_SEPARATOR_S OLD_COMMON_RC)) {
+ /* post 2.6 name change */
+ migrate_common_rc(RC_DIR G_DIR_SEPARATOR_S OLD_COMMON_RC,
+ RC_DIR G_DIR_SEPARATOR_S COMMON_RC);
+ }
+
+ if (!cmd.exit)
+ plugin_load_all("Common");
userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "gtkrc-2.0", NULL);
gtk_rc_parse(userrc);
remove_all_files(get_tmp_dir());
remove_all_files(get_mime_tmp_dir());
- if (is_file_exist("sylpheed.log")) {
- if (rename_force("sylpheed.log", "sylpheed.log.bak") < 0)
- FILE_OP_ERROR("sylpheed.log", "rename");
+ if (is_file_exist("claws.log")) {
+ if (rename_force("claws.log", "claws.log.bak") < 0)
+ FILE_OP_ERROR("claws.log", "rename");
}
- set_log_file("sylpheed.log");
+ set_log_file("claws.log");
CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
exit(1);
account_read_config_all();
if(!account_get_list())
- exit_sylpheed(mainwin);
+ exit_claws(mainwin);
}
prefs_matcher_read_config();
- /* make one all-folder processing before using sylpheed */
+ /* make one all-folder processing before using claws */
main_window_cursor_wait(mainwin);
folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
- /* if Sylpheed crashed, rebuild caches */
+ /* if claws crashed, rebuild caches */
if (!cmd.crash && crash_file_present) {
GTK_EVENTS_FLUSH();
debug_print("Claws Mail crashed, checking for new messages in local folders\n");
cmd.status_full_folders = NULL;
}
- sylpheed_register_idle_function(sylpheed_gtk_idle);
+ claws_register_idle_function(claws_gtk_idle);
prefs_toolbar_init();
"mailbox, but could not load it. It is "
"probably provided by an out-of-date "
"external plugin. Please reinstall the "
- "plugin and try again."));
+ "plugin and try again.\nIt may also be "
+ "due to a failing IMAP account."));
exit(1);
}
END_TIMING();
gtk_main();
- exit_sylpheed(mainwin);
+ exit_claws(mainwin);
return 0;
}
static gboolean sc_exiting = FALSE;
-static void exit_sylpheed(MainWindow *mainwin)
+static void exit_claws(MainWindow *mainwin)
{
gchar *filename;
gtkaspell_checkers_quit();
#endif
plugin_unload_all("Common");
- sylpheed_done();
+ claws_done();
}
static void parse_cmd_opt(int argc, char *argv[])
cmd.attach_files = g_ptr_array_new();
}
if (*p != G_DIR_SEPARATOR) {
- file = g_strconcat(sylpheed_get_startup_dir(),
+ file = g_strconcat(claws_get_startup_dir(),
G_DIR_SEPARATOR_S,
p, NULL);
} else {
draft_all_messages();
emergency_exit = TRUE;
- exit_sylpheed(static_mainwindow);
+ exit_claws(static_mainwindow);
exit(0);
return FALSE;
gtk_main_quit();
}
-gboolean sylpheed_is_exiting(void)
+gboolean claws_is_exiting(void)
{
return sc_exiting;
}