pidgin/pidginapplication.c

changeset 41298
6d816e02fd76
parent 41246
d2a2cc448987
child 41303
c4c79576ef12
equal deleted inserted replaced
41297:4960320545ef 41298:6d816e02fd76
41 #include "gtkprivacy.h" 41 #include "gtkprivacy.h"
42 #include "gtkroomlist.h" 42 #include "gtkroomlist.h"
43 #include "gtksavedstatuses.h" 43 #include "gtksavedstatuses.h"
44 #include "gtkxfer.h" 44 #include "gtkxfer.h"
45 #include "pidginabout.h" 45 #include "pidginabout.h"
46 #include "pidginaccountsdisabledmenu.h"
46 #include "pidginconversationwindow.h" 47 #include "pidginconversationwindow.h"
47 #include "pidgincore.h" 48 #include "pidgincore.h"
48 #include "pidgindebug.h" 49 #include "pidgindebug.h"
49 #include "pidginmooddialog.h" 50 #include "pidginmooddialog.h"
50 #include "pidgin/pidginpluginsdialog.h" 51 #include "pidgin/pidginpluginsdialog.h"
121 122
122 gplugin_manager_append_path(manager, PIDGIN_LIBDIR); 123 gplugin_manager_append_path(manager, PIDGIN_LIBDIR);
123 } 124 }
124 125
125 purple_plugins_refresh(); 126 purple_plugins_refresh();
127 }
128
129 static void
130 pidgin_application_populate_dynamic_menus(PidginApplication *application) {
131 GMenu *target = NULL;
132 GMenuModel *source = NULL;
133
134 /* Link the AccountsDisabledMenu into its proper location. */
135 target = gtk_application_get_menu_by_id(GTK_APPLICATION(application),
136 "disabled-accounts");
137 source = pidgin_accounts_disabled_menu_new();
138 g_menu_append_section(target, NULL, source);
126 } 139 }
127 140
128 /****************************************************************************** 141 /******************************************************************************
129 * Actions 142 * Actions
130 *****************************************************************************/ 143 *****************************************************************************/
243 gboolean old = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"); 256 gboolean old = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled");
244 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", !old); 257 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", !old);
245 } 258 }
246 259
247 static void 260 static void
261 pidgin_application_enable_account(GSimpleAction *simple, GVariant *parameter,
262 gpointer data)
263 {
264 PurpleAccount *account = NULL;
265 PurpleAccountManager *manager = NULL;
266 const gchar *id = NULL;
267
268 id = g_variant_get_string(parameter, NULL);
269
270 manager = purple_account_manager_get_default();
271
272 account = purple_account_manager_find_by_id(manager, id);
273 if(PURPLE_IS_ACCOUNT(account)) {
274 if(!purple_account_get_enabled(account, PIDGIN_UI)) {
275 purple_account_set_enabled(account, PIDGIN_UI, TRUE);
276 }
277 }
278 }
279
280 static void
248 pidgin_application_file_transfers(GSimpleAction *simple, GVariant *parameter, 281 pidgin_application_file_transfers(GSimpleAction *simple, GVariant *parameter,
249 gpointer data) 282 gpointer data)
250 { 283 {
251 pidgin_xfer_dialog_show(NULL); 284 pidgin_xfer_dialog_show(NULL);
252 } 285 }
349 .name = "add-group", 382 .name = "add-group",
350 .activate = pidgin_application_add_group, 383 .activate = pidgin_application_add_group,
351 }, { 384 }, {
352 .name = "debug", 385 .name = "debug",
353 .activate = pidgin_application_debug, 386 .activate = pidgin_application_debug,
387 }, {
388 .name = "enable-account",
389 .activate = pidgin_application_enable_account,
390 .parameter_type = "s",
354 }, { 391 }, {
355 .name = "file-transfers", 392 .name = "file-transfers",
356 .activate = pidgin_application_file_transfers, 393 .activate = pidgin_application_file_transfers,
357 }, { 394 }, {
358 .name = "get-user-info", 395 .name = "get-user-info",
627 if(active_accounts == NULL) { 664 if(active_accounts == NULL) {
628 pidgin_accounts_window_show(); 665 pidgin_accounts_window_show();
629 } else { 666 } else {
630 g_list_free(active_accounts); 667 g_list_free(active_accounts);
631 } 668 }
669
670 /* Populate our dynamic menus. */
671 pidgin_application_populate_dynamic_menus(PIDGIN_APPLICATION(application));
632 672
633 /* GTK clears the notification for us when opening the first window, but we 673 /* GTK clears the notification for us when opening the first window, but we
634 * may have launched with only a status icon, so clear it just in case. 674 * may have launched with only a status icon, so clear it just in case.
635 */ 675 */
636 gdk_notify_startup_complete(); 676 gdk_notify_startup_complete();

mercurial