pidgin/pidginaccountsdisabledmenu.c

Thu, 27 Jun 2024 00:46:27 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 27 Jun 2024 00:46:27 -0500
changeset 42804
be8c8b5471ca
parent 42575
580339aa47cc
child 43062
9d134b69b834
permissions
-rw-r--r--

Update pidgin to use get id and username directly on PurpleAccount

This is part of making PurpleAccount have a PurpleContactInfo instead of being
one.

Testing Done:
Ran the turtles, connected some accounts, disabled one via the menu and re-enabled it.

Reviewed at https://reviews.imfreedom.org/r/3273/

41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n.h>
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
25 #include "pidginaccountsdisabledmenu.h"
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
27 struct _PidginAccountsDisabledMenu {
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
28 GMenuModel parent;
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
30 GList *accounts;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
31 };
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
42575
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
33 G_DEFINE_FINAL_TYPE(PidginAccountsDisabledMenu, pidgin_accounts_disabled_menu,
580339aa47cc Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents: 42565
diff changeset
34 G_TYPE_MENU_MODEL)
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 /******************************************************************************
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 * Callbacks
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 *****************************************************************************/
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 static void
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
40 pidgin_accounts_disabled_menu_refresh(PidginAccountsDisabledMenu *menu) {
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
41 PurpleAccountManager *manager = NULL;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
42 gint removed = 0, added = 0;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
43
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
44 /* When refreshing we're always removing at least 1 item because of the
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
45 * "no disabled accounts" item that we put in place when all accounts
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
46 * are enabled.
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
47 */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
48 removed = MAX(1, g_list_length(menu->accounts));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
49
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
50 /* Grab the manager and get all the disabled accounts. */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
51 manager = purple_account_manager_get_default();
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
52 g_list_free(menu->accounts);
41454
7cc69bde919d Update pidgin for the purple_account_manager_get_(in)active deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41450
diff changeset
53 menu->accounts = purple_account_manager_get_disabled(manager);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
54
42565
c035e2eba80d Fix several minor typos
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42263
diff changeset
55 /* Similar to the above note about removed items, if every account is
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
56 * enabled, we add an item saying "no disabled accounts".
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
57 */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
58 added = MAX(1, g_list_length(menu->accounts));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
59
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
60 /* Tell any listeners that our menu has changed. */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
61 g_menu_model_items_changed(G_MENU_MODEL(menu), 0, removed, added);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
62 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
63
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
64 static void
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
65 pidgin_accounts_disabled_menu_changed_cb(G_GNUC_UNUSED PurpleAccountManager *manager,
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
66 G_GNUC_UNUSED PurpleAccount *account,
41946
0fb3b0e7122f Add a setting-changed signal to PurpleAccount and propagate it from PurpleAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 41891
diff changeset
67 G_GNUC_UNUSED GParamSpec *pspec,
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 gpointer data)
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 {
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
70 PidginAccountsDisabledMenu *menu = data;
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
71
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
72 pidgin_accounts_disabled_menu_refresh(menu);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
73 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
74
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
75 /******************************************************************************
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
76 * GMenuModel Implementation
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
77 *****************************************************************************/
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
78 static gboolean
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41946
diff changeset
79 pidgin_accounts_disabled_menu_is_mutable(G_GNUC_UNUSED GMenuModel *model) {
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
80 return TRUE;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
81 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
82
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
83 static gboolean
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
84 pidgin_accounts_disabled_menu_get_n_items(GMenuModel *model) {
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
85 PidginAccountsDisabledMenu *menu = NULL;
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
86
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
87 menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
88
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
89 if(menu->accounts == NULL) {
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
90 return 1;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
91 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
92
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
93 return g_list_length(menu->accounts);
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 static void
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
97 pidgin_accounts_disabled_menu_get_item_attributes(GMenuModel *model,
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
98 gint index,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
99 GHashTable **attributes)
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 {
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
101 PidginAccountsDisabledMenu *menu = NULL;
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
102 PurpleAccount *account = NULL;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
103 PurpleProtocol *protocol = NULL;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
104 GVariant *value = NULL;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
105 const gchar *account_name = NULL, *protocol_name = NULL;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
106
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
107 menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
108
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
109 /* Create our hash table of attributes to return. */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
110 *attributes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
111 (GDestroyNotify)g_variant_unref);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
112
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
113 /* If we don't have any disabled accounts, just return a single item,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
114 * stating as much.
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
115 */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
116 if(menu->accounts == NULL) {
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
117 value = g_variant_new_string(_("No disabled accounts"));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
118 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
119 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
120
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
121 value = g_variant_new_string("disabled");
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
122 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
123 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
124
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
125 return;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
126 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
127
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
128 account = g_list_nth_data(menu->accounts, index);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
129 if(account == NULL) {
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
130 return;
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
131 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
132
42804
be8c8b5471ca Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
133 account_name = purple_account_get_username(account);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
134 protocol_name = purple_account_get_protocol_name(account);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
135
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
136 /* translators: This format string is intended to contain the account
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
137 * name followed by the protocol name to uniquely identify a specific
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
138 * account.
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
139 */
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
140 value = g_variant_new_printf(_("%s (%s)"), account_name, protocol_name);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
141 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
142 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
143
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
144 value = g_variant_new_string("app.enable-account");
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
145 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
146 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
147
42804
be8c8b5471ca Update pidgin to use get id and username directly on PurpleAccount
Gary Kramlich <grim@reaperworld.com>
parents: 42575
diff changeset
148 value = g_variant_new_printf("%s", purple_account_get_id(account));
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
149 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
150 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
151
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
152 protocol = purple_account_get_protocol(account);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
153 if(protocol != NULL) {
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
154 value = g_variant_new_printf("%s", purple_protocol_get_icon_name(protocol));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
155 g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ICON,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
156 g_variant_ref_sink(value));
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
157 }
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 }
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 static void
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41946
diff changeset
161 pidgin_accounts_disabled_menu_get_item_links(G_GNUC_UNUSED GMenuModel *model,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41946
diff changeset
162 G_GNUC_UNUSED gint index,
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
163 GHashTable **links)
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 {
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
165 *links = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
166 g_object_unref);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
167 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
168
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
169 /******************************************************************************
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
170 * GObject Implementation
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
171 *****************************************************************************/
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
172 static void
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
173 pidgin_accounts_disabled_menu_constructed(GObject *obj) {
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
174 G_OBJECT_CLASS(pidgin_accounts_disabled_menu_parent_class)->constructed(obj);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
175
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
176 pidgin_accounts_disabled_menu_refresh(PIDGIN_ACCOUNTS_DISABLED_MENU(obj));
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
177 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
178
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
179 static void
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
180 pidgin_accounts_disabled_menu_init(PidginAccountsDisabledMenu *menu) {
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
181 PurpleAccountManager *manager = purple_account_manager_get_default();
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
182
41891
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
183 g_signal_connect_object(manager, "account-changed::enabled",
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
184 G_CALLBACK(pidgin_accounts_disabled_menu_changed_cb),
a45d6db4f857 Propagate the PurpleAccount::notify signal via PurpleAccountManager::account-changed
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
185 menu, 0);
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
186 }
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
187
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
188 static void
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
189 pidgin_accounts_disabled_menu_class_init(PidginAccountsDisabledMenuClass *klass) {
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
190 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
191 GMenuModelClass *model_class = G_MENU_MODEL_CLASS(klass);
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
192
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
193 obj_class->constructed = pidgin_accounts_disabled_menu_constructed;
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
194
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
195 model_class->is_mutable = pidgin_accounts_disabled_menu_is_mutable;
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
196 model_class->get_n_items = pidgin_accounts_disabled_menu_get_n_items;
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
197 model_class->get_item_attributes = pidgin_accounts_disabled_menu_get_item_attributes;
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
198 model_class->get_item_links = pidgin_accounts_disabled_menu_get_item_links;
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 }
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 /******************************************************************************
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 * Public API
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 *****************************************************************************/
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41298
diff changeset
204 GMenuModel *
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
205 pidgin_accounts_disabled_menu_new(void) {
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
206 return g_object_new(PIDGIN_TYPE_ACCOUNTS_DISABLED_MENU, NULL);
41298
6d816e02fd76 Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 }

mercurial