pidgin/pidginaccountactionsmenu.c

Fri, 25 Mar 2022 02:51:58 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Fri, 25 Mar 2022 02:51:58 -0500
changeset 41314
0dc72eacd8bf
parent 41030
ec8b76f3bf0a
child 41392
b5c84f55d5d2
permissions
-rw-r--r--

Replace PURPLE_CALLBACK by G_CALLBACK

Another straight search-and-replace for 'easy' review.

Testing Done:
Compile only.

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

40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
40597
fa308dd62f4c Properly set the sensitive state of the "enable account" menu item based on whether or not any accounts are disabled.
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
2 * Pidgin - Internet Messenger
fa308dd62f4c Properly set the sensitive state of the "enable account" menu item based on whether or not any accounts are disabled.
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
40597
fa308dd62f4c Properly set the sensitive state of the "enable account" menu item based on whether or not any accounts are disabled.
Gary Kramlich <grim@reaperworld.com>
parents: 40496
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include "pidginaccountactionsmenu.h"
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include <purple.h>
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40444
diff changeset
27 #include "gtkaccount.h"
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40444
diff changeset
28 #include "pidgincore.h"
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40444
diff changeset
29 #include "pidginmooddialog.h"
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 struct _PidginAccountActionsMenu {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 GtkMenu parent;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 GtkWidget *separator;
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
35 GtkWidget *set_mood;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 PurpleAccount *account;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 enum {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 PROP_ZERO,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 PROP_ACCOUNT,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 N_PROPERTIES
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 static GParamSpec *properties[N_PROPERTIES] = { NULL, };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * GSignal Handlers
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 pidgin_account_actions_menu_edit_cb(GtkMenuItem *item, gpointer data) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, menu->account);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 pidgin_account_actions_menu_disable_cb(GtkMenuItem *item, gpointer data) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 purple_account_set_enabled(menu->account, PIDGIN_UI, FALSE);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 static void
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
65 pidgin_account_actions_menu_set_mood_cb(GtkMenuItem *item, gpointer data) {
40385
c3e9a7d14e6f Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents: 40384
diff changeset
66 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
c3e9a7d14e6f Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents: 40384
diff changeset
67
c3e9a7d14e6f Move the mood api to it's own files and remove the remaining bits of the old menu bar from gtkblist
Gary Kramlich <grim@reaperworld.com>
parents: 40384
diff changeset
68 pidgin_mood_dialog_show(menu->account);
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
69 }
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
70
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
71 static void
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 pidgin_account_actions_menu_action(GtkMenuItem *item, gpointer data) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 PurpleProtocolAction *action = (PurpleProtocolAction *)data;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 if(action && action->callback) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 action->callback(action);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 * Helpers
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 pidgin_account_actions_menu_set_account(PidginAccountActionsMenu *menu,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 PurpleAccount *account)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 PurpleConnection *connection = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 PurpleProtocol *protocol = NULL;
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
89 GList *children = NULL;
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
90 gboolean show_separator = FALSE;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 gint position = 0;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92
40388
3f2e9e346f6f Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents: 40387
diff changeset
93 if(g_set_object(&menu->account, account)) {
3f2e9e346f6f Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents: 40387
diff changeset
94 if(!PURPLE_IS_ACCOUNT(menu->account)) {
3f2e9e346f6f Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents: 40387
diff changeset
95 return;
3f2e9e346f6f Fix a bunch of stuff that was found in review.
Gary Kramlich <grim@reaperworld.com>
parents: 40387
diff changeset
96 }
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 connection = purple_account_get_connection(account);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 if(connection == NULL) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 return;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 if(!PURPLE_CONNECTION_IS_CONNECTED(connection)) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 return;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 /* we're pretty sure we're going to insert some items into the menu, so we
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 * need to figure out where to put them. GtkMenu stores its children in
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
110 * order, so we just need to get the index of the set_mood item to find the
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
111 * proper position.
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 children = gtk_container_get_children(GTK_CONTAINER(menu));
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
114 position = g_list_index(children, menu->set_mood) + 1;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 g_list_free(children);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 protocol = purple_connection_get_protocol(connection);
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
118
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
119 if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT, get_moods)) {
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
120 gtk_widget_show(menu->set_mood);
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
121
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
122 show_separator = TRUE;
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
123 }
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
124
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40597
diff changeset
125 if(PURPLE_IS_PROTOCOL_CLIENT(protocol)) {
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40597
diff changeset
126 PurpleProtocolClient *client = PURPLE_PROTOCOL_CLIENT(protocol);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 GtkWidget *item = NULL;
40389
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
128 GList *actions = NULL;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129
40634
4d3018b00ad4 Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents: 40597
diff changeset
130 actions = purple_protocol_client_get_actions(client, connection);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131
40389
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
132 while(actions != NULL) {
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
133 PurpleProtocolAction *action = (PurpleProtocolAction *)actions->data;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 if(action == NULL) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 item = gtk_separator_menu_item_new();
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item, position++);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 gtk_widget_show(item);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 continue;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 if(action->label == NULL) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 purple_protocol_action_free(action);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 continue;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148
40984
1ad595619528 Make sure that account action menus have their connection assigned
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
149 /* Make sure the action has its connection set. */
1ad595619528 Make sure that account action menus have their connection assigned
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
150 action->connection = connection;
1ad595619528 Make sure that account action menus have their connection assigned
Gary Kramlich <grim@reaperworld.com>
parents: 40634
diff changeset
151
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 /* now add the action */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 item = gtk_menu_item_new_with_label(action->label);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 g_signal_connect_data(G_OBJECT(item), "activate",
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 G_CALLBACK(pidgin_account_actions_menu_action),
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 action,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 (GClosureNotify)purple_protocol_action_free,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 0);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item, position++);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 gtk_widget_show(item);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 /* since we added an item, make sure items_added is true */
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
163 show_separator = TRUE;
40389
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
164
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
165 /* Iterate to the next item while deleting the one we just
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
166 * processed.
a10a60c6cea4 Clean up the account actions lists as we're iterating to avoid having to iterate it twice.
Gary Kramlich <grim@reaperworld.com>
parents: 40388
diff changeset
167 */
40390
b393df36f106 Use g_list_delete_link instead of g_list_remove
Gary Kramlich <grim@reaperworld.com>
parents: 40389
diff changeset
168 actions = g_list_delete_link(actions, actions);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 /* if we added any items, make our separator visible. */
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
173 if(show_separator) {
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 gtk_widget_show(menu->separator);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 * GObject Implementation
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 G_DEFINE_TYPE(PidginAccountActionsMenu, pidgin_account_actions_menu,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 GTK_TYPE_MENU)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 pidgin_account_actions_menu_get_property(GObject *obj, guint param_id,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 GValue *value, GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 g_value_set_object(value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 pidgin_account_actions_menu_get_account(menu));
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 pidgin_account_actions_menu_set_property(GObject *obj, guint param_id,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 const GValue *value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 pidgin_account_actions_menu_set_account(menu,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 g_value_get_object(value));
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 pidgin_account_actions_menu_finalize(GObject *obj) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 g_clear_object(&menu->account);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 G_OBJECT_CLASS(pidgin_account_actions_menu_parent_class)->finalize(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 pidgin_account_actions_menu_init(PidginAccountActionsMenu *menu) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 /* initialize our template */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 gtk_widget_init_template(GTK_WIDGET(menu));
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 pidgin_account_actions_menu_class_init(PidginAccountActionsMenuClass *klass) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
240 gtk_widget_class_set_template_from_resource(
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
241 widget_class,
41030
ec8b76f3bf0a Fix the resource path so we can use the automatic stuff that GtkApplication supports
Gary Kramlich <grim@reaperworld.com>
parents: 40984
diff changeset
242 "/im/pidgin/Pidgin3/Accounts/actionsmenu.ui"
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
243 );
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 obj_class->get_property = pidgin_account_actions_menu_get_property;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 obj_class->set_property = pidgin_account_actions_menu_set_property;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 obj_class->finalize = pidgin_account_actions_menu_finalize;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 /**
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 * PidginAccountActionsMenu::account:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 * The #PurpleAccount that this menu was created for.
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 properties[PROP_ACCOUNT] =
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 g_param_spec_object("account", "account",
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 "The account this menu is for",
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 PURPLE_TYPE_ACCOUNT,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 G_PARAM_STATIC_STRINGS);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 gtk_widget_class_bind_template_child(widget_class, PidginAccountActionsMenu,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 separator);
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
265 gtk_widget_class_bind_template_child(widget_class, PidginAccountActionsMenu,
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
266 set_mood);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267
40387
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
268 gtk_widget_class_bind_template_callback(widget_class,
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
269 pidgin_account_actions_menu_edit_cb);
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
270 gtk_widget_class_bind_template_callback(widget_class,
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
271 pidgin_account_actions_menu_disable_cb);
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
272 gtk_widget_class_bind_template_callback(widget_class,
4cdb2a681dc1 use g_list_index instead of manually searching a list and a bunch of whitespace fixes
Gary Kramlich <grim@reaperworld.com>
parents: 40385
diff changeset
273 pidgin_account_actions_menu_set_mood_cb);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 * Public API
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 GtkWidget *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 pidgin_account_actions_menu_new(PurpleAccount *account) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 GObject *obj = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 obj = g_object_new(PIDGIN_TYPE_ACCOUNT_ACTIONS_MENU,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 "account", account,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 NULL);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 return GTK_WIDGET(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 PurpleAccount *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 pidgin_account_actions_menu_get_account(PidginAccountActionsMenu *menu) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 g_return_val_if_fail(PIDGIN_IS_ACCOUNT_ACTIONS_MENU(menu), NULL);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 return menu->account;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 }

mercurial