Fri, 01 Oct 2021 01:06:04 -0500
Add a Meson devenv configuration.
This allows running `meson devenv` as defined at https://mesonbuild.com/Commands.html#devenv
Testing Done:
Ran `meson devenv -C build pidgin3` and `meson devenv -C build finch3` on a system without either installed (even from this build).
Note stock icons don't seem to work with `XDG_DATA_DIRS`, which is why the other review requests were needed. If anything still has stock icons, they'll be broken without an install.
Reviewed at https://reviews.imfreedom.org/r/973/
|
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, |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40738
diff
changeset
|
50 | PIDGIN_PROTOCOL_STORE_COLUMN_ID, purple_protocol_get_id(protocol), |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | 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
|
52 | PIDGIN_PROTOCOL_STORE_COLUMN_ICON, pixbuf, |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | -1 |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | ); |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
55 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
56 | g_clear_object(&pixbuf); |
|
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 | |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
59 | static void |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | PURPLE_PROTOCOL(data)); |
|
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
64 | } |
|
40296
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 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | pidgin_protocol_store_add_protocols(PidginProtocolStore *store) { |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
69 | PurpleProtocolManager *manager = purple_protocol_manager_get_default(); |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
70 | GList *protocols = NULL; |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
71 | |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
72 | protocols = purple_protocol_manager_get_all(manager); |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
73 | g_list_foreach(protocols, pidgin_protocol_store_add_protocol_helper, |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
74 | store); |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
75 | g_list_free(protocols); |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | } |
|
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 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | pidgin_protocol_store_remove_protocol(PidginProtocolStore *store, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | PurpleProtocol *protocol) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | GtkTreeIter iter; |
|
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 | 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
|
85 | purple_debug_warning("protocol-store", |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | "protocol %s was removed but not in the store", |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | purple_protocol_get_name(protocol)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | return; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | /* walk through the store and look for the protocol to remove */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | do { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | PurpleProtocol *prpl = NULL; |
|
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 | gtk_tree_model_get( |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | GTK_TREE_MODEL(store), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | &iter, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, &prpl, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | -1 |
|
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 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | if(prpl == protocol) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | g_object_unref(G_OBJECT(prpl)); |
|
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 | gtk_list_store_remove(GTK_LIST_STORE(store), &iter); |
|
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 | return; |
|
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 | } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | |
|
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 | * Callbacks |
|
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 | static void |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
116 | pidgin_protocol_store_registered_cb(PurpleProtocolManager *manager, |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
117 | PurpleProtocol *protocol, gpointer data) |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | pidgin_protocol_store_add_protocol(PIDGIN_PROTOCOL_STORE(data), protocol); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | } |
|
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 | static void |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
123 | pidgin_protocol_store_unregistered_cb(PurpleProtocolManager *manager, |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
124 | PurpleProtocol *protocol, gpointer data) |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | { |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
126 | pidgin_protocol_store_remove_protocol(PIDGIN_PROTOCOL_STORE(data), |
|
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
127 | protocol); |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | } |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | /****************************************************************************** |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | * GObject Implementation |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | *****************************************************************************/ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | G_DEFINE_TYPE(PidginProtocolStore, pidgin_protocol_store, GTK_TYPE_LIST_STORE) |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | pidgin_protocol_store_init(PidginProtocolStore *store) { |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
137 | PurpleProtocolManager *manager = NULL; |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | GType types[PIDGIN_PROTOCOL_STORE_N_COLUMNS] = { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | PURPLE_TYPE_PROTOCOL, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | G_TYPE_STRING, |
|
40741
850137e8737c
Select the proper protocol in the account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
40738
diff
changeset
|
141 | G_TYPE_STRING, |
|
40297
082c07053a79
Add the new PidginProtocolChooser and implement it in account dialog
Gary Kramlich <grim@reaperworld.com>
parents:
40296
diff
changeset
|
142 | GDK_TYPE_PIXBUF, |
|
40296
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | }; |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | gtk_list_store_set_column_types( |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | GTK_LIST_STORE(store), |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | PIDGIN_PROTOCOL_STORE_N_COLUMNS, |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | types |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | ); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | /* add the known protocols */ |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | pidgin_protocol_store_add_protocols(store); |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | /* add the signal handlers to dynamically add/remove protocols */ |
|
40735
cc0679f47fd9
Create a new PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40297
diff
changeset
|
155 | manager = purple_protocol_manager_get_default(); |
|
40738
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
156 | g_signal_connect_object(G_OBJECT(manager), "registered", |
|
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
157 | G_CALLBACK(pidgin_protocol_store_registered_cb), |
|
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
158 | store, 0); |
|
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
159 | g_signal_connect_object(G_OBJECT(manager), "unregistered", |
|
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
160 | G_CALLBACK(pidgin_protocol_store_unregistered_cb), |
|
c3cb91c3b693
Use g_signal_connect_object for PidginProtocolStore to follow the life cycle of the objects and avoid memory errors.
Gary Kramlich <grim@reaperworld.com>
parents:
40735
diff
changeset
|
161 | store, 0); |
|
40296
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 | |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | static void |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | pidgin_protocol_store_class_init(PidginProtocolStoreClass *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 | |
|
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 | * API |
|
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 | GtkListStore * |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | pidgin_protocol_store_new(void) { |
|
c9900fc6e689
Initial start of PidginProtocolStore
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | 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
|
174 | } |