Tue, 31 Mar 2020 01:49:27 -0500
Migrate add-chat and add-buddy to the new menu
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
1 | /* |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, write to the Free Software |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #include "pidgin/pidginprotocolstore.h" |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
26 | #include "gtkutils.h" |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
27 | |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | struct _PidginProtocolStore { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | GtkListStore parent; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | }; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | /****************************************************************************** |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | * Helpers |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | *****************************************************************************/ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | pidgin_protocol_store_add_protocol(PidginProtocolStore *store, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | PurpleProtocol *protocol) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | GtkTreeIter iter; |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
40 | GdkPixbuf *pixbuf = NULL; |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
41 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
42 | pixbuf = pidgin_create_icon_from_protocol(protocol, |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
43 | PIDGIN_PROTOCOL_ICON_SMALL, NULL); |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | gtk_list_store_append(GTK_LIST_STORE(store), &iter); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | gtk_list_store_set( |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | GTK_LIST_STORE(store), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | &iter, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, protocol, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | PIDGIN_PROTOCOL_STORE_COLUMN_NAME, purple_protocol_get_name(protocol), |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
51 | PIDGIN_PROTOCOL_STORE_COLUMN_ICON, pixbuf, |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | -1 |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | ); |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
54 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
55 | g_clear_object(&pixbuf); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
56 | } |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
57 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
58 | static void |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
59 | pidgin_protocol_store_add_protocol_helper(gpointer data, gpointer user_data) { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
60 | if(PURPLE_IS_PROTOCOL(data)) { |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
61 | pidgin_protocol_store_add_protocol(PIDGIN_PROTOCOL_STORE(user_data), |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
62 | PURPLE_PROTOCOL(data)); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
63 | } |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | pidgin_protocol_store_add_protocols(PidginProtocolStore *store) { |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
68 | g_list_foreach(purple_protocols_get_all(), |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
69 | pidgin_protocol_store_add_protocol_helper, store); |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | pidgin_protocol_store_remove_protocol(PidginProtocolStore *store, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | PurpleProtocol *protocol) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | GtkTreeIter iter; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter) == FALSE) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | purple_debug_warning("protocol-store", |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | "protocol %s was removed but not in the store", |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | purple_protocol_get_name(protocol)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | return; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | /* walk through the store and look for the protocol to remove */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | do { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | PurpleProtocol *prpl = NULL; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | gtk_tree_model_get( |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | GTK_TREE_MODEL(store), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | &iter, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, &prpl, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | -1 |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | ); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | if(prpl == protocol) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | g_object_unref(G_OBJECT(prpl)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | gtk_list_store_remove(GTK_LIST_STORE(store), &iter); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | return; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | /****************************************************************************** |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | * Callbacks |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | *****************************************************************************/ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | pidgin_protocol_store_protocol_added_cb(PurpleProtocol *protocol, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | gpointer data) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | pidgin_protocol_store_add_protocol(PIDGIN_PROTOCOL_STORE(data), protocol); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | pidgin_protocol_store_protocol_removed_cb(PurpleProtocol *protocol, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | gpointer data) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | pidgin_protocol_store_remove_protocol(PIDGIN_PROTOCOL_STORE(data), protocol); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | /****************************************************************************** |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | * GObject Implementation |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | *****************************************************************************/ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | G_DEFINE_TYPE(PidginProtocolStore, pidgin_protocol_store, GTK_TYPE_LIST_STORE) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | pidgin_protocol_store_init(PidginProtocolStore *store) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | gpointer protocols_handle = NULL; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | GType types[PIDGIN_PROTOCOL_STORE_N_COLUMNS] = { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | PURPLE_TYPE_PROTOCOL, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | G_TYPE_STRING, |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
134 | GDK_TYPE_PIXBUF, |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | }; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | gtk_list_store_set_column_types( |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | GTK_LIST_STORE(store), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | PIDGIN_PROTOCOL_STORE_N_COLUMNS, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | types |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | ); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | /* add the known protocols */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | pidgin_protocol_store_add_protocols(store); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | /* add the signal handlers to dynamically add/remove protocols */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | protocols_handle = purple_protocols_get_handle(); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | purple_signal_connect(protocols_handle, "protocol-added", store, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | G_CALLBACK(pidgin_protocol_store_protocol_added_cb), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | store); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | purple_signal_connect(protocols_handle, "protocol-removed", store, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | G_CALLBACK(pidgin_protocol_store_protocol_removed_cb), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | store); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | pidgin_protocol_store_finalize(GObject *obj) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | purple_signals_disconnect_by_handle(obj); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | G_OBJECT_CLASS(pidgin_protocol_store_parent_class)->finalize(obj); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | pidgin_protocol_store_class_init(PidginProtocolStoreClass *klass) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | obj_class->finalize = pidgin_protocol_store_finalize; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | /****************************************************************************** |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | * API |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | *****************************************************************************/ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | GtkListStore * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | pidgin_protocol_store_new(void) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | return GTK_LIST_STORE(g_object_new(PIDGIN_TYPE_PROTOCOL_STORE, NULL)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | } |