| 143 |
143 |
| 144 #ifdef HAVE_SIGNAL_H |
144 #ifdef HAVE_SIGNAL_H |
| 145 static void sighandler(int sig); |
145 static void sighandler(int sig); |
| 146 |
146 |
| 147 /** |
147 /** |
| 148 * Reap all our dead children. Sometimes Purple forks off a separate |
148 * Reap all our dead children. Sometimes libpurple forks off a separate |
| 149 * process to do some stuff. When that process exits we are |
149 * process to do some stuff. When that process exits we are |
| 150 * informed about it so that we can call waitpid() and let it |
150 * informed about it so that we can call waitpid() and let it |
| 151 * stop being a zombie. |
151 * stop being a zombie. |
| 152 * |
152 * |
| 153 * We used to do this immediately when our signal handler was |
153 * We used to do this immediately when our signal handler was |
| 158 * |
158 * |
| 159 * Anyway, so then GStreamer waits for its child to die and then |
159 * Anyway, so then GStreamer waits for its child to die and then |
| 160 * it continues with the initialization process. This means that |
160 * it continues with the initialization process. This means that |
| 161 * we have a race condition where GStreamer is waitpid()ing for its |
161 * we have a race condition where GStreamer is waitpid()ing for its |
| 162 * child to die and we're catching the SIGCHLD signal. If GStreamer |
162 * child to die and we're catching the SIGCHLD signal. If GStreamer |
| 163 * is awarded the zombied process then everything is ok. But if Purple |
163 * is awarded the zombied process then everything is ok. But if libpurple |
| 164 * reaps the zombie process then the GStreamer initialization sequence |
164 * reaps the zombie process then the GStreamer initialization sequence |
| 165 * fails. |
165 * fails. |
| 166 * |
166 * |
| 167 * So the ugly solution is to wait a second to give GStreamer time to |
167 * So the ugly solution is to wait a second to give GStreamer time to |
| 168 * reap that bad boy. |
168 * reap that bad boy. |
| 238 #ifndef _WIN32 |
238 #ifndef _WIN32 |
| 239 GList *icons = NULL; |
239 GList *icons = NULL; |
| 240 GdkPixbuf *icon = NULL; |
240 GdkPixbuf *icon = NULL; |
| 241 char *icon_path; |
241 char *icon_path; |
| 242 int i; |
242 int i; |
| 243 const char *icon_sizes[] = { |
243 struct { |
| 244 "16", |
244 const char *dir; |
| 245 "24", |
245 const char *filename; |
| 246 "32", |
246 } icon_sizes[] = { |
| 247 "48" |
247 {"16x16", "pidgin.png"}, |
| |
248 {"24x24", "pidgin.png"}, |
| |
249 {"32x32", "pidgin.png"}, |
| |
250 {"48x48", "pidgin.png"}, |
| |
251 {"scalable", "pidgin.svg"} |
| 248 }; |
252 }; |
| 249 |
253 |
| 250 #endif |
254 #endif |
| 251 |
255 |
| 252 pidgin_themes_init(); |
256 pidgin_themes_init(); |
| 254 pidgin_blist_setup_sort_methods(); |
258 pidgin_blist_setup_sort_methods(); |
| 255 |
259 |
| 256 #ifndef _WIN32 |
260 #ifndef _WIN32 |
| 257 /* use the nice PNG icon for all the windows */ |
261 /* use the nice PNG icon for all the windows */ |
| 258 for(i=0; i<G_N_ELEMENTS(icon_sizes); i++) { |
262 for(i=0; i<G_N_ELEMENTS(icon_sizes); i++) { |
| 259 icon_path = g_build_filename(DATADIR, "pixmaps", "pidgin", "icons", icon_sizes[i], "pidgin.png", NULL); |
263 icon_path = g_build_filename(DATADIR, "icons", "hicolor", icon_sizes[i].dir, "apps", icon_sizes[i].filename, NULL); |
| 260 icon = gdk_pixbuf_new_from_file(icon_path, NULL); |
264 icon = gdk_pixbuf_new_from_file(icon_path, NULL); |
| 261 g_free(icon_path); |
265 g_free(icon_path); |
| 262 if (icon) { |
266 if (icon) { |
| 263 icons = g_list_append(icons,icon); |
267 icons = g_list_append(icons,icon); |
| 264 } else { |
268 } else { |
| 444 #endif |
448 #endif |
| 445 #endif |
449 #endif |
| 446 int opt; |
450 int opt; |
| 447 gboolean gui_check; |
451 gboolean gui_check; |
| 448 gboolean debug_enabled; |
452 gboolean debug_enabled; |
| |
453 gboolean migration_failed = FALSE; |
| 449 |
454 |
| 450 struct option long_options[] = { |
455 struct option long_options[] = { |
| 451 {"config", required_argument, NULL, 'c'}, |
456 {"config", required_argument, NULL, 'c'}, |
| 452 {"debug", no_argument, NULL, 'd'}, |
457 {"debug", no_argument, NULL, 'd'}, |
| 453 {"help", no_argument, NULL, 'h'}, |
458 {"help", no_argument, NULL, 'h'}, |
| 637 * Fire up this baby. |
642 * Fire up this baby. |
| 638 */ |
643 */ |
| 639 |
644 |
| 640 purple_debug_set_enabled(debug_enabled); |
645 purple_debug_set_enabled(debug_enabled); |
| 641 |
646 |
| |
647 /* If we're using a custom configuration directory, we |
| |
648 * do NOT want to migrate, or weird things will happen. */ |
| |
649 if (opt_config_dir_arg == NULL) |
| |
650 { |
| |
651 if (!purple_core_migrate()) |
| |
652 { |
| |
653 migration_failed = TRUE; |
| |
654 } |
| |
655 } |
| 642 |
656 |
| 643 search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); |
657 search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); |
| 644 gtk_rc_add_default_file(search_path); |
658 gtk_rc_add_default_file(search_path); |
| 645 g_free(search_path); |
659 g_free(search_path); |
| 646 |
660 |
| 660 } |
674 } |
| 661 |
675 |
| 662 #ifdef _WIN32 |
676 #ifdef _WIN32 |
| 663 winpidgin_init(hint); |
677 winpidgin_init(hint); |
| 664 #endif |
678 #endif |
| |
679 |
| |
680 if (migration_failed) |
| |
681 { |
| |
682 char *old = g_strconcat(purple_home_dir(), |
| |
683 G_DIR_SEPARATOR_S ".gaim", NULL); |
| |
684 const char *text = _( |
| |
685 "%s encountered errors migrating your settings " |
| |
686 "from %s to %s. Please investigate and complete the " |
| |
687 "migration by hand."); |
| |
688 GtkWidget *dialog; |
| |
689 |
| |
690 dialog = gtk_message_dialog_new(NULL, |
| |
691 0, |
| |
692 GTK_MESSAGE_ERROR, |
| |
693 GTK_BUTTONS_CLOSE, |
| |
694 text, PIDGIN_NAME, |
| |
695 old, purple_user_dir()); |
| |
696 g_free(old); |
| |
697 |
| |
698 g_signal_connect_swapped(dialog, "response", |
| |
699 G_CALLBACK(gtk_main_quit), NULL); |
| |
700 |
| |
701 gtk_widget_show_all(dialog); |
| |
702 |
| |
703 gtk_main(); |
| |
704 |
| |
705 #ifdef HAVE_SIGNAL_H |
| |
706 g_free(segfault_message); |
| |
707 #endif |
| |
708 return 0; |
| |
709 } |
| 665 |
710 |
| 666 purple_core_set_ui_ops(pidgin_core_get_ui_ops()); |
711 purple_core_set_ui_ops(pidgin_core_get_ui_ops()); |
| 667 purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); |
712 purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); |
| 668 |
713 |
| 669 /* |
714 /* |
| 765 purple_savedstatus_activate(saved_status); |
810 purple_savedstatus_activate(saved_status); |
| 766 } |
811 } |
| 767 else |
812 else |
| 768 { |
813 { |
| 769 /* Everything is good to go--sign on already */ |
814 /* Everything is good to go--sign on already */ |
| 770 if (!purple_prefs_get_bool("/core/savedstatus/startup_current_status")) |
815 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
| 771 purple_savedstatus_activate(purple_savedstatus_get_startup()); |
816 purple_savedstatus_activate(purple_savedstatus_get_startup()); |
| 772 purple_accounts_restore_current_statuses(); |
817 purple_accounts_restore_current_statuses(); |
| 773 } |
818 } |
| 774 |
819 |
| 775 if ((accounts = purple_accounts_get_all_active()) == NULL) |
820 if ((accounts = purple_accounts_get_all_active()) == NULL) |