pidgin/pidginaccountactionsmenu.c

Tue, 07 Apr 2020 18:28:26 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 07 Apr 2020 18:28:26 -0500
changeset 40387
4cdb2a681dc1
parent 40385
c3e9a7d14e6f
child 40388
3f2e9e346f6f
permissions
-rw-r--r--

use g_list_index instead of manually searching a list and a bunch of whitespace fixes

40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * pidgin
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * 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
5 * 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
6 * source distribution.
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * (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
12 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * 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
14 * 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
15 * 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
16 * 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
17 *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "internal.h"
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
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
29 #include "pidgin/gtkaccount.h"
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include "pidgin/pidgin.h"
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
31 #include "pidgin/pidginmooddialog.h"
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 struct _PidginAccountActionsMenu {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 GtkMenu parent;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 GtkWidget *separator;
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
37 GtkWidget *set_mood;
40379
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 PurpleAccount *account;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 enum {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 PROP_ZERO,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PROP_ACCOUNT,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 N_PROPERTIES
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 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
48
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 * GSignal Handlers
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 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
54 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
55
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 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
57 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 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
61 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
62
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 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
64 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 static void
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
67 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
68 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
69
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
70 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
71 }
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
72
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
73 static void
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 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
75 PurpleProtocolAction *action = (PurpleProtocolAction *)data;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 if(action && action->callback) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 action->callback(action);
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
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 * Helpers
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 *****************************************************************************/
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 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
87 PurpleAccount *account)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 PurpleConnection *connection = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 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
91 GList *children = NULL;
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
92 gboolean show_separator = FALSE;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 gint position = 0;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_clear_object(&menu->account);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 if(!PURPLE_IS_ACCOUNT(account)) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 return;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 menu->account = PURPLE_ACCOUNT(g_object_ref(G_OBJECT(account)));
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 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
104 if(connection == NULL) {
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 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
109 return;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 /* 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
113 * 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
114 * 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
115 * proper position.
40379
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 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
118 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
119 g_list_free(children);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 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
122
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
123 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
124 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
125
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
126 show_separator = TRUE;
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
127 }
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
128
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT, get_actions)) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 GtkWidget *item = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 GList *actions = NULL, *l = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 actions = purple_protocol_client_iface_get_actions(protocol,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 connection);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 for(l = actions; l; l = l->next) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 PurpleProtocolAction *action = (PurpleProtocolAction *)l->data;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 if(action == NULL) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 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
141 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
142 gtk_widget_show(item);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 continue;
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 if(action->label == NULL) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 purple_protocol_action_free(action);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 continue;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 /* now add the action */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 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
155 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
156 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
157 action,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 (GClosureNotify)purple_protocol_action_free,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 0);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 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
161 gtk_widget_show(item);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 /* 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
164 show_separator = TRUE;
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 }
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 g_list_free(actions);
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 /* 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
171 if(show_separator) {
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 gtk_widget_show(menu->separator);
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 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 * GObject Implementation
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 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
180 GTK_TYPE_MENU)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 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
184 GValue *value, GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 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
187
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 g_value_set_object(value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 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
192 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 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
195 break;
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 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
201 const GValue *value,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 GParamSpec *pspec)
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 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
205
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 switch(param_id) {
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 case PROP_ACCOUNT:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 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
209 g_value_get_object(value));
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 break;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 default:
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 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
214 break;
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 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
220 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
221
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 g_clear_object(&menu->account);
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_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
225 }
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 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
229 /* initialize our template */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 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
231 };
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 static void
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 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
235 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
236 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
237
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
238 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
239 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
240 "/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
241 );
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 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
244 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
245 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
246
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 /**
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 * PidginAccountActionsMenu::account:
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 * 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
251 */
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 properties[PROP_ACCOUNT] =
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 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
254 "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
255 PURPLE_TYPE_ACCOUNT,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 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
257 G_PARAM_STATIC_STRINGS);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 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
260
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 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
262 separator);
40384
8f6c0247f9f2 Start setting up the protocol specific set mood menu items
Gary Kramlich <grim@reaperworld.com>
parents: 40379
diff changeset
263 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
264 set_mood);
40379
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265
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
266 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
267 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
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_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
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_set_mood_cb);
40379
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 /******************************************************************************
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 * Public API
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 GtkWidget *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 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
279 GObject *obj = NULL;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 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
282
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 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
284 "account", account,
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 NULL);
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 return GTK_WIDGET(obj);
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
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 PurpleAccount *
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 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
292 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
293
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 return menu->account;
c50c509dd028 Migrate the accounts menu to its own set of widgets
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 }

mercurial