Thu, 24 Oct 2013 23:56:44 +0530
Merged soc.2013.gobjectification branch
| 5205 | 1 | /** |
|
6927
528988ef2781
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
2 | * @file gtkplugin.c GTK+ Plugins support |
|
16254
eeb2bba4dc94
Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents:
16123
diff
changeset
|
3 | * @ingroup pidgin |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* pidgin |
| 5205 | 7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
8 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
|
6927
528988ef2781
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
11 | * |
| 5205 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation; either version 2 of the License, or | |
| 15 | * (at your option) any later version. | |
| 16 | * | |
| 17 | * This program is distributed in the hope that it will be useful, | |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | * GNU General Public License for more details. | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License | |
| 23 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19733
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5205 | 25 | */ |
| 11740 | 26 | #include "internal.h" |
| 15577 | 27 | #include "pidgin.h" |
| 5205 | 28 | #include "gtkplugin.h" |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
29 | #include "gtkpluginpref.h" |
|
13436
b80f8990bc67
[gaim-migrate @ 15810]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
30 | #include "gtkutils.h" |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
31 | #include "debug.h" |
|
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
32 | #include "prefs.h" |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
33 | #include "request.h" |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
34 | #include "pidgintooltip.h" |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
35 | |
| 5205 | 36 | #include <string.h> |
| 37 | ||
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
38 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
39 | |
|
36406
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
40 | #define PIDGIN_PLUGIN_INFO_GET_PRIVATE(obj) \ |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
41 | (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_PLUGIN_INFO, PidginPluginInfoPrivate)) |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
42 | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
43 | #define PIDGIN_RESPONSE_CONFIGURE 98121 |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
44 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
45 | typedef struct |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
46 | { |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
47 | PidginPluginConfigFrame get_config_frame; |
|
36406
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
48 | } PidginPluginInfoPrivate; |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
49 | |
|
36447
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
50 | enum |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
51 | { |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
52 | PROP_0, |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
53 | PROP_PIDGIN_CONFIG_FRAME, |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
54 | PROP_LAST |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
55 | }; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
56 | |
| 36929 | 57 | typedef struct |
| 58 | { | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
59 | enum |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
60 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
61 | PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
62 | PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
63 | } type; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
64 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
65 | union |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
66 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
67 | struct |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
68 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
69 | GtkWidget *dialog; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
70 | PurplePluginPrefFrame *pref_frame; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
71 | } frame; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
72 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
73 | gpointer request_handle; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
74 | } u; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
75 | } PidginPluginUiData; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
76 | |
| 15884 | 77 | static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
78 | GtkTreeIter *iter, GError *error, gboolean unload); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
79 | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
80 | static GtkWidget *expander = NULL; |
| 11740 | 81 | static GtkWidget *plugin_dialog = NULL; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
82 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
83 | static GtkLabel *plugin_name = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
84 | static GtkTextBuffer *plugin_desc = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
85 | static GtkLabel *plugin_error = NULL; |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
86 | static GtkLabel *plugin_authors = NULL; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
87 | static GtkLabel *plugin_website = NULL; |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
88 | static gchar *plugin_website_uri = NULL; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
89 | static GtkLabel *plugin_filename = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
90 | |
| 11740 | 91 | static GtkWidget *pref_button = NULL; |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
92 | |
|
36447
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
93 | /* Set method for GObject properties */ |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
94 | static void |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
95 | pidgin_plugin_info_set_property(GObject *obj, guint param_id, const GValue *value, |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
96 | GParamSpec *pspec) |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
97 | { |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
98 | PidginPluginInfoPrivate *priv = PIDGIN_PLUGIN_INFO_GET_PRIVATE(obj); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
99 | |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
100 | switch (param_id) { |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
101 | case PROP_PIDGIN_CONFIG_FRAME: |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
102 | priv->get_config_frame = g_value_get_pointer(value); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
103 | break; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
104 | default: |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
105 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
106 | break; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
107 | } |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
108 | } |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
109 | |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
110 | /* Get method for GObject properties */ |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
111 | static void |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
112 | pidgin_plugin_info_get_property(GObject *obj, guint param_id, GValue *value, |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
113 | GParamSpec *pspec) |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
114 | { |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
115 | PidginPluginInfoPrivate *priv = PIDGIN_PLUGIN_INFO_GET_PRIVATE(obj); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
116 | |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
117 | switch (param_id) { |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
118 | case PROP_PIDGIN_CONFIG_FRAME: |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
119 | g_value_set_pointer(value, priv->get_config_frame); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
120 | break; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
121 | default: |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
122 | G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
123 | break; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
124 | } |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
125 | } |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
126 | |
|
36406
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
127 | /* Class initializer function */ |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
128 | static void pidgin_plugin_info_class_init(PidginPluginInfoClass *klass) |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
129 | { |
|
36447
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
130 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
131 | |
|
36406
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
132 | g_type_class_add_private(klass, sizeof(PidginPluginInfoPrivate)); |
|
36447
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
133 | |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
134 | /* Setup properties */ |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
135 | obj_class->get_property = pidgin_plugin_info_get_property; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
136 | obj_class->set_property = pidgin_plugin_info_set_property; |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
137 | |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
138 | g_object_class_install_property(obj_class, PROP_PIDGIN_CONFIG_FRAME, |
|
36479
345ec7248f48
Updated plugin info properties as per changes in GPlugin
Ankit Vani <a@nevitus.org>
parents:
36467
diff
changeset
|
139 | g_param_spec_pointer("pidgin-config-frame", |
|
36447
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
140 | "Pidgin configuration frame callback", |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
141 | "Callback that returns a GTK configuration frame", |
|
2d36e433e617
Added properties "finch_preferences_frame" to FinchPluginInfo, "pidgin_config_frame" to PidginPluginInfo
Ankit Vani <a@nevitus.org>
parents:
36446
diff
changeset
|
142 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
|
36406
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
143 | } |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
144 | |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
145 | GType |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
146 | pidgin_plugin_info_get_type(void) |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
147 | { |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
148 | static GType type = 0; |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
149 | |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
150 | if (G_UNLIKELY(type == 0)) { |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
151 | static const GTypeInfo info = { |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
152 | .class_size = sizeof(PidginPluginInfoClass), |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
153 | .class_init = (GClassInitFunc)pidgin_plugin_info_class_init, |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
154 | .instance_size = sizeof(PidginPluginInfo), |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
155 | }; |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
156 | |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
157 | type = g_type_register_static(PURPLE_TYPE_PLUGIN_INFO, |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
158 | "PidginPluginInfo", &info, 0); |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
159 | } |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
160 | |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
161 | return type; |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
162 | } |
|
8fba0d44840d
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
Ankit Vani <a@nevitus.org>
parents:
33271
diff
changeset
|
163 | |
|
36446
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
164 | PidginPluginInfo * |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
165 | pidgin_plugin_info_new(const char *first_property, ...) |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
166 | { |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
167 | GObject *info; |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
168 | va_list var_args; |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
169 | |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
170 | /* at least ID is required */ |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
171 | if (!first_property) |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
172 | return NULL; |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
173 | |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
174 | va_start(var_args, first_property); |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
175 | info = g_object_new_valist(PIDGIN_TYPE_PLUGIN_INFO, first_property, |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
176 | var_args); |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
177 | va_end(var_args); |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
178 | |
|
36479
345ec7248f48
Updated plugin info properties as per changes in GPlugin
Ankit Vani <a@nevitus.org>
parents:
36467
diff
changeset
|
179 | g_object_set(info, "ui-requirement", PIDGIN_UI, NULL); |
|
36446
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
180 | |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
181 | return PIDGIN_PLUGIN_INFO(info); |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
182 | } |
|
e75794a5a7f0
Added [purple,pidgin,finch]_plugin_info_new()
Ankit Vani <a@nevitus.org>
parents:
36440
diff
changeset
|
183 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
184 | static gboolean |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
185 | pidgin_plugin_has_prefs(PurplePlugin *plugin) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
186 | { |
| 36929 | 187 | PurplePluginInfo *info = purple_plugin_get_info(plugin); |
| 188 | PidginPluginInfoPrivate *priv = NULL; | |
| 189 | gboolean ret; | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
190 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
191 | g_return_val_if_fail(plugin != NULL, FALSE); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
192 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
193 | if (!purple_plugin_is_loaded(plugin)) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
194 | return FALSE; |
| 11747 | 195 | |
| 36929 | 196 | if (PIDGIN_IS_PLUGIN_INFO(info)) |
| 197 | priv = PIDGIN_PLUGIN_INFO_GET_PRIVATE(info); | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
198 | |
| 36929 | 199 | ret = ((priv && priv->get_config_frame) || |
| 200 | purple_plugin_info_get_pref_frame_callback(info) || | |
| 201 | purple_plugin_info_get_pref_request_callback(info)); | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
202 | |
| 36929 | 203 | return ret; |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
204 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
205 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
206 | static GtkWidget * |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
207 | pidgin_plugin_get_config_frame(PurplePlugin *plugin, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
208 | PurplePluginPrefFrame **purple_pref_frame) |
| 5205 | 209 | { |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
210 | GtkWidget *config = NULL; |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
211 | PurplePluginInfo *info; |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
212 | PidginPluginInfoPrivate *priv = NULL; |
| 5205 | 213 | |
| 214 | g_return_val_if_fail(plugin != NULL, NULL); | |
| 215 | ||
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
216 | info = purple_plugin_get_info(plugin); |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
217 | if (PIDGIN_IS_PLUGIN_INFO(info)) |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
218 | priv = PIDGIN_PLUGIN_INFO_GET_PRIVATE(info); |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
219 | |
| 36929 | 220 | if (priv) |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
221 | config = priv->get_config_frame(plugin); |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
222 | |
| 36929 | 223 | if (!config && purple_plugin_info_get_pref_frame_callback(info)) |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
224 | { |
| 15884 | 225 | PurplePluginPrefFrame *frame; |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
226 | PurplePluginPrefFrameCallback get_pref_frame = |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
227 | purple_plugin_info_get_pref_frame_callback(info); |
| 5205 | 228 | |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
229 | frame = get_pref_frame(plugin); |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
230 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
231 | config = pidgin_plugin_pref_create_frame(frame); |
| 12870 | 232 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
233 | *purple_pref_frame = frame; |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
234 | } |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
235 | |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
236 | return config; |
| 5205 | 237 | } |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
238 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
239 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
240 | pref_dialog_close(PurplePlugin *plugin) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
241 | { |
| 36929 | 242 | PurplePluginInfo *info; |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
243 | PidginPluginUiData *ui_data; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
244 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
245 | g_return_if_fail(plugin != NULL); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
246 | |
| 36929 | 247 | info = purple_plugin_get_info(plugin); |
| 248 | ||
| 249 | ui_data = purple_plugin_info_get_ui_data(info); | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
250 | if (ui_data == NULL) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
251 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
252 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
253 | if (ui_data->type == PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST) { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
254 | purple_request_close(PURPLE_REQUEST_FIELDS, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
255 | ui_data->u.request_handle); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
256 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
257 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
258 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
259 | g_return_if_fail(ui_data->type == PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
260 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
261 | gtk_widget_destroy(ui_data->u.frame.dialog); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
262 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
263 | if (ui_data->u.frame.pref_frame) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
264 | purple_plugin_pref_frame_destroy(ui_data->u.frame.pref_frame); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
265 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
266 | g_free(ui_data); |
| 36929 | 267 | purple_plugin_info_set_ui_data(info, NULL); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
268 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
269 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
270 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
271 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
272 | pref_dialog_response_cb(GtkWidget *dialog, int response, PurplePlugin *plugin) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
273 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
274 | if (response == GTK_RESPONSE_CLOSE || |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
275 | response == GTK_RESPONSE_DELETE_EVENT) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
276 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
277 | pref_dialog_close(plugin); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
278 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
279 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
280 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
281 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
282 | pidgin_plugin_open_config(PurplePlugin *plugin, GtkWindow *parent) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
283 | { |
| 36929 | 284 | PurplePluginInfo *info; |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
285 | PidginPluginInfoPrivate *priv = NULL; |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
286 | PidginPluginUiData *ui_data; |
| 36929 | 287 | PurplePluginPrefFrameCallback get_pref_frame; |
| 288 | PurplePluginPrefRequestCallback get_pref_request; | |
| 289 | PidginPluginConfigFrame get_pidgin_frame = NULL; | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
290 | gint prefs_count; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
291 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
292 | g_return_if_fail(plugin != NULL); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
293 | |
| 36929 | 294 | info = purple_plugin_get_info(plugin); |
| 295 | ||
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
296 | if (!pidgin_plugin_has_prefs(plugin)) { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
297 | purple_debug_warning("gtkplugin", "Plugin has no prefs"); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
298 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
299 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
300 | |
| 36929 | 301 | if (purple_plugin_info_get_ui_data(info)) |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
302 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
303 | |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
304 | if (PIDGIN_IS_PLUGIN_INFO(info)) |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
305 | priv = PIDGIN_PLUGIN_INFO_GET_PRIVATE(info); |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
306 | |
| 36929 | 307 | get_pref_frame = purple_plugin_info_get_pref_frame_callback(info); |
| 308 | get_pref_request = purple_plugin_info_get_pref_request_callback(info); | |
| 309 | ||
| 310 | if (priv) | |
| 311 | get_pidgin_frame = priv->get_config_frame; | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
312 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
313 | prefs_count = 0; |
| 36929 | 314 | if (get_pref_frame) |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
315 | prefs_count++; |
| 36929 | 316 | if (get_pref_request) |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
317 | prefs_count++; |
| 36929 | 318 | if (get_pidgin_frame) |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
319 | prefs_count++; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
320 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
321 | if (prefs_count > 1) { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
322 | purple_debug_warning("gtkplugin", "Plugin %s contains more than" |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
323 | " one prefs callback, some will be ignored.", |
| 36929 | 324 | purple_plugin_info_get_name(info)); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
325 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
326 | g_return_if_fail(prefs_count > 0); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
327 | |
| 36929 | 328 | ui_data = g_new0(PidginPluginUiData, 1); |
| 329 | purple_plugin_info_set_ui_data(info, ui_data); | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
330 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
331 | /* Priority: pidgin frame > purple request > purple frame |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
332 | * Purple frame could be replaced with purple request some day. |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
333 | */ |
| 36929 | 334 | if (get_pref_request && !get_pidgin_frame) { |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
335 | ui_data->type = PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST; |
| 36929 | 336 | ui_data->u.request_handle = get_pref_request(plugin); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
337 | purple_request_add_close_notify(ui_data->u.request_handle, |
| 36929 | 338 | purple_callback_set_zero, &info->ui_data); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
339 | purple_request_add_close_notify(ui_data->u.request_handle, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
340 | g_free, ui_data); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
341 | } else { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
342 | GtkWidget *box, *dialog; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
343 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
344 | ui_data->type = PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
345 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
346 | box = pidgin_plugin_get_config_frame(plugin, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
347 | &ui_data->u.frame.pref_frame); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
348 | if (box == NULL) { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
349 | purple_debug_error("gtkplugin", |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
350 | "Failed to display prefs frame"); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
351 | g_free(ui_data); |
| 36929 | 352 | purple_plugin_info_set_ui_data(info, NULL); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
353 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
354 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
355 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
356 | ui_data->u.frame.dialog = dialog = gtk_dialog_new_with_buttons( |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
357 | PIDGIN_ALERT_TITLE, parent, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
358 | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
359 | GTK_RESPONSE_CLOSE, NULL); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
360 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
361 | g_signal_connect(G_OBJECT(dialog), "response", |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
362 | G_CALLBACK(pref_dialog_response_cb), plugin); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
363 | gtk_container_add(GTK_CONTAINER( |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
364 | gtk_dialog_get_content_area(GTK_DIALOG(dialog))), box); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
365 | gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
366 | gtk_window_set_title(GTK_WINDOW(dialog), |
| 36929 | 367 | _(purple_plugin_info_get_name(info))); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
368 | gtk_widget_show_all(dialog); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
369 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
370 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
371 | |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
372 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
373 | pidgin_plugins_save(void) |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
374 | { |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
375 | purple_plugins_save_loaded(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
376 | } |
| 11740 | 377 | |
| 378 | static void | |
| 379 | update_plugin_list(void *data) | |
| 380 | { | |
| 381 | GtkListStore *ls = GTK_LIST_STORE(data); | |
| 382 | GtkTreeIter iter; | |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
383 | GList *plugins, *l; |
| 15884 | 384 | PurplePlugin *plug; |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
385 | PurplePluginInfo *info; |
| 11740 | 386 | |
| 387 | gtk_list_store_clear(ls); | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
388 | purple_plugins_refresh(); |
| 11740 | 389 | |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
390 | plugins = purple_plugins_find_all(); |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
391 | |
|
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
392 | for (l = plugins; l != NULL; l = l->next) |
| 11740 | 393 | { |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
394 | char *name; |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
395 | char *version; |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
396 | char *summary; |
| 11740 | 397 | char *desc; |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
398 | plug = PURPLE_PLUGIN(l->data); |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
399 | info = purple_plugin_get_info(plug); |
| 11740 | 400 | |
|
36467
52aa83c47311
Replaced purple_plugin_loads_on_query() with purple_plugin_is_internal().
Ankit Vani <a@nevitus.org>
parents:
36464
diff
changeset
|
401 | if (purple_plugin_is_internal(plug)) |
|
15336
a2454071e986
[gaim-migrate @ 18064]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15177
diff
changeset
|
402 | continue; |
| 11740 | 403 | |
| 404 | gtk_list_store_append (ls, &iter); | |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
405 | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
406 | if (purple_plugin_info_get_name(info)) { |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
407 | name = g_markup_escape_text(_(purple_plugin_info_get_name(info)), -1); |
|
26756
874b154f4220
More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23180
diff
changeset
|
408 | } else { |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
409 | char *tmp = g_path_get_basename(purple_plugin_get_filename(plug)); |
|
26756
874b154f4220
More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23180
diff
changeset
|
410 | name = g_markup_escape_text(tmp, -1); |
|
874b154f4220
More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23180
diff
changeset
|
411 | g_free(tmp); |
|
874b154f4220
More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23180
diff
changeset
|
412 | } |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
413 | version = g_markup_escape_text(purple_plugin_info_get_version(info), -1); |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
414 | summary = g_markup_escape_text(purple_plugin_info_get_summary(info), -1); |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
415 | |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
416 | desc = g_strdup_printf("<b>%s</b> %s\n%s", name, |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
417 | version, |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
418 | summary); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
419 | g_free(name); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
420 | g_free(version); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
421 | g_free(summary); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
422 | |
| 11740 | 423 | gtk_list_store_set(ls, &iter, |
| 15884 | 424 | 0, purple_plugin_is_loaded(plug), |
| 11740 | 425 | 1, desc, |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
426 | 2, plug, |
|
36760
88a9488af4e8
Fixed pidgin's plugin list display
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
427 | 3, purple_plugin_info_get_error(info), |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
428 | -1); |
| 11740 | 429 | g_free(desc); |
| 430 | } | |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
431 | |
|
36430
559d5d9d8a6c
Refactored the codebase to remove purple_plugins_free_found_list()
Ankit Vani <a@nevitus.org>
parents:
36422
diff
changeset
|
432 | g_list_free(plugins); |
| 11740 | 433 | } |
| 434 | ||
|
36780
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
435 | static gboolean |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
436 | check_if_loaded(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
437 | { |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
438 | PurplePlugin *plugin; |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
439 | gtk_tree_model_get(model, iter, 2, &plugin, -1); |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
440 | gtk_list_store_set(GTK_LIST_STORE(model), iter, |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
441 | 0, purple_plugin_is_loaded(plugin), |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
442 | -1); |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
443 | return FALSE; |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
444 | } |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
445 | |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
446 | static void |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
447 | update_loaded_plugins(GtkTreeModel *model) |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
448 | { |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
449 | gtk_tree_model_foreach(model, check_if_loaded, NULL); |
| 11740 | 450 | } |
| 451 | ||
| 15884 | 452 | static void plugin_loading_common(PurplePlugin *plugin, GtkTreeView *view, gboolean loaded) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
453 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
454 | GtkTreeIter iter; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
455 | GtkTreeModel *model = gtk_tree_view_get_model(view); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
456 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
457 | if (gtk_tree_model_get_iter_first(model, &iter)) { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
458 | do { |
| 15884 | 459 | PurplePlugin *plug; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
460 | GtkTreeSelection *sel; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
461 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
462 | gtk_tree_model_get(model, &iter, 2, &plug, -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
463 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
464 | if (plug != plugin) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
465 | continue; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
466 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
467 | gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, loaded, -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
468 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
469 | /* If the loaded/unloaded plugin is the selected row, |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
470 | * update the pref_button. */ |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
471 | sel = gtk_tree_view_get_selection(view); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
472 | if (gtk_tree_selection_get_selected(sel, &model, &iter)) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
473 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
474 | gtk_tree_model_get(model, &iter, 2, &plug, -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
475 | if (plug == plugin) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
476 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
477 | gtk_widget_set_sensitive(pref_button, |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
478 | pidgin_plugin_has_prefs(plug)); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
479 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
480 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
481 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
482 | break; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
483 | } while (gtk_tree_model_iter_next(model, &iter)); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
484 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
485 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
486 | |
| 15884 | 487 | static void plugin_load_cb(PurplePlugin *plugin, gpointer data) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
488 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
489 | GtkTreeView *view = (GtkTreeView *)data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
490 | plugin_loading_common(plugin, view, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
491 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
492 | |
| 15884 | 493 | static void plugin_unload_cb(PurplePlugin *plugin, gpointer data) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
494 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
495 | GtkTreeView *view = (GtkTreeView *)data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
496 | plugin_loading_common(plugin, view, FALSE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
497 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
498 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
499 | static void plugin_unload_confirm_cb(gpointer *data) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
500 | { |
| 15884 | 501 | PurplePlugin *plugin = (PurplePlugin *)data[0]; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
502 | GtkTreeModel *model = (GtkTreeModel *)data[1]; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
503 | GtkTreeIter *iter = (GtkTreeIter *)data[2]; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
504 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
505 | plugin_toggled_stage_two(plugin, model, iter, NULL, TRUE); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
506 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
507 | g_free(data); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
508 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
509 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
510 | static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
| 11740 | 511 | { |
| 512 | GtkTreeModel *model = (GtkTreeModel *)data; | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
513 | GtkTreeIter *iter = g_new(GtkTreeIter, 1); |
| 11740 | 514 | GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
| 15884 | 515 | PurplePlugin *plug; |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
516 | GError *error = NULL; |
| 11740 | 517 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
518 | gtk_tree_model_get_iter(model, iter, path); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
519 | gtk_tree_path_free(path); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
520 | gtk_tree_model_get(model, iter, 2, &plug, -1); |
| 11740 | 521 | |
| 15884 | 522 | if (!purple_plugin_is_loaded(plug)) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
523 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
524 | pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
525 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
526 | purple_plugin_load(plug, &error); |
|
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
527 | plugin_toggled_stage_two(plug, model, iter, error, FALSE); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
528 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
529 | pidgin_clear_cursor(plugin_dialog); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
530 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
531 | else |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
532 | { |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
533 | pref_dialog_close(plug); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
534 | |
|
36440
58d31fb6330a
Refactored the codebase according to the API changes
Ankit Vani <a@nevitus.org>
parents:
36438
diff
changeset
|
535 | if (purple_plugin_get_dependent_plugins(plug) != NULL) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
536 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
537 | GString *tmp = g_string_new(_("The following plugins will be unloaded.")); |
| 36438 | 538 | GSList *l; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
539 | gpointer *cb_data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
540 | |
|
36440
58d31fb6330a
Refactored the codebase according to the API changes
Ankit Vani <a@nevitus.org>
parents:
36438
diff
changeset
|
541 | for (l = purple_plugin_get_dependent_plugins(plug); l != NULL ; l = l->next) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
542 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
543 | const char *dep_name = (const char *)l->data; |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
544 | PurplePlugin *dep_plugin = purple_plugins_find_plugin(dep_name); |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
545 | PurplePluginInfo *dep_info; |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
546 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
547 | g_return_if_fail(dep_plugin != NULL); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
548 | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
549 | dep_info = purple_plugin_get_info(dep_plugin); |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
550 | g_string_append_printf(tmp, "\n\t%s\n", purple_plugin_info_get_name(dep_info)); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
551 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
552 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
553 | cb_data = g_new(gpointer, 3); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
554 | cb_data[0] = plug; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
555 | cb_data[1] = model; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
556 | cb_data[2] = iter; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
557 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
558 | purple_request_action(plugin_dialog, NULL, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
559 | _("Multiple plugins will be unloaded."), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
560 | tmp->str, 0, NULL, cb_data, 2, |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
561 | _("Unload Plugins"), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
562 | G_CALLBACK(plugin_unload_confirm_cb), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
563 | _("Cancel"), g_free); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
564 | g_string_free(tmp, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
565 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
566 | else |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
567 | plugin_toggled_stage_two(plug, model, iter, NULL, TRUE); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
568 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
569 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
570 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
571 | static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, GError *error, gboolean unload) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
572 | { |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
573 | PurplePluginInfo *info = purple_plugin_get_info(plug); |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
574 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
575 | if (unload) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
576 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
577 | pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
578 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
579 | if (!purple_plugin_unload(plug, &error)) |
|
20872
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
580 | { |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
581 | const char *primary = _("Could not unload plugin"); |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
582 | const char *reload = _("The plugin could not be unloaded now, but will be disabled at the next startup."); |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
583 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
584 | char *tmp = g_strdup_printf("%s\n\n%s", reload, error->message); |
| 36782 | 585 | purple_notify_warning(NULL, NULL, primary, tmp, NULL); |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
586 | g_free(tmp); |
|
20872
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
587 | |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
588 | purple_plugin_disable(plug); |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
589 | } |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
590 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
591 | pidgin_clear_cursor(plugin_dialog); |
| 11781 | 592 | } |
|
36831
9d29e248716d
Notify plugin load error in pidgin
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
593 | else if (!unload && error) |
|
9d29e248716d
Notify plugin load error in pidgin
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
594 | { |
|
9d29e248716d
Notify plugin load error in pidgin
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
595 | purple_notify_warning(NULL, NULL, _("Could not load plugin"), error->message, NULL); |
|
9d29e248716d
Notify plugin load error in pidgin
Ankit Vani <a@nevitus.org>
parents:
36782
diff
changeset
|
596 | } |
| 11740 | 597 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
598 | gtk_widget_set_sensitive(pref_button, pidgin_plugin_has_prefs(plug)); |
| 11740 | 599 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
600 | if (error != NULL) |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
601 | { |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
602 | gchar *name = g_markup_escape_text(purple_plugin_info_get_name(info), -1); |
| 11781 | 603 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
604 | gchar *disp_error = g_markup_escape_text(error->message, -1); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
605 | gchar *text; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
606 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
607 | text = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
608 | "<b>%s</b> %s\n<span weight=\"bold\" color=\"red\"%s</span>", |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
609 | purple_plugin_info_get_name(info), |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
610 | purple_plugin_info_get_version(info), disp_error); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
611 | gtk_list_store_set(GTK_LIST_STORE (model), iter, |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
612 | 1, text, |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
613 | -1); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
614 | g_free(text); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
615 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
616 | text = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
617 | "<span weight=\"bold\" color=\"red\">%s</span>", |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
618 | disp_error); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
619 | gtk_label_set_markup(plugin_error, text); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
620 | g_free(text); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
621 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
622 | g_free(disp_error); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
623 | g_free(name); |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
624 | |
|
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
625 | g_error_free(error); |
| 11740 | 626 | } |
| 627 | ||
|
36780
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
628 | if ((unload && purple_plugin_get_dependent_plugins(plug)) || |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
629 | (!unload && purple_plugin_info_get_dependencies(info))) |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
630 | update_loaded_plugins(model); |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
631 | else |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
632 | gtk_list_store_set(GTK_LIST_STORE (model), iter, |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
633 | 0, purple_plugin_is_loaded(plug), |
|
2e95872a71c3
Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin
Ankit Vani <a@nevitus.org>
parents:
36760
diff
changeset
|
634 | -1); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
635 | g_free(iter); |
| 11740 | 636 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
637 | pidgin_plugins_save(); |
| 11740 | 638 | } |
| 639 | ||
| 11877 | 640 | static gboolean ensure_plugin_visible(void *data) |
| 641 | { | |
| 642 | GtkTreeSelection *sel = GTK_TREE_SELECTION(data); | |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
643 | GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel); |
| 11877 | 644 | GtkTreeModel *model = gtk_tree_view_get_model(tv); |
| 645 | GtkTreePath *path; | |
| 646 | GtkTreeIter iter; | |
| 647 | if (!gtk_tree_selection_get_selected (sel, &model, &iter)) | |
| 648 | return FALSE; | |
| 649 | path = gtk_tree_model_get_path(model, &iter); | |
| 650 | gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0); | |
| 651 | gtk_tree_path_free(path); | |
| 652 | return FALSE; | |
| 653 | } | |
| 654 | ||
| 11740 | 655 | static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
| 656 | { | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
657 | gchar *buf, *tmp, *name, *version; |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
658 | gchar *authors = NULL; |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
659 | const gchar * const *authorlist; |
| 11740 | 660 | GtkTreeIter iter; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
661 | GValue val; |
| 15884 | 662 | PurplePlugin *plug; |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
663 | PurplePluginInfo *info; |
| 11740 | 664 | |
|
11833
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
665 | if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
666 | { |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
667 | gtk_widget_set_sensitive(pref_button, FALSE); |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
668 | |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
669 | /* Collapse and disable the expander widget */ |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
670 | gtk_expander_set_expanded(GTK_EXPANDER(expander), FALSE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
671 | gtk_widget_set_sensitive(expander, FALSE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
672 | |
| 11740 | 673 | return; |
|
11833
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
674 | } |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
675 | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
676 | gtk_widget_set_sensitive(expander, TRUE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
677 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
678 | val.g_type = 0; |
| 11740 | 679 | gtk_tree_model_get_value (model, &iter, 2, &val); |
| 680 | plug = g_value_get_pointer(&val); | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
681 | info = purple_plugin_get_info(plug); |
| 11740 | 682 | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
683 | name = g_markup_escape_text(purple_plugin_info_get_name(info), -1); |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
684 | version = g_markup_escape_text(purple_plugin_info_get_version(info), -1); |
| 11740 | 685 | buf = g_strdup_printf( |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
686 | "<span size=\"larger\" weight=\"bold\">%s</span> " |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
687 | "<span size=\"smaller\">%s</span>", |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
688 | name, version); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
689 | gtk_label_set_markup(plugin_name, buf); |
|
23180
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
690 | g_free(name); |
|
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
691 | g_free(version); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
692 | g_free(buf); |
| 11740 | 693 | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
694 | gtk_text_buffer_set_text(plugin_desc, purple_plugin_info_get_description(info), -1); |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
695 | |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
696 | authorlist = purple_plugin_info_get_authors(info); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
697 | if (authorlist) |
|
36760
88a9488af4e8
Fixed pidgin's plugin list display
Ankit Vani <a@nevitus.org>
parents:
36701
diff
changeset
|
698 | authors = g_strjoinv(",\n", (gchar **)authorlist); |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
699 | gtk_label_set_text(plugin_authors, authors); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
700 | g_free(authors); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
701 | |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
702 | gtk_label_set_text(plugin_filename, purple_plugin_get_filename(plug)); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
703 | |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
704 | g_free(plugin_website_uri); |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
705 | plugin_website_uri = g_strdup(purple_plugin_info_get_website(info)); |
|
36420
7a5cb79a8243
Refactored gtkplugin to use the new API. Handling of dependent plugins on unload is left till GPlugin implements it.
Ankit Vani <a@nevitus.org>
parents:
36417
diff
changeset
|
706 | |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
707 | if (plugin_website_uri) |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
708 | { |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
709 | tmp = g_markup_escape_text(plugin_website_uri, -1); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
710 | buf = g_strdup_printf("<span underline=\"single\" " |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
711 | "foreground=\"blue\">%s</span>", tmp); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
712 | gtk_label_set_markup(plugin_website, buf); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
713 | g_free(tmp); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
714 | g_free(buf); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
715 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
716 | else |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
717 | { |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
718 | gtk_label_set_text(plugin_website, NULL); |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
719 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
720 | |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
721 | if (purple_plugin_info_get_error(info) == NULL) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
722 | { |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
723 | gtk_label_set_text(plugin_error, NULL); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
724 | } |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
725 | else |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
726 | { |
|
36516
cbf16b28176c
Refactored pidgin according to the changes
Ankit Vani <a@nevitus.org>
parents:
36479
diff
changeset
|
727 | tmp = g_markup_escape_text(purple_plugin_info_get_error(info), -1); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
728 | buf = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
729 | _("<span foreground=\"red\" weight=\"bold\">" |
|
12705
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
730 | "Error: %s\n" |
|
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
731 | "Check the plugin website for an update." |
|
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
732 | "</span>"), |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
733 | tmp); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
734 | gtk_label_set_markup(plugin_error, buf); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
735 | g_free(buf); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
736 | g_free(tmp); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
737 | } |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
738 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
739 | gtk_widget_set_sensitive(pref_button, pidgin_plugin_has_prefs(plug)); |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
740 | |
| 11877 | 741 | /* Make sure the selected plugin is still visible */ |
| 742 | g_idle_add(ensure_plugin_visible, sel); | |
| 743 | ||
| 11740 | 744 | g_value_unset(&val); |
| 745 | } | |
| 746 | ||
| 11741 | 747 | static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel) |
| 11740 | 748 | { |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
749 | PurplePlugin *plugin; |
| 11740 | 750 | GtkTreeModel *model; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
751 | GValue val; |
| 11740 | 752 | GtkTreeIter iter; |
| 36929 | 753 | GList *list, *it; |
| 11740 | 754 | |
| 755 | switch (response) { | |
| 756 | case GTK_RESPONSE_CLOSE: | |
| 757 | case GTK_RESPONSE_DELETE_EVENT: | |
| 15884 | 758 | purple_request_close_with_handle(plugin_dialog); |
| 759 | purple_signals_disconnect_by_handle(plugin_dialog); | |
| 36929 | 760 | list = purple_plugins_find_all(); |
| 761 | for (it = list; it; it = g_list_next(it)) | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
762 | pref_dialog_close(it->data); |
| 36929 | 763 | g_list_free(list); |
| 11740 | 764 | gtk_widget_destroy(d); |
| 765 | plugin_dialog = NULL; | |
| 766 | break; | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
767 | case PIDGIN_RESPONSE_CONFIGURE: |
| 11740 | 768 | if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
| 769 | return; | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
770 | val.g_type = 0; |
|
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
771 | gtk_tree_model_get_value(model, &iter, 2, &val); |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
772 | plugin = g_value_get_pointer(&val); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
773 | g_value_unset(&val); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
774 | if (plugin == NULL) |
| 11740 | 775 | break; |
| 776 | ||
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
777 | pidgin_plugin_open_config(plugin, GTK_WINDOW(d)); |
| 11781 | 778 | |
| 11740 | 779 | break; |
| 780 | } | |
| 781 | } | |
| 782 | ||
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
783 | static void |
|
13718
f29249a2856c
[gaim-migrate @ 16125]
Richard Laager <rlaager@pidgin.im>
parents:
13436
diff
changeset
|
784 | show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GtkWidget *dialog) |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
785 | { |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
786 | GtkTreeSelection *sel; |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
787 | GtkTreeIter iter; |
| 15884 | 788 | PurplePlugin *plugin; |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
789 | GtkTreeModel *model; |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
790 | |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
791 | sel = gtk_tree_view_get_selection(view); |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
792 | |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
793 | if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
794 | return; |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
795 | |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
796 | gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
797 | |
| 15884 | 798 | if (!purple_plugin_is_loaded(plugin)) |
|
12174
3b0b53e84591
[gaim-migrate @ 14476]
Richard Laager <rlaager@pidgin.im>
parents:
12162
diff
changeset
|
799 | return; |
|
3b0b53e84591
[gaim-migrate @ 14476]
Richard Laager <rlaager@pidgin.im>
parents:
12162
diff
changeset
|
800 | |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
801 | /* Now show the pref-dialog for the plugin */ |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
802 | plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel); |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
803 | } |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
804 | |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
805 | static gboolean |
|
33161
c248c062f272
Pass the cairo context to the tooltip paint function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
806 | pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, cairo_t *cr, gpointer data) |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
807 | { |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
808 | PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
809 | #if GTK_CHECK_VERSION(3,0,0) |
|
33271
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
810 | GtkStyleContext *context = gtk_widget_get_style_context(tipwindow); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
811 | gtk_style_context_add_class(context, GTK_STYLE_CLASS_TOOLTIP); |
|
53bf180b9eb1
Use GtkStyleContext instead of GtkStyle on GTK+3.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
812 | gtk_render_layout(context, cr, 6, 6, layout); |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
813 | #else |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
814 | gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
815 | NULL, tipwindow, "tooltip", |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
816 | 6, 6, layout); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
817 | #endif |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32410
diff
changeset
|
818 | return TRUE; |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
819 | } |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
820 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
821 | static gboolean |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
822 | pidgin_plugins_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path, |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
823 | gpointer data, int *w, int *h) |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
824 | { |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
825 | GtkTreeIter iter; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
826 | GtkTreeView *treeview = GTK_TREE_VIEW(data); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
827 | PurplePlugin *plugin = NULL; |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
828 | PurplePluginInfo *info; |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
829 | GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
830 | PangoLayout *layout; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
831 | int width, height; |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
832 | const char * const *authorlist; |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
833 | char *markup, *name, *desc; |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
834 | char *authors = NULL, *pauthors = NULL; |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
835 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
836 | if (!gtk_tree_model_get_iter(model, &iter, path)) |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
837 | return FALSE; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
838 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
839 | gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
840 | info = purple_plugin_get_info(plugin); |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
841 | authorlist = purple_plugin_info_get_authors(info); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
842 | |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
843 | if (authorlist) |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
844 | authors = g_strjoinv(", ", (gchar **)authorlist); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
845 | if (authors) |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
846 | pauthors = g_markup_escape_text(authors, -1); |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
847 | |
|
22533
7e1e39d5db7e
Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22065
diff
changeset
|
848 | markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s", |
|
36431
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
849 | name = g_markup_escape_text(purple_plugin_info_get_name(info), -1), |
|
ea007725fd4d
Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents:
36430
diff
changeset
|
850 | _("Description"), desc = g_markup_escape_text(purple_plugin_info_get_description(info), -1), |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
851 | (g_strv_length((gchar **)authorlist) > 1 ? _("Authors") : _("Author")), pauthors); |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
852 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
853 | layout = gtk_widget_create_pango_layout(tipwindow, NULL); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
854 | pango_layout_set_markup(layout, markup, -1); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
855 | pango_layout_set_wrap(layout, PANGO_WRAP_WORD); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
856 | pango_layout_set_width(layout, 600000); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
857 | pango_layout_get_size(layout, &width, &height); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
858 | g_object_set_data_full(G_OBJECT(tipwindow), "tooltip-plugin", layout, g_object_unref); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
859 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
860 | if (w) |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
861 | *w = PANGO_PIXELS(width) + 12; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
862 | if (h) |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
863 | *h = PANGO_PIXELS(height) + 12; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
864 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
865 | g_free(markup); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
866 | g_free(name); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
867 | g_free(desc); |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
868 | g_free(pauthors); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
869 | g_free(authors); |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
870 | |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
871 | return TRUE; |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
872 | } |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
873 | |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
874 | static gboolean |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
875 | website_button_motion_cb(GtkWidget *button, GdkEventCrossing *event, |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
876 | gpointer unused) |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
877 | { |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
878 | if (plugin_website_uri) { |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
879 | pidgin_set_cursor(button, GDK_HAND2); |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
880 | return TRUE; |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
881 | } |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
882 | return FALSE; |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
883 | } |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
884 | |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
885 | static gboolean |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
886 | website_button_clicked_cb(GtkButton *button, GdkEventButton *event, |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
887 | gpointer unused) |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
888 | { |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
889 | if (plugin_website_uri) { |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
890 | purple_notify_uri(NULL, plugin_website_uri); |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
891 | return TRUE; |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
892 | } |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
893 | return FALSE; |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
894 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
895 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
896 | static GtkWidget * |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
897 | create_details() |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
898 | { |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
899 | GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 3)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
900 | GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
901 | GtkWidget *label, *view, *website_button; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
902 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
903 | plugin_name = GTK_LABEL(gtk_label_new(NULL)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
904 | gtk_misc_set_alignment(GTK_MISC(plugin_name), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
905 | gtk_label_set_line_wrap(plugin_name, FALSE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
906 | gtk_label_set_selectable(plugin_name, TRUE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
907 | gtk_box_pack_start(vbox, GTK_WIDGET(plugin_name), FALSE, FALSE, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
908 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
909 | view = gtk_text_view_new(); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
910 | plugin_desc = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
911 | g_object_set(view, "wrap-mode", GTK_WRAP_WORD, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
912 | "editable", FALSE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
913 | "left-margin", PIDGIN_HIG_CAT_SPACE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
914 | "right-margin", PIDGIN_HIG_CAT_SPACE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
915 | NULL); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
916 | gtk_box_pack_start(vbox, view, TRUE, TRUE, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
917 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
918 | plugin_error = GTK_LABEL(gtk_label_new(NULL)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
919 | gtk_misc_set_alignment(GTK_MISC(plugin_error), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
920 | gtk_label_set_line_wrap(plugin_error, FALSE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
921 | gtk_label_set_selectable(plugin_error, TRUE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
922 | gtk_box_pack_start(vbox, GTK_WIDGET(plugin_error), FALSE, FALSE, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
923 | |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
924 | plugin_authors = GTK_LABEL(gtk_label_new(NULL)); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
925 | gtk_label_set_line_wrap(plugin_authors, FALSE); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
926 | gtk_misc_set_alignment(GTK_MISC(plugin_authors), 0, 0); |
|
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
927 | gtk_label_set_selectable(plugin_authors, TRUE); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
928 | pidgin_add_widget_to_vbox(vbox, "", sg, |
|
36644
e06a238d2864
Refactored pidgin to show multiple authors
Ankit Vani <a@nevitus.org>
parents:
36516
diff
changeset
|
929 | GTK_WIDGET(plugin_authors), TRUE, &label); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
930 | gtk_label_set_markup(GTK_LABEL(label), _("<b>Written by:</b>")); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
931 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
932 | |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
933 | website_button = gtk_event_box_new(); |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
934 | gtk_event_box_set_visible_window(GTK_EVENT_BOX(website_button), FALSE); |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
935 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
936 | plugin_website = GTK_LABEL(gtk_label_new(NULL)); |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
937 | g_object_set(G_OBJECT(plugin_website), |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
938 | "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
939 | gtk_misc_set_alignment(GTK_MISC(plugin_website), 0, 0); |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
940 | gtk_container_add(GTK_CONTAINER(website_button), |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
941 | GTK_WIDGET(plugin_website)); |
|
22788
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
942 | g_signal_connect(website_button, "button-release-event", |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
943 | G_CALLBACK(website_button_clicked_cb), NULL); |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
944 | g_signal_connect(website_button, "enter-notify-event", |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
945 | G_CALLBACK(website_button_motion_cb), NULL); |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
946 | g_signal_connect(website_button, "leave-notify-event", |
|
113ae3a1f584
Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22785
diff
changeset
|
947 | G_CALLBACK(pidgin_clear_cursor), NULL); |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
948 | |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
949 | pidgin_add_widget_to_vbox(vbox, "", sg, website_button, TRUE, &label); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
950 | gtk_label_set_markup(GTK_LABEL(label), _("<b>Web site:</b>")); |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
951 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
952 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
953 | plugin_filename = GTK_LABEL(gtk_label_new(NULL)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
954 | gtk_label_set_line_wrap(plugin_filename, FALSE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
955 | gtk_misc_set_alignment(GTK_MISC(plugin_filename), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
956 | gtk_label_set_selectable(plugin_filename, TRUE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
957 | pidgin_add_widget_to_vbox(vbox, "", sg, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
958 | GTK_WIDGET(plugin_filename), TRUE, &label); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
959 | gtk_label_set_markup(GTK_LABEL(label), _("<b>Filename:</b>")); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
960 | gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
961 | |
|
23180
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
962 | g_object_unref(sg); |
|
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
963 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
964 | return GTK_WIDGET(vbox); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
965 | } |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
966 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
967 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
968 | void pidgin_plugin_dialog_show() |
| 11740 | 969 | { |
| 970 | GtkWidget *event_view; | |
| 971 | GtkListStore *ls; | |
| 972 | GtkCellRenderer *rend, *rendt; | |
| 973 | GtkTreeViewColumn *col; | |
| 974 | GtkTreeSelection *sel; | |
| 975 | ||
| 976 | if (plugin_dialog != NULL) { | |
| 977 | gtk_window_present(GTK_WINDOW(plugin_dialog)); | |
| 978 | return; | |
| 979 | } | |
| 980 | ||
|
33168
f51e53d27b99
Fix a minor warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33161
diff
changeset
|
981 | plugin_dialog = gtk_dialog_new(); |
|
f51e53d27b99
Fix a minor warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33161
diff
changeset
|
982 | gtk_window_set_title(GTK_WINDOW(plugin_dialog), _("Plugins")); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
983 | pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
984 | _("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
985 | gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
|
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
986 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
| 11813 | 987 | gtk_widget_set_sensitive(pref_button, FALSE); |
| 11747 | 988 | gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins"); |
| 11740 | 989 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
990 | ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN); |
| 11740 | 991 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
| 992 | 1, GTK_SORT_ASCENDING); | |
| 993 | ||
| 994 | update_plugin_list(ls); | |
| 11813 | 995 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
996 | event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); |
| 11740 | 997 | |
| 14359 | 998 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(event_view), TRUE); |
| 999 | ||
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
1000 | g_signal_connect(G_OBJECT(event_view), "row-activated", |
|
13718
f29249a2856c
[gaim-migrate @ 16125]
Richard Laager <rlaager@pidgin.im>
parents:
13436
diff
changeset
|
1001 | G_CALLBACK(show_plugin_prefs_cb), plugin_dialog); |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
1002 | |
| 15884 | 1003 | purple_signal_connect(purple_plugins_get_handle(), "plugin-load", plugin_dialog, |
| 1004 | PURPLE_CALLBACK(plugin_load_cb), event_view); | |
| 1005 | purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", plugin_dialog, | |
| 1006 | PURPLE_CALLBACK(plugin_unload_cb), event_view); | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
1007 | |
| 11740 | 1008 | rend = gtk_cell_renderer_toggle_new(); |
| 1009 | sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
| 1010 | ||
| 1011 | col = gtk_tree_view_column_new_with_attributes (_("Enabled"), | |
| 1012 | rend, | |
| 1013 | "active", 0, | |
| 1014 | NULL); | |
| 1015 | gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
|
11794
6c39942d27a9
[gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents:
11783
diff
changeset
|
1016 | gtk_tree_view_column_set_sort_column_id(col, 0); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
1017 | g_signal_connect(G_OBJECT(rend), "toggled", |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
1018 | G_CALLBACK(plugin_toggled), ls); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
1019 | |
| 11740 | 1020 | rendt = gtk_cell_renderer_text_new(); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
1021 | g_object_set(rendt, |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
1022 | "foreground", "#c0c0c0", |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
1023 | NULL); |
| 11740 | 1024 | col = gtk_tree_view_column_new_with_attributes (_("Name"), |
| 1025 | rendt, | |
| 1026 | "markup", 1, | |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
1027 | "foreground-set", 3, |
| 11740 | 1028 | NULL); |
| 1029 | gtk_tree_view_column_set_expand (col, TRUE); | |
| 1030 | g_object_set(rendt, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |
| 1031 | gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
|
11794
6c39942d27a9
[gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents:
11783
diff
changeset
|
1032 | gtk_tree_view_column_set_sort_column_id(col, 1); |
| 11740 | 1033 | g_object_unref(G_OBJECT(ls)); |
|
33158
ad941796372e
Remove some added trailing spaces.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33133
diff
changeset
|
1034 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), |
|
31321
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30785
diff
changeset
|
1035 | pidgin_make_scrollable(event_view, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1), |
|
1fef3832cfa2
Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents:
30785
diff
changeset
|
1036 | TRUE, TRUE, 0); |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14359
diff
changeset
|
1037 | gtk_tree_view_set_search_column(GTK_TREE_VIEW(event_view), 1); |
|
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14359
diff
changeset
|
1038 | gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(event_view), |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1039 | pidgin_tree_view_search_equal_func, NULL, NULL); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
1040 | |
|
22065
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
1041 | pidgin_tooltip_setup_for_treeview(event_view, event_view, |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
1042 | pidgin_plugins_create_tooltip, |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
1043 | pidgin_plugins_paint_tooltip); |
|
4bfdea9613d1
Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21352
diff
changeset
|
1044 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
1045 | |
| 11740 | 1046 | expander = gtk_expander_new(_("<b>Plugin Details</b>")); |
| 1047 | gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
1048 | gtk_widget_set_sensitive(expander, FALSE); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
1049 | gtk_container_add(GTK_CONTAINER(expander), create_details()); |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
1050 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(plugin_dialog))), |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
1051 | expander, FALSE, FALSE, 0); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
1052 | |
| 11740 | 1053 | |
| 1054 | g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); | |
| 1055 | g_signal_connect(G_OBJECT(plugin_dialog), "response", G_CALLBACK(plugin_dialog_response_cb), sel); | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
1056 | gtk_window_set_default_size(GTK_WINDOW(plugin_dialog), 430, 530); |
|
30760
7b0121a454cd
Auto-parent the Plugins dialog.
Gabriel Schulhof <nix@go-nix.ca>
parents:
29500
diff
changeset
|
1057 | |
|
30785
9c4ea3886ce5
Remove an unnecessary cast. Get's rid of this compile warning:
Mark Doliner <markdoliner@pidgin.im>
parents:
30760
diff
changeset
|
1058 | pidgin_auto_parent_window(plugin_dialog); |
|
30760
7b0121a454cd
Auto-parent the Plugins dialog.
Gabriel Schulhof <nix@go-nix.ca>
parents:
29500
diff
changeset
|
1059 | |
| 11740 | 1060 | gtk_widget_show_all(plugin_dialog); |
| 1061 | } |