| 103 * helper manages the singleton. |
103 * helper manages the singleton. |
| 104 * |
104 * |
| 105 * Since: 3.0 |
105 * Since: 3.0 |
| 106 */ |
106 */ |
| 107 static GtkWidget * |
107 static GtkWidget * |
| 108 pidgin_application_get_account_manager(void) { |
108 pidgin_application_get_account_manager(PidginApplication *application) { |
| 109 static GtkWidget *manager = NULL; |
109 static GtkWidget *manager = NULL; |
| 110 |
110 |
| 111 if(!PIDGIN_IS_ACCOUNT_MANAGER(manager)) { |
111 if(!PIDGIN_IS_ACCOUNT_MANAGER(manager)) { |
| 112 manager = pidgin_account_manager_new(); |
112 manager = pidgin_account_manager_new(GTK_APPLICATION(application)); |
| 113 g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager); |
113 g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager); |
| 114 } |
114 } |
| 115 |
115 |
| 116 return manager; |
116 return manager; |
| 117 } |
117 } |
| 301 { |
301 { |
| 302 PidginApplication *application = data; |
302 PidginApplication *application = data; |
| 303 static GtkWidget *about = NULL; |
303 static GtkWidget *about = NULL; |
| 304 |
304 |
| 305 if(!GTK_IS_WIDGET(about)) { |
305 if(!GTK_IS_WIDGET(about)) { |
| 306 about = pidgin_about_dialog_new(); |
306 about = pidgin_about_dialog_new(GTK_APPLICATION(application)); |
| 307 g_object_add_weak_pointer(G_OBJECT(about), (gpointer)&about); |
307 g_object_add_weak_pointer(G_OBJECT(about), (gpointer)&about); |
| 308 } |
308 } |
| 309 |
309 |
| 310 pidgin_application_present_transient_window(application, GTK_WINDOW(about)); |
310 pidgin_application_present_transient_window(application, GTK_WINDOW(about)); |
| 311 } |
311 } |
| 313 static void |
313 static void |
| 314 pidgin_application_accounts(G_GNUC_UNUSED GSimpleAction *simple, |
314 pidgin_application_accounts(G_GNUC_UNUSED GSimpleAction *simple, |
| 315 G_GNUC_UNUSED GVariant *parameter, gpointer data) |
315 G_GNUC_UNUSED GVariant *parameter, gpointer data) |
| 316 { |
316 { |
| 317 PidginApplication *application = data; |
317 PidginApplication *application = data; |
| 318 GtkWidget *manager = pidgin_application_get_account_manager(); |
318 GtkWidget *manager = pidgin_application_get_account_manager(application); |
| 319 |
319 |
| 320 pidgin_account_manager_show_overview(PIDGIN_ACCOUNT_MANAGER(manager)); |
320 pidgin_account_manager_show_overview(PIDGIN_ACCOUNT_MANAGER(manager)); |
| 321 |
321 |
| 322 pidgin_application_present_transient_window(application, |
322 pidgin_application_present_transient_window(application, |
| 323 GTK_WINDOW(manager)); |
323 GTK_WINDOW(manager)); |
| 413 |
413 |
| 414 manager = purple_account_manager_get_default(); |
414 manager = purple_account_manager_get_default(); |
| 415 |
415 |
| 416 account = purple_account_manager_find_by_id(manager, id); |
416 account = purple_account_manager_find_by_id(manager, id); |
| 417 if(PURPLE_IS_ACCOUNT(account)) { |
417 if(PURPLE_IS_ACCOUNT(account)) { |
| 418 GtkWidget *account_manager = pidgin_application_get_account_manager(); |
418 GtkWidget *account_manager = NULL; |
| |
419 |
| |
420 account_manager = pidgin_application_get_account_manager(application); |
| 419 |
421 |
| 420 pidgin_account_manager_edit_account(PIDGIN_ACCOUNT_MANAGER(account_manager), |
422 pidgin_account_manager_edit_account(PIDGIN_ACCOUNT_MANAGER(account_manager), |
| 421 account); |
423 account); |
| 422 |
424 |
| 423 pidgin_application_present_transient_window(application, |
425 pidgin_application_present_transient_window(application, |
| 465 { |
467 { |
| 466 PidginApplication *application = data; |
468 PidginApplication *application = data; |
| 467 static GtkWidget *dialog = NULL; |
469 static GtkWidget *dialog = NULL; |
| 468 |
470 |
| 469 if(!GTK_IS_WIDGET(dialog)) { |
471 if(!GTK_IS_WIDGET(dialog)) { |
| 470 dialog = pidgin_channel_join_dialog_new(); |
472 dialog = pidgin_channel_join_dialog_new(GTK_APPLICATION(application)); |
| 471 g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog); |
473 g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog); |
| 472 } |
474 } |
| 473 |
475 |
| 474 pidgin_application_present_transient_window(application, |
476 pidgin_application_present_transient_window(application, |
| 475 GTK_WINDOW(dialog)); |
477 GTK_WINDOW(dialog)); |
| 493 { |
495 { |
| 494 PidginApplication *application = data; |
496 PidginApplication *application = data; |
| 495 static GtkWidget *preferences = NULL; |
497 static GtkWidget *preferences = NULL; |
| 496 |
498 |
| 497 if(!GTK_IS_WIDGET(preferences)) { |
499 if(!GTK_IS_WIDGET(preferences)) { |
| 498 preferences = g_object_new(PIDGIN_TYPE_PREFS_WINDOW, NULL); |
500 preferences = g_object_new( |
| |
501 PIDGIN_TYPE_PREFS_WINDOW, |
| |
502 "application", application, |
| |
503 NULL); |
| 499 g_object_add_weak_pointer(G_OBJECT(preferences), (gpointer)&preferences); |
504 g_object_add_weak_pointer(G_OBJECT(preferences), (gpointer)&preferences); |
| 500 } |
505 } |
| 501 |
506 |
| 502 pidgin_application_present_transient_window(application, |
507 pidgin_application_present_transient_window(application, |
| 503 GTK_WINDOW(preferences)); |
508 GTK_WINDOW(preferences)); |
| 849 G_CALLBACK(pidgin_application_disconnected_cb), |
854 G_CALLBACK(pidgin_application_disconnected_cb), |
| 850 application, 0); |
855 application, 0); |
| 851 } |
856 } |
| 852 |
857 |
| 853 static void |
858 static void |
| 854 pidgin_application_activate(G_GNUC_UNUSED GApplication *application) { |
859 pidgin_application_activate(GApplication *application) { |
| 855 static GtkWidget *default_window = NULL; |
860 static GtkWidget *default_window = NULL; |
| 856 |
861 |
| 857 if(!GTK_IS_WIDGET(default_window)) { |
862 if(!GTK_IS_WIDGET(default_window)) { |
| 858 default_window = pidgin_display_window_new(); |
863 default_window = pidgin_display_window_new(GTK_APPLICATION(application)); |
| 859 g_object_add_weak_pointer(G_OBJECT(default_window), |
864 g_object_add_weak_pointer(G_OBJECT(default_window), |
| 860 (gpointer)&default_window); |
865 (gpointer)&default_window); |
| 861 } |
866 } |
| 862 |
867 |
| 863 if(GTK_IS_WINDOW(default_window)) { |
868 if(GTK_IS_WINDOW(default_window)) { |