pidgin/pidginaccountactionsmenu.c

Thu, 17 Dec 2020 23:48:47 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 17 Dec 2020 23:48:47 -0600
changeset 40651
8737840a09b7
parent 40634
4d3018b00ad4
child 40984
1ad595619528
permissions
-rw-r--r--

Fix some file headers for the credential provider api

Testing Done:
None needed.

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

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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 /* now add the action */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 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
151 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
152 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
153 action,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 (GClosureNotify)purple_protocol_action_free,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 0);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 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
157 gtk_widget_show(item);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 /* 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
160 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
161
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
162 /* 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
163 * 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
164 */
40390
b393df36f106 Use g_list_delete_link instead of g_list_remove
Gary Kramlich <grim@reaperworld.com>
parents: 40389
diff changeset
165 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
166 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 /* 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
170 if(show_separator) {
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 gtk_widget_show(menu->separator);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174
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 * GObject Implementation
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 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
179 GTK_TYPE_MENU)
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 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 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
183 GValue *value, GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 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
186
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 g_value_set_object(value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 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
191 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 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
194 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 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
200 const GValue *value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 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
204
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 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
208 g_value_get_object(value));
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 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
213 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 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
219 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
220
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 g_clear_object(&menu->account);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 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
224 }
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 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 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
228 /* initialize our template */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 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
230 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 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
234 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
235 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
236
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
237 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
238 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
239 "/im/pidgin/Pidgin/Accounts/actionsmenu.ui"
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 );
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 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
243 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
244 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
245
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 /**
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 * PidginAccountActionsMenu::account:
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 * 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
250 */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 properties[PROP_ACCOUNT] =
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 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
253 "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
254 PURPLE_TYPE_ACCOUNT,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 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
256 G_PARAM_STATIC_STRINGS);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 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
259
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 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
261 separator);
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
262 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
263 set_mood);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
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
265 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
266 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
267 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
268 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
269 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
270 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
271 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 * Public API
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 GtkWidget *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 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
278 GObject *obj = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 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
281
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 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
283 "account", account,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 NULL);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 return GTK_WIDGET(obj);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 }
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 PurpleAccount *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 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
291 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
292
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 return menu->account;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 }

mercurial