2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <glib/gi18n.h>
28 #include <gtk/gtkmain.h>
29 #include <gtk/gtkrc.h>
38 #include <sys/types.h>
43 #include <X11/SM/SMlib.h>
48 #ifdef HAVE_STARTUP_NOTIFICATION
49 # define SN_API_NOT_YET_FROZEN
50 # include <libsn/sn-launchee.h>
51 # include <gdk/gdkx.h>
56 #include "mainwindow.h"
57 #include "folderview.h"
58 #include "image_viewer.h"
59 #include "summaryview.h"
60 #include "prefs_common.h"
61 #include "prefs_account.h"
62 #include "prefs_actions.h"
63 #include "prefs_ext_prog.h"
64 #include "prefs_fonts.h"
65 #include "prefs_image_viewer.h"
66 #include "prefs_message.h"
67 #include "prefs_receive.h"
68 #include "prefs_msg_colors.h"
69 #include "prefs_quote.h"
70 #include "prefs_spelling.h"
71 #include "prefs_summaries.h"
72 #include "prefs_themes.h"
73 #include "prefs_other.h"
74 #include "prefs_logging.h"
75 #include "prefs_send.h"
76 #include "prefs_wrapping.h"
77 #include "prefs_compose_writing.h"
78 #include "prefs_display_header.h"
83 #include "manage_window.h"
84 #include "alertpanel.h"
85 #include "statusbar.h"
86 #include "addressbook.h"
94 #include "prefs_toolbar.h"
101 #include "imap-thread.h"
103 #include "stock_pixmap.h"
105 #include "valgrind.h"
118 #include <hildon-widgets/hildon-program.h>
119 #include <gtk/gtkmain.h>
122 #define OSSO_EXAMPLE_NAME "claws-mail"
123 #define OSSO_EXAMPLE_SERVICE "org.maemo."OSSO_EXAMPLE_NAME
124 #define OSSO_EXAMPLE_OBJECT "/org/maemo/"OSSO_EXAMPLE_NAME
125 #define OSSO_EXAMPLE_IFACE "org.maemo."OSSO_EXAMPLE_NAME
127 typedef struct _AppData AppData;
129 HildonProgram *program;
130 HildonWindow *window;
131 osso_context_t *osso_context;
138 #ifdef HAVE_STARTUP_NOTIFICATION
139 static SnLauncheeContext *sn_context = NULL;
140 static SnDisplay *sn_display = NULL;
143 static gint lock_socket = -1;
144 static gint lock_socket_tag = 0;
145 static gchar *x_display = NULL;
148 ONLINE_MODE_DONT_CHANGE,
153 static struct RemoteCmd {
155 gboolean receive_all;
157 const gchar *compose_mailto;
158 GPtrArray *attach_files;
160 gboolean status_full;
161 GPtrArray *status_folders;
162 GPtrArray *status_full_folders;
169 const gchar *subscribe_uri;
173 static void parse_cmd_opt(int argc, char *argv[]);
175 static gint prohibit_duplicate_launch (void);
176 static gchar * get_crashfile_name (void);
177 static gint lock_socket_remove (void);
178 static void lock_socket_input_cb (gpointer data,
180 GdkInputCondition condition);
182 static void open_compose_new (const gchar *address,
183 GPtrArray *attach_files);
185 static void send_queue (void);
186 static void initial_processing (FolderItem *item, gpointer data);
187 static void quit_signal_handler (int sig);
188 static void install_basic_sighandlers (void);
189 static void exit_claws (MainWindow *mainwin);
191 #define MAKE_DIR_IF_NOT_EXIST(dir) \
193 if (!is_dir_exist(dir)) { \
194 if (is_file_exist(dir)) { \
196 (_("File '%s' already exists.\n" \
197 "Can't create folder."), \
201 if (make_dir(dir) < 0) \
206 static MainWindow *static_mainwindow;
209 static HildonProgram *static_hildonprogram;
210 void exit_event_handler(gboolean die_now, gpointer data)
213 appdata = (AppData *) data;
214 /* Do whatever application needs to do before exiting */
215 exit_claws(static_mainwindow);
216 hildon_banner_show_information(GTK_WIDGET(appdata->window), NULL,
221 /* Callback for normal D-BUS messages */
222 gint dbus_req_handler(const gchar * interface, const gchar * method,
223 GArray * arguments, gpointer data,
227 appdata = (AppData *) data;
229 osso_system_note_infoprint(appdata->osso_context, method, retval);
230 osso_rpc_free_val(retval);
235 static gboolean emergency_exit = FALSE;
237 #ifdef HAVE_STARTUP_NOTIFICATION
238 static void sn_error_trap_push(SnDisplay *display, Display *xdisplay)
240 gdk_error_trap_push();
243 static void sn_error_trap_pop(SnDisplay *display, Display *xdisplay)
245 gdk_error_trap_pop();
248 static void startup_notification_complete(gboolean with_window)
251 GtkWidget *hack = NULL;
254 /* this is needed to make the startup notification leave,
255 * if we have been launched from a menu.
256 * We have to display a window, so let it be very little */
257 hack = gtk_window_new(GTK_WINDOW_POPUP);
258 gtk_widget_set_uposition(hack, 0, 0);
259 gtk_widget_set_size_request(hack, 1, 1);
260 gtk_widget_show(hack);
263 xdisplay = GDK_DISPLAY();
264 sn_display = sn_display_new(xdisplay,
267 sn_context = sn_launchee_context_new_from_environment(sn_display,
268 DefaultScreen(xdisplay));
270 if (sn_context != NULL) {
271 sn_launchee_context_complete(sn_context);
272 sn_launchee_context_unref(sn_context);
273 sn_display_unref(sn_display);
276 gtk_widget_destroy(hack);
279 #endif /* HAVE_STARTUP_NOTIFICATION */
281 static void claws_gtk_idle(void)
283 while(gtk_events_pending()) {
284 gtk_main_iteration();
289 static gboolean defer_check_all(void *data)
291 gboolean autochk = GPOINTER_TO_INT(data);
293 inc_all_account_mail(static_mainwindow, autochk,
294 prefs_common.newmail_notify_manu);
299 static gboolean defer_check(void *data)
301 inc_mail(static_mainwindow, prefs_common.newmail_notify_manu);
306 static gboolean defer_jump(void *data)
308 mainwindow_jump_to(data);
312 static void chk_update_val(GtkWidget *widget, gpointer data)
314 gboolean *val = (gboolean *)data;
315 *val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
318 static gboolean migrate_old_config(const gchar *old_cfg_dir, const gchar *new_cfg_dir, const gchar *oldversion)
320 gchar *message = g_strdup_printf(_("Configuration for %s (or previous) found.\n"
321 "Do you want to migrate this configuration?"), oldversion);
323 GtkWidget *window = NULL;
324 GtkWidget *keep_backup_chk;
325 GtkTooltips *tips = gtk_tooltips_new();
326 gboolean backup = TRUE;
328 keep_backup_chk = gtk_check_button_new_with_label (_("Keep old configuration"));
329 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(keep_backup_chk), TRUE);
330 gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), keep_backup_chk,
331 _("Keeping a backup will allow you to go back to an "
332 "older version, but may take a while if you have "
333 "cached IMAP or News data, and will take some extra "
334 "room on your disk."),
337 g_signal_connect(G_OBJECT(keep_backup_chk), "toggled",
338 G_CALLBACK(chk_update_val), &backup);
340 if (alertpanel_full(_("Migration of configuration"), message,
341 GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL, FALSE,
342 keep_backup_chk, ALERT_QUESTION, G_ALERTDEFAULT) != G_ALERTALTERNATE) {
346 /* we can either do a fast migration requiring not any extra disk
347 * space, or a slow one that copies the old configuration and leaves
351 window = label_window_create(_("Copying configuration... This may take a while..."));
354 r = copy_dir(old_cfg_dir, new_cfg_dir);
355 gtk_widget_destroy(window);
357 /* if copy failed, we'll remove the partially copied
360 alertpanel_error(_("Migration failed!"));
361 remove_dir_recursive(new_cfg_dir);
364 /* fast mode failed, but we don't want backup */
365 remove_dir_recursive(old_cfg_dir);
369 window = label_window_create(_("Migrating configuration..."));
372 r = g_rename(old_cfg_dir, new_cfg_dir);
373 gtk_widget_destroy(window);
375 /* if g_rename failed, we'll try to copy */
377 FILE_OP_ERROR(new_cfg_dir, "g_rename failed, trying copy\n");
384 static void migrate_common_rc(const gchar *old_rc, const gchar *new_rc)
387 gchar *plugin_path, *old_plugin_path, *new_plugin_path;
389 oldfp = g_fopen(old_rc, "r");
392 newfp = g_fopen(new_rc, "w");
398 plugin_path = g_strdup(get_plugin_dir());
399 new_plugin_path = g_strdup(plugin_path);
401 if (strstr(plugin_path, "/claws-mail/")) {
402 gchar *end = g_strdup(strstr(plugin_path, "/claws-mail/")+strlen("/claws-mail/"));
403 *(strstr(plugin_path, "/claws-mail/")) = '\0';
404 old_plugin_path = g_strconcat(plugin_path, "/sylpheed-claws/", end, NULL);
407 old_plugin_path = g_strdup(new_plugin_path);
409 debug_print("replacing %s with %s\n", old_plugin_path, new_plugin_path);
410 while (fgets(buf, sizeof(buf), oldfp)) {
411 if (strncmp(buf, old_plugin_path, strlen(old_plugin_path))) {
414 debug_print("->replacing %s", buf);
415 debug_print(" with %s%s", new_plugin_path, buf+strlen(old_plugin_path));
416 fputs(new_plugin_path, newfp);
417 fputs(buf+strlen(old_plugin_path), newfp);
421 g_free(new_plugin_path);
422 g_free(old_plugin_path);
429 sc_client_set_value (MainWindow *mainwin,
440 prop.num_vals = num_vals;
444 if (mainwin->smc_conn)
445 SmcSetProperties ((SmcConn) mainwin->smc_conn, 1, proplist);
448 static void sc_die_callback (SmcConn smc_conn, SmPointer client_data)
453 static void sc_save_complete_callback(SmcConn smc_conn, SmPointer client_data)
457 static void sc_shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data)
459 MainWindow *mainwin = (MainWindow *)client_data;
460 if (mainwin->smc_conn)
461 SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
464 static void sc_save_yourself_callback (SmcConn smc_conn,
465 SmPointer client_data,
471 MainWindow *mainwin = (MainWindow *)client_data;
472 if (mainwin->smc_conn)
473 SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
476 static IceIOErrorHandler sc_ice_installed_handler;
478 static void sc_ice_io_error_handler (IceConn connection)
480 if (sc_ice_installed_handler)
481 (*sc_ice_installed_handler) (connection);
483 static gboolean sc_process_ice_messages (GIOChannel *source,
484 GIOCondition condition,
487 IceConn connection = (IceConn) data;
488 IceProcessMessagesStatus status;
490 status = IceProcessMessages (connection, NULL, NULL);
492 if (status == IceProcessMessagesIOError) {
493 IcePointer context = IceGetConnectionContext (connection);
495 if (context && GTK_IS_OBJECT (context)) {
496 guint disconnect_id = g_signal_lookup ("disconnect", G_OBJECT_TYPE (context));
498 if (disconnect_id > 0)
499 g_signal_emit (context, disconnect_id, 0);
501 IceSetShutdownNegotiation (connection, False);
502 IceCloseConnection (connection);
509 static void new_ice_connection (IceConn connection, IcePointer client_data, Bool opening,
510 IcePointer *watch_data)
516 /* Make sure we don't pass on these file descriptors to any
518 fcntl(IceConnectionNumber(connection),F_SETFD,
519 fcntl(IceConnectionNumber(connection),F_GETFD,0) | FD_CLOEXEC);
521 channel = g_io_channel_unix_new (IceConnectionNumber (connection));
522 input_id = g_io_add_watch (channel,
523 G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI,
524 sc_process_ice_messages,
526 g_io_channel_unref (channel);
528 *watch_data = (IcePointer) GUINT_TO_POINTER (input_id);
530 input_id = GPOINTER_TO_UINT ((gpointer) *watch_data);
531 g_source_remove (input_id);
535 static void sc_session_manager_connect(MainWindow *mainwin)
537 static gboolean connected = FALSE;
538 SmcCallbacks callbacks;
540 IceIOErrorHandler default_handler;
547 sc_ice_installed_handler = IceSetIOErrorHandler (NULL);
548 default_handler = IceSetIOErrorHandler (sc_ice_io_error_handler);
550 if (sc_ice_installed_handler == default_handler)
551 sc_ice_installed_handler = NULL;
553 IceAddConnectionWatch (new_ice_connection, NULL);
556 callbacks.save_yourself.callback = sc_save_yourself_callback;
557 callbacks.die.callback = sc_die_callback;
558 callbacks.save_complete.callback = sc_save_complete_callback;
559 callbacks.shutdown_cancelled.callback = sc_shutdown_cancelled_callback;
561 callbacks.save_yourself.client_data =
562 callbacks.die.client_data =
563 callbacks.save_complete.client_data =
564 callbacks.shutdown_cancelled.client_data = (SmPointer) mainwin;
565 if (g_getenv ("SESSION_MANAGER")) {
566 gchar error_string_ret[256] = "";
568 mainwin->smc_conn = (gpointer)
569 SmcOpenConnection (NULL, mainwin,
570 SmProtoMajor, SmProtoMinor,
571 SmcSaveYourselfProcMask | SmcDieProcMask |
572 SmcSaveCompleteProcMask |
573 SmcShutdownCancelledProcMask,
576 256, error_string_ret);
578 if (error_string_ret[0] || mainwin->smc_conn == NULL)
579 g_warning ("While connecting to session manager:\n%s.",
583 vals = g_new (SmPropValue, 1);
584 vals[0].length = strlen(argv0);
585 vals[0].value = argv0;
586 sc_client_set_value (mainwin, SmCloneCommand, SmLISTofARRAY8, 1, vals);
587 sc_client_set_value (mainwin, SmRestartCommand, SmLISTofARRAY8, 1, vals);
588 sc_client_set_value (mainwin, SmProgram, SmARRAY8, 1, vals);
590 vals[0].length = strlen(g_get_user_name()?g_get_user_name():"");
591 vals[0].value = g_strdup(g_get_user_name()?g_get_user_name():"");
592 sc_client_set_value (mainwin, SmUserID, SmARRAY8, 1, vals);
598 static gboolean sc_exiting = FALSE;
599 static gboolean sc_starting = FALSE;
600 static gboolean show_at_startup = TRUE;
602 void main_set_show_at_startup(gboolean show)
604 show_at_startup = show;
607 int main(int argc, char *argv[])
610 osso_context_t *osso_context;
611 osso_return_t result;
615 FolderView *folderview;
617 gboolean crash_file_present = FALSE;
618 gint num_folder_class = 0;
619 gboolean asked_for_migration = FALSE;
621 START_TIMING("startup");
625 if (!claws_init(&argc, &argv)) {
629 prefs_prepare_cache();
630 prog_version = PROG_VERSION;
631 argv0 = g_strdup(argv[0]);
633 parse_cmd_opt(argc, argv);
638 gtk_init(&argc, &argv);
639 crash_main(cmd.crash_params);
642 crash_install_handlers();
644 install_basic_sighandlers();
647 /* check and create unix domain socket for remote operation */
649 lock_socket = prohibit_duplicate_launch();
650 if (lock_socket < 0) {
651 #ifdef HAVE_STARTUP_NOTIFICATION
652 if(gtk_init_check(&argc, &argv))
653 startup_notification_complete(TRUE);
658 if (cmd.status || cmd.status_full) {
659 puts("0 Claws Mail not running.");
660 lock_socket_remove();
667 if (!g_thread_supported())
671 gtk_init(&argc, &argv);
674 osso_context = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
675 if (osso_context == NULL) {
678 static_hildonprogram = HILDON_PROGRAM(hildon_program_get_instance());
681 gtk_widget_set_default_colormap(gdk_rgb_get_colormap());
682 gtk_widget_set_default_visual(gdk_rgb_get_visual());
684 if (!g_thread_supported()) {
685 g_error(_("g_thread is not supported by glib.\n"));
688 /* check that we're not on a too recent/old gtk+ */
689 #if GTK_CHECK_VERSION(2, 9, 0)
690 if (gtk_check_version(2, 9, 0) != NULL) {
691 alertpanel_error(_("Claws Mail has been compiled with "
692 "a more recent GTK+ library than is "
693 "currently available. This will cause "
694 "crashes. You need to upgrade GTK+ or "
695 "recompile Claws Mail."));
699 if (gtk_check_version(2, 9, 0) == NULL) {
700 alertpanel_error(_("Claws Mail has been compiled with "
701 "an older GTK+ library than is "
702 "currently available. This will cause "
703 "crashes. You need to recompile "
708 /* parse gtkrc files */
709 userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc-2.0",
711 gtk_rc_parse(userrc);
713 userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtk",
714 G_DIR_SEPARATOR_S, "gtkrc-2.0", NULL);
715 gtk_rc_parse(userrc);
718 CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
720 /* no config dir exists. See if we can migrate an old config. */
721 if (!is_dir_exist(RC_DIR)) {
722 prefs_destroy_cache();
725 /* if one of the old dirs exist, we'll ask if the user
726 * want to migrates, and r will be TRUE if he said yes
727 * and migration succeeded, and FALSE otherwise.
729 if (is_dir_exist(OLD_GTK2_RC_DIR)) {
730 r = migrate_old_config(OLD_GTK2_RC_DIR, RC_DIR, "Sylpheed-Claws 2.6.0");
731 asked_for_migration = TRUE;
732 } else if (is_dir_exist(OLDER_GTK2_RC_DIR)) {
733 r = migrate_old_config(OLDER_GTK2_RC_DIR, RC_DIR, "Sylpheed-Claws 1.9.15");
734 asked_for_migration = TRUE;
735 } else if (is_dir_exist(OLD_GTK1_RC_DIR)) {
736 r = migrate_old_config(OLD_GTK1_RC_DIR, RC_DIR, "Sylpheed-Claws 1.0.5");
737 asked_for_migration = TRUE;
740 /* If migration failed or the user didn't want to do it,
741 * we create a new one (and we'll hit wizard later).
743 if (r == FALSE && !is_dir_exist(RC_DIR) && make_dir(RC_DIR) < 0)
748 if (!is_file_exist(RC_DIR G_DIR_SEPARATOR_S COMMON_RC) &&
749 is_file_exist(RC_DIR G_DIR_SEPARATOR_S OLD_COMMON_RC)) {
750 /* post 2.6 name change */
751 migrate_common_rc(RC_DIR G_DIR_SEPARATOR_S OLD_COMMON_RC,
752 RC_DIR G_DIR_SEPARATOR_S COMMON_RC);
756 plugin_load_all("Common");
758 userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "gtkrc-2.0", NULL);
759 gtk_rc_parse(userrc);
762 userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
763 gtk_accel_map_load (userrc);
766 CHDIR_RETURN_VAL_IF_FAIL(get_rc_dir(), 1);
768 MAKE_DIR_IF_NOT_EXIST(get_mail_base_dir());
769 MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir());
770 MAKE_DIR_IF_NOT_EXIST(get_news_cache_dir());
771 MAKE_DIR_IF_NOT_EXIST(get_mime_tmp_dir());
772 MAKE_DIR_IF_NOT_EXIST(get_tmp_dir());
773 MAKE_DIR_IF_NOT_EXIST(UIDL_DIR);
775 crash_file_present = is_file_exist(get_crashfile_name());
776 /* remove temporary files */
777 remove_all_files(get_tmp_dir());
778 remove_all_files(get_mime_tmp_dir());
780 if (is_file_exist("claws.log")) {
781 if (rename_force("claws.log", "claws.log.bak") < 0)
782 FILE_OP_ERROR("claws.log", "rename");
784 set_log_file(LOG_PROTOCOL, "claws.log");
786 if (is_file_exist("filtering.log")) {
787 if (rename_force("filtering.log", "filtering.log.bak") < 0)
788 FILE_OP_ERROR("filtering.log", "rename");
790 set_log_file(LOG_DEBUG_FILTERING, "filtering.log");
792 CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
794 folder_system_init();
795 prefs_common_read_config();
799 prefs_ext_prog_init();
800 prefs_wrapping_init();
801 prefs_compose_writing_init();
802 prefs_msg_colors_init();
804 prefs_image_viewer_init();
806 prefs_summaries_init();
807 prefs_message_init();
809 prefs_logging_init();
810 prefs_receive_init();
813 gtkaspell_checkers_init();
814 prefs_spelling_init();
817 sock_set_io_timeout(prefs_common.io_timeout_secs);
819 imap_main_set_timeout(prefs_common.io_timeout_secs);
821 prefs_actions_read_config();
822 prefs_display_header_read_config();
823 /* prefs_filtering_read_config(); */
824 addressbook_read_file();
825 renderer_read_config();
828 stock_pixbuf_gdk(NULL, STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon);
829 gtk_window_set_default_icon(icon);
831 folderview_initialize();
837 mainwin = main_window_create();
840 appdata = g_new0(AppData, 1);
841 appdata->program = static_hildonprogram;
842 appdata->window = mainwin->window;
843 appdata->osso_context = osso_context;
844 result = osso_rpc_set_cb_f(appdata->osso_context,
845 OSSO_EXAMPLE_SERVICE,
848 dbus_req_handler, appdata);
849 if (result != OSSO_OK) {
853 /* Add handler for Exit D-BUS messages */
854 result = osso_application_set_exit_cb(appdata->osso_context,
857 if (result != OSSO_OK) {
861 manage_window_focus_in(mainwin->window, NULL, NULL);
862 folderview = mainwin->folderview;
864 gtk_clist_freeze(GTK_CLIST(mainwin->folderview->ctree));
865 folder_item_update_freeze();
867 /* register the callback of unix domain socket input */
869 lock_socket_tag = gdk_input_add(lock_socket,
870 GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
871 lock_socket_input_cb,
875 prefs_account_init();
876 account_read_config_all();
878 /* If we can't read a folder list or don't have accounts,
879 * it means the configuration's not done. Either this is
880 * a brand new install, either a failed/refused migration.
881 * So we'll start the wizard.
883 if (folder_read_list() < 0) {
884 prefs_destroy_cache();
886 /* if run_wizard returns FALSE it's because it's
887 * been cancelled. We can't do much but exit.
888 * however, if the user was asked for a migration,
889 * we remove the newly created directory so that
890 * he's asked again for migration on next launch.*/
891 if (!run_wizard(mainwin, TRUE)) {
892 if (asked_for_migration)
893 remove_dir_recursive(RC_DIR);
896 main_window_reflect_prefs_all_now();
900 if (!account_get_list()) {
901 prefs_destroy_cache();
902 if (!run_wizard(mainwin, FALSE)) {
903 if (asked_for_migration)
904 remove_dir_recursive(RC_DIR);
907 account_read_config_all();
908 if(!account_get_list()) {
915 toolbar_main_set_sensitive(mainwin);
916 main_window_set_menu_sensitive(mainwin);
918 /* if crashed, show window early so that the user
919 * sees what's happening */
920 if (!cmd.crash && crash_file_present)
921 main_window_popup(mainwin);
924 imap_main_init(prefs_common.skip_ssl_cert_check);
926 account_set_missing_folder();
927 folder_set_missing_folders();
928 folderview_set(folderview);
930 prefs_matcher_read_config();
932 /* make one all-folder processing before using claws */
933 main_window_cursor_wait(mainwin);
934 folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
936 /* if claws crashed, rebuild caches */
937 if (!cmd.crash && crash_file_present) {
939 debug_print("Claws Mail crashed, checking for new messages in local folders\n");
940 folder_item_update_thaw();
941 folderview_check_new(NULL);
942 folder_clean_cache_memory_force();
943 folder_item_update_freeze();
945 /* make the crash-indicator file */
946 str_write_to_file("foo", get_crashfile_name());
948 inc_autocheck_timer_init(mainwin);
950 /* ignore SIGPIPE signal for preventing sudden death of program */
952 signal(SIGPIPE, SIG_IGN);
954 if (cmd.online_mode == ONLINE_MODE_OFFLINE) {
955 main_window_toggle_work_offline(mainwin, TRUE, FALSE);
957 if (cmd.online_mode == ONLINE_MODE_ONLINE) {
958 main_window_toggle_work_offline(mainwin, FALSE, FALSE);
961 if (cmd.status_folders) {
962 g_ptr_array_free(cmd.status_folders, TRUE);
963 cmd.status_folders = NULL;
965 if (cmd.status_full_folders) {
966 g_ptr_array_free(cmd.status_full_folders, TRUE);
967 cmd.status_full_folders = NULL;
970 claws_register_idle_function(claws_gtk_idle);
972 prefs_toolbar_init();
974 num_folder_class = g_list_length(folder_get_list());
976 plugin_load_all("GTK2");
978 if (g_list_length(folder_get_list()) != num_folder_class) {
979 debug_print("new folders loaded, reloading processing rules\n");
980 prefs_matcher_read_config();
983 if (plugin_get_unloaded_list() != NULL) {
984 main_window_cursor_normal(mainwin);
985 alertpanel_warning(_("Some plugin(s) failed to load. "
986 "Check the Plugins configuration "
987 "for more information."));
988 main_window_cursor_wait(mainwin);
991 plugin_load_standard_plugins ();
993 /* if not crashed, show window now */
994 if (!(!cmd.crash && crash_file_present)) {
995 /* apart if something told not to show */
997 main_window_popup(mainwin);
1000 if (!folder_have_mailbox()) {
1001 prefs_destroy_cache();
1002 main_window_cursor_normal(mainwin);
1003 if (folder_get_list() != NULL) {
1004 alertpanel_error(_("Claws Mail has detected a configured "
1005 "mailbox, but it is incomplete. It is "
1006 "possibly due to a failing IMAP account. Use "
1007 "\"Rebuild folder tree\" on the mailbox parent "
1008 "folder's context menu to try to fix it."));
1010 alertpanel_error(_("Claws Mail has detected a configured "
1011 "mailbox, but could not load it. It is "
1012 "probably provided by an out-of-date "
1013 "external plugin. Please reinstall the "
1014 "plugin and try again."));
1015 exit_claws(mainwin);
1020 static_mainwindow = mainwin;
1022 #ifdef HAVE_STARTUP_NOTIFICATION
1023 startup_notification_complete(FALSE);
1026 sc_session_manager_connect(mainwin);
1028 folder_item_update_thaw();
1029 gtk_clist_thaw(GTK_CLIST(mainwin->folderview->ctree));
1030 main_window_cursor_normal(mainwin);
1032 if (cmd.receive_all) {
1033 g_timeout_add(1000, defer_check_all, GINT_TO_POINTER(FALSE));
1034 } else if (prefs_common.chk_on_startup) {
1035 g_timeout_add(1000, defer_check_all, GINT_TO_POINTER(TRUE));
1036 } else if (cmd.receive) {
1037 g_timeout_add(1000, defer_check, NULL);
1039 gtk_widget_grab_focus(folderview->ctree);
1043 open_compose_new(cmd.compose_mailto, cmd.attach_files);
1045 if (cmd.attach_files) {
1046 ptr_array_free_strings(cmd.attach_files);
1047 g_ptr_array_free(cmd.attach_files, TRUE);
1048 cmd.attach_files = NULL;
1050 if (cmd.subscribe) {
1051 folder_subscribe(cmd.subscribe_uri);
1059 g_timeout_add(500, defer_jump, (gpointer)cmd.target);
1062 prefs_destroy_cache();
1064 compose_reopen_exit_drafts();
1066 sc_starting = FALSE;
1072 osso_deinitialize(osso_context);
1074 exit_claws(mainwin);
1079 static void save_all_caches(FolderItem *item, gpointer data)
1086 folder_item_close(item);
1088 folder_item_free_cache(item, TRUE);
1091 static void exit_claws(MainWindow *mainwin)
1097 debug_print("shutting down\n");
1098 inc_autocheck_timer_remove();
1100 if (prefs_common.clean_on_exit && !emergency_exit) {
1101 main_window_empty_trash(mainwin, prefs_common.ask_on_clean);
1104 /* save prefs for opened folder */
1105 if(mainwin->folderview->opened) {
1108 item = gtk_ctree_node_get_row_data(GTK_CTREE(mainwin->folderview->ctree), mainwin->folderview->opened);
1109 summary_save_prefs_to_folderitem(mainwin->folderview->summaryview, item);
1112 /* save all state before exiting */
1113 folder_func_to_all_folders(save_all_caches, NULL);
1114 folder_write_list();
1116 main_window_get_size(mainwin);
1117 main_window_get_position(mainwin);
1119 prefs_common_write_config();
1120 account_write_config_all();
1121 addressbook_export_to_file();
1123 filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
1124 gtk_accel_map_save(filename);
1127 /* delete temporary files */
1128 remove_all_files(get_tmp_dir());
1129 remove_all_files(get_mime_tmp_dir());
1131 close_log_file(LOG_PROTOCOL);
1132 close_log_file(LOG_DEBUG_FILTERING);
1134 #ifdef HAVE_LIBETPAN
1137 /* delete crashfile */
1139 g_unlink(get_crashfile_name());
1141 lock_socket_remove();
1144 if (mainwin->smc_conn)
1145 SmcCloseConnection ((SmcConn)mainwin->smc_conn, 0, NULL);
1146 mainwin->smc_conn = NULL;
1149 main_window_destroy_all();
1151 plugin_unload_all("GTK2");
1153 prefs_toolbar_done();
1155 addressbook_destroy();
1157 prefs_themes_done();
1159 prefs_ext_prog_done();
1160 prefs_wrapping_done();
1161 prefs_compose_writing_done();
1162 prefs_msg_colors_done();
1163 prefs_image_viewer_done();
1164 image_viewer_done();
1166 prefs_summaries_done();
1167 prefs_message_done();
1169 prefs_receive_done();
1172 prefs_spelling_done();
1173 gtkaspell_checkers_quit();
1175 plugin_unload_all("Common");
1179 static void parse_cmd_opt(int argc, char *argv[])
1183 for (i = 1; i < argc; i++) {
1184 if (!strncmp(argv[i], "--receive-all", 13)) {
1185 cmd.receive_all = TRUE;
1186 } else if (!strncmp(argv[i], "--receive", 9)) {
1188 } else if (!strncmp(argv[i], "--compose", 9)) {
1189 const gchar *p = argv[i + 1];
1192 cmd.compose_mailto = NULL;
1193 if (p && *p != '\0' && *p != '-') {
1194 if (!strncmp(p, "mailto:", 7)) {
1195 cmd.compose_mailto = p + 7;
1197 cmd.compose_mailto = p;
1201 } else if (!strncmp(argv[i], "--subscribe", 11)) {
1202 const gchar *p = argv[i + 1];
1203 if (p && *p != '\0' && *p != '-') {
1204 cmd.subscribe = TRUE;
1205 cmd.subscribe_uri = p;
1207 } else if (!strncmp(argv[i], "--attach", 8)) {
1208 const gchar *p = argv[i + 1];
1211 while (p && *p != '\0' && *p != '-') {
1212 if (!cmd.attach_files) {
1213 cmd.attach_files = g_ptr_array_new();
1215 if ((file = g_filename_from_uri(p, NULL, NULL)) != NULL) {
1216 if (!is_file_exist(file)) {
1221 if (file == NULL && *p != G_DIR_SEPARATOR) {
1222 file = g_strconcat(claws_get_startup_dir(),
1225 } else if (file == NULL) {
1228 g_ptr_array_add(cmd.attach_files, file);
1232 } else if (!strncmp(argv[i], "--send", 6)) {
1234 } else if (!strncmp(argv[i], "--version", 9) ||
1235 !strncmp(argv[i], "-v", 2)) {
1236 puts("Claws Mail version " VERSION);
1238 } else if (!strncmp(argv[i], "--status-full", 13)) {
1239 const gchar *p = argv[i + 1];
1241 cmd.status_full = TRUE;
1242 while (p && *p != '\0' && *p != '-') {
1243 if (!cmd.status_full_folders) {
1244 cmd.status_full_folders =
1247 g_ptr_array_add(cmd.status_full_folders,
1252 } else if (!strncmp(argv[i], "--status", 8)) {
1253 const gchar *p = argv[i + 1];
1256 while (p && *p != '\0' && *p != '-') {
1257 if (!cmd.status_folders)
1258 cmd.status_folders = g_ptr_array_new();
1259 g_ptr_array_add(cmd.status_folders,
1264 } else if (!strncmp(argv[i], "--online", 8)) {
1265 cmd.online_mode = ONLINE_MODE_ONLINE;
1266 } else if (!strncmp(argv[i], "--offline", 9)) {
1267 cmd.online_mode = ONLINE_MODE_OFFLINE;
1268 } else if (!strncmp(argv[i], "--help", 6) ||
1269 !strncmp(argv[i], "-h", 2)) {
1270 gchar *base = g_path_get_basename(argv[0]);
1271 g_print(_("Usage: %s [OPTION]...\n"), base);
1273 g_print("%s\n", _(" --compose [address] open composition window"));
1274 g_print("%s\n", _(" --subscribe [uri] subscribe to the given URI if possible"));
1275 g_print("%s\n", _(" --attach file1 [file2]...\n"
1276 " open composition window with specified files\n"
1278 g_print("%s\n", _(" --receive receive new messages"));
1279 g_print("%s\n", _(" --receive-all receive new messages of all accounts"));
1280 g_print("%s\n", _(" --send send all queued messages"));
1281 g_print("%s\n", _(" --status [folder]... show the total number of messages"));
1282 g_print("%s\n", _(" --status-full [folder]...\n"
1283 " show the status of each folder"));
1284 g_print("%s\n", _(" --select folder[/msg] jumps to the specified folder/message\n"
1285 " folder is a folder id like 'folder/sub_folder'"));
1286 g_print("%s\n", _(" --online switch to online mode"));
1287 g_print("%s\n", _(" --offline switch to offline mode"));
1288 g_print("%s\n", _(" --exit --quit -q exit Claws Mail"));
1289 g_print("%s\n", _(" --debug debug mode"));
1290 g_print("%s\n", _(" --help -h display this help and exit"));
1291 g_print("%s\n", _(" --version -v output version information and exit"));
1292 g_print("%s\n", _(" --config-dir output configuration directory"));
1296 } else if (!strncmp(argv[i], "--crash", 7)) {
1298 cmd.crash_params = g_strdup(argv[i + 1]);
1300 } else if (!strncmp(argv[i], "--config-dir", sizeof "--config-dir" - 1)) {
1303 } else if (!strncmp(argv[i], "--exit", 6) ||
1304 !strncmp(argv[i], "--quit", 6) ||
1305 !strncmp(argv[i], "-q", 2)) {
1307 } else if (!strncmp(argv[i], "--select", 8) && i+1 < argc) {
1308 cmd.target = argv[i+1];
1309 } else if (i == 1 && argc == 2) {
1310 /* only one parameter. Do something intelligent about it */
1311 if (strstr(argv[i], "@") && !strstr(argv[i], "://")) {
1312 const gchar *p = argv[i];
1315 cmd.compose_mailto = NULL;
1316 if (p && *p != '\0' && *p != '-') {
1317 if (!strncmp(p, "mailto:", 7)) {
1318 cmd.compose_mailto = p + 7;
1320 cmd.compose_mailto = p;
1323 } else if (strstr(argv[i], "://")) {
1324 const gchar *p = argv[i];
1325 if (p && *p != '\0' && *p != '-') {
1326 cmd.subscribe = TRUE;
1327 cmd.subscribe_uri = p;
1329 } else if (!strcmp(argv[i], "--sync")) {
1332 g_print(_("Unknown option\n"));
1338 if (cmd.attach_files && cmd.compose == FALSE) {
1340 cmd.compose_mailto = NULL;
1344 static void initial_processing(FolderItem *item, gpointer data)
1346 MainWindow *mainwin = (MainWindow *)data;
1349 g_return_if_fail(item);
1350 buf = g_strdup_printf(_("Processing (%s)..."),
1353 : _("top level folder"));
1357 if (item->prefs->enable_processing) {
1358 folder_item_apply_processing(item);
1361 STATUSBAR_POP(mainwin);
1364 static void draft_all_messages(void)
1366 GList *compose_list = NULL;
1368 compose_clear_exit_drafts();
1369 while ((compose_list = compose_get_compose_list()) != NULL) {
1370 Compose *c = (Compose*)compose_list->data;
1371 compose_draft(c, COMPOSE_DRAFT_FOR_EXIT);
1374 gboolean clean_quit(gpointer data)
1376 static gboolean firstrun = TRUE;
1383 /*!< Good idea to have the main window stored in a
1384 * static variable so we can check that variable
1385 * to see if we're really allowed to do things
1386 * that actually the spawner is supposed to
1387 * do (like: sending mail, composing messages).
1388 * Because, really, if we're the spawnee, and
1389 * we touch GTK stuff, we're hosed. See the
1392 /* FIXME: Use something else to signal that we're
1393 * in the original spawner, and not in a spawned
1395 if (!static_mainwindow) {
1399 draft_all_messages();
1400 emergency_exit = TRUE;
1401 exit_claws(static_mainwindow);
1407 void app_will_exit(GtkWidget *widget, gpointer data)
1409 MainWindow *mainwin = data;
1411 if (sc_exiting == TRUE) {
1412 debug_print("exit pending\n");
1416 debug_print("exiting\n");
1417 if (compose_get_compose_list()) {
1418 draft_all_messages();
1421 if (prefs_common.warn_queued_on_exit && procmsg_have_queued_mails_fast()) {
1422 if (alertpanel(_("Queued messages"),
1423 _("Some unsent messages are queued. Exit now?"),
1424 GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL)
1425 != G_ALERTALTERNATE) {
1426 main_window_popup(mainwin);
1430 manage_window_focus_in(mainwin->window, NULL, NULL);
1434 #ifdef HAVE_VALGRIND
1435 if (RUNNING_ON_VALGRIND) {
1436 summary_clear_list(mainwin->summaryview);
1439 if (folderview_get_selected_item(mainwin->folderview))
1440 folder_item_close(folderview_get_selected_item(mainwin->folderview));
1444 gboolean claws_is_exiting(void)
1449 gboolean claws_is_starting(void)
1455 * CLAWS: want this public so crash dialog can delete the
1458 gchar *claws_get_socket_name(void)
1460 static gchar *filename = NULL;
1462 if (filename == NULL) {
1463 filename = g_strdup_printf("%s%cclaws-mail-%d",
1464 g_get_tmp_dir(), G_DIR_SEPARATOR,
1475 static gchar *get_crashfile_name(void)
1477 static gchar *filename = NULL;
1479 if (filename == NULL) {
1480 filename = g_strdup_printf("%s%cclaws-crashed",
1481 get_tmp_dir(), G_DIR_SEPARATOR);
1487 static gint prohibit_duplicate_launch(void)
1492 path = claws_get_socket_name();
1493 uxsock = fd_connect_unix(path);
1495 if (x_display == NULL)
1496 x_display = g_strdup(g_getenv("DISPLAY"));
1500 return fd_open_unix(path);
1503 /* remote command mode */
1505 debug_print("another Claws Mail instance is already running.\n");
1507 if (cmd.receive_all) {
1508 fd_write_all(uxsock, "receive_all\n", 12);
1509 } else if (cmd.receive) {
1510 fd_write_all(uxsock, "receive\n", 8);
1511 } else if (cmd.compose && cmd.attach_files) {
1512 gchar *str, *compose_str;
1515 if (cmd.compose_mailto) {
1516 compose_str = g_strdup_printf("compose_attach %s\n",
1517 cmd.compose_mailto);
1519 compose_str = g_strdup("compose_attach\n");
1522 fd_write_all(uxsock, compose_str, strlen(compose_str));
1523 g_free(compose_str);
1525 for (i = 0; i < cmd.attach_files->len; i++) {
1526 str = g_ptr_array_index(cmd.attach_files, i);
1527 fd_write_all(uxsock, str, strlen(str));
1528 fd_write_all(uxsock, "\n", 1);
1531 fd_write_all(uxsock, ".\n", 2);
1532 } else if (cmd.compose) {
1535 if (cmd.compose_mailto) {
1536 compose_str = g_strdup_printf
1537 ("compose %s\n", cmd.compose_mailto);
1539 compose_str = g_strdup("compose\n");
1542 fd_write_all(uxsock, compose_str, strlen(compose_str));
1543 g_free(compose_str);
1544 } else if (cmd.subscribe) {
1545 gchar *str = g_strdup_printf("subscribe %s\n", cmd.subscribe_uri);
1546 fd_write_all(uxsock, str, strlen(str));
1548 } else if (cmd.send) {
1549 fd_write_all(uxsock, "send\n", 5);
1550 } else if (cmd.online_mode == ONLINE_MODE_ONLINE) {
1551 fd_write(uxsock, "online\n", 6);
1552 } else if (cmd.online_mode == ONLINE_MODE_OFFLINE) {
1553 fd_write(uxsock, "offline\n", 7);
1554 } else if (cmd.status || cmd.status_full) {
1555 gchar buf[BUFFSIZE];
1557 const gchar *command;
1561 command = cmd.status_full ? "status-full\n" : "status\n";
1562 folders = cmd.status_full ? cmd.status_full_folders :
1565 fd_write_all(uxsock, command, strlen(command));
1566 for (i = 0; folders && i < folders->len; ++i) {
1567 folder = g_ptr_array_index(folders, i);
1568 fd_write_all(uxsock, folder, strlen(folder));
1569 fd_write_all(uxsock, "\n", 1);
1571 fd_write_all(uxsock, ".\n", 2);
1573 fd_gets(uxsock, buf, sizeof(buf));
1574 if (!strncmp(buf, ".\n", 2)) break;
1577 } else if (cmd.exit) {
1578 fd_write_all(uxsock, "exit\n", 5);
1579 } else if (cmd.target) {
1580 gchar *str = g_strdup_printf("select %s\n", cmd.target);
1581 fd_write_all(uxsock, str, strlen(str));
1585 fd_write_all(uxsock, "get_display\n", 12);
1586 memset(buf, 0, sizeof(buf));
1587 fd_gets(uxsock, buf, sizeof(buf));
1588 if (strcmp2(buf, x_display)) {
1589 printf("Claws Mail is already running on display %s.\n",
1593 uxsock = fd_connect_unix(path);
1594 fd_write_all(uxsock, "popup\n", 6);
1602 static gint lock_socket_remove(void)
1607 if (lock_socket < 0) {
1611 if (lock_socket_tag > 0) {
1612 gdk_input_remove(lock_socket_tag);
1614 fd_close(lock_socket);
1615 filename = claws_get_socket_name();
1622 static GPtrArray *get_folder_item_list(gint sock)
1624 gchar buf[BUFFSIZE];
1626 GPtrArray *folders = NULL;
1629 fd_gets(sock, buf, sizeof(buf));
1630 if (!strncmp(buf, ".\n", 2)) {
1635 folders = g_ptr_array_new();
1637 item = folder_find_item_from_identifier(buf);
1639 g_ptr_array_add(folders, item);
1641 g_warning("no such folder: %s\n", buf);
1648 static void lock_socket_input_cb(gpointer data,
1650 GdkInputCondition condition)
1652 MainWindow *mainwin = (MainWindow *)data;
1654 gchar buf[BUFFSIZE];
1656 sock = fd_accept(source);
1657 fd_gets(sock, buf, sizeof(buf));
1659 if (!strncmp(buf, "popup", 5)) {
1660 main_window_popup(mainwin);
1661 } else if (!strncmp(buf, "get_display", 11)) {
1662 fd_write_all(sock, x_display, strlen(x_display));
1663 } else if (!strncmp(buf, "receive_all", 11)) {
1664 inc_all_account_mail(mainwin, FALSE,
1665 prefs_common.newmail_notify_manu);
1666 } else if (!strncmp(buf, "receive", 7)) {
1667 inc_mail(mainwin, prefs_common.newmail_notify_manu);
1668 } else if (!strncmp(buf, "compose_attach", 14)) {
1672 mailto = g_strdup(buf + strlen("compose_attach") + 1);
1673 files = g_ptr_array_new();
1674 while (fd_gets(sock, buf, sizeof(buf)) > 0) {
1675 if (buf[0] == '.' && buf[1] == '\n') {
1679 g_ptr_array_add(files, g_strdup(buf));
1681 open_compose_new(mailto, files);
1682 ptr_array_free_strings(files);
1683 g_ptr_array_free(files, TRUE);
1685 } else if (!strncmp(buf, "compose", 7)) {
1686 open_compose_new(buf + strlen("compose") + 1, NULL);
1687 } else if (!strncmp(buf, "subscribe", 9)) {
1688 main_window_popup(mainwin);
1689 folder_subscribe(buf + strlen("subscribe") + 1);
1690 } else if (!strncmp(buf, "send", 4)) {
1692 } else if (!strncmp(buf, "online", 6)) {
1693 main_window_toggle_work_offline(mainwin, FALSE, FALSE);
1694 } else if (!strncmp(buf, "offline", 7)) {
1695 main_window_toggle_work_offline(mainwin, TRUE, FALSE);
1696 } else if (!strncmp(buf, "status-full", 11) ||
1697 !strncmp(buf, "status", 6)) {
1701 folders = get_folder_item_list(sock);
1702 status = folder_get_status
1703 (folders, !strncmp(buf, "status-full", 11));
1704 fd_write_all(sock, status, strlen(status));
1705 fd_write_all(sock, ".\n", 2);
1707 if (folders) g_ptr_array_free(folders, TRUE);
1708 } else if (!strncmp(buf, "select ", 7)) {
1709 const gchar *target = buf+7;
1710 mainwindow_jump_to(target);
1711 } else if (!strncmp(buf, "exit", 4)) {
1712 app_will_exit(NULL, mainwin);
1718 static void open_compose_new(const gchar *address, GPtrArray *attach_files)
1723 Xstrdup_a(addr, address, return);
1727 compose_new(NULL, addr, attach_files);
1730 static void send_queue(void)
1733 gchar *errstr = NULL;
1734 gboolean error = FALSE;
1735 for (list = folder_get_list(); list != NULL; list = list->next) {
1736 Folder *folder = list->data;
1738 if (folder->queue) {
1739 gint res = procmsg_send_queue
1740 (folder->queue, prefs_common.savemsg,
1744 folder_item_scan(folder->queue);
1752 gchar *tmp = g_strdup_printf(_("Some errors occurred "
1753 "while sending queued messages:\n%s"), errstr);
1755 alertpanel_error_log(tmp);
1758 alertpanel_error_log("Some errors occurred "
1759 "while sending queued messages.");
1763 static void quit_signal_handler(int sig)
1765 debug_print("Quitting on signal %d\n", sig);
1767 g_timeout_add(0, clean_quit, NULL);
1770 static void install_basic_sighandlers()
1774 struct sigaction act;
1779 sigaddset(&mask, SIGTERM);
1782 sigaddset(&mask, SIGINT);
1785 sigaddset(&mask, SIGHUP);
1788 act.sa_handler = quit_signal_handler;
1793 sigaction(SIGTERM, &act, 0);
1796 sigaction(SIGINT, &act, 0);
1799 sigaction(SIGHUP, &act, 0);
1802 sigprocmask(SIG_UNBLOCK, &mask, 0);
1803 #endif /* !G_OS_WIN32 */
1807 HildonProgram *hildon_program()
1809 return static_hildonprogram;