Sat, 05 Apr 2014 14:19:33 +0200
Comments: memory pool
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 5205 | 2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 8046 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
6927
528988ef2781
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
6 | * |
| 5205 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * 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
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5205 | 20 | */ |
| 11740 | 21 | #include "internal.h" |
| 15577 | 22 | #include "pidgin.h" |
| 5205 | 23 | #include "gtkplugin.h" |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
24 | #include "gtkpluginpref.h" |
|
13436
b80f8990bc67
[gaim-migrate @ 15810]
Richard Laager <rlaager@pidgin.im>
parents:
13435
diff
changeset
|
25 | #include "gtkutils.h" |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
26 | #include "debug.h" |
|
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
27 | #include "prefs.h" |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
28 | #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
|
29 | #include "pidgintooltip.h" |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
30 | |
| 5205 | 31 | #include <string.h> |
| 32 | ||
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
33 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
34 | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
35 | #define PIDGIN_RESPONSE_CONFIGURE 98121 |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
36 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
37 | typedef struct |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
38 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
39 | enum |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
40 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
41 | 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
|
42 | 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
|
43 | } type; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
44 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
45 | union |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
46 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
47 | struct |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
48 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
49 | GtkWidget *dialog; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
50 | 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
|
51 | } frame; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
52 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
53 | 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
|
54 | } u; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
55 | } PidginPluginUiData; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
56 | |
| 15884 | 57 | static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
58 | GtkTreeIter *iter, gboolean unload); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
59 | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
60 | static GtkWidget *expander = NULL; |
| 11740 | 61 | static GtkWidget *plugin_dialog = NULL; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
62 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
63 | static GtkLabel *plugin_name = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
64 | static GtkTextBuffer *plugin_desc = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
65 | static GtkLabel *plugin_error = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
66 | static GtkLabel *plugin_author = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
67 | 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
|
68 | 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
|
69 | static GtkLabel *plugin_filename = NULL; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
70 | |
| 11740 | 71 | 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
|
72 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
73 | static gboolean |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
74 | 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
|
75 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
76 | PurplePluginUiInfo *pinfo; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
77 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
78 | 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
|
79 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
80 | 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
|
81 | return FALSE; |
| 11747 | 82 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
83 | if (PIDGIN_IS_PIDGIN_PLUGIN(plugin) && plugin->info->ui_info && |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
84 | PIDGIN_PLUGIN_UI_INFO(plugin)->get_config_frame) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
85 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
86 | return TRUE; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
87 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
88 | |
|
35689
1e257009ac10
Fix Pidgin clang scan-build warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
89 | if (!plugin->info) |
|
1e257009ac10
Fix Pidgin clang scan-build warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
90 | return FALSE; |
|
1e257009ac10
Fix Pidgin clang scan-build warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
91 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
92 | pinfo = plugin->info->prefs_info; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
93 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
94 | if (!pinfo) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
95 | return FALSE; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
96 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
97 | return (pinfo->get_plugin_pref_frame || pinfo->get_plugin_pref_request); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
98 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
99 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
100 | static GtkWidget * |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
101 | 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
|
102 | PurplePluginPrefFrame **purple_pref_frame) |
| 5205 | 103 | { |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
104 | GtkWidget *config = NULL; |
| 5205 | 105 | |
| 106 | g_return_val_if_fail(plugin != NULL, NULL); | |
| 107 | ||
|
15692
ecda27df58b9
Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents:
15577
diff
changeset
|
108 | if (PIDGIN_IS_PIDGIN_PLUGIN(plugin) && plugin->info->ui_info |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
109 | && PIDGIN_PLUGIN_UI_INFO(plugin)->get_config_frame) |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
110 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
111 | PidginPluginUiInfo *ui_info; |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
112 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
113 | ui_info = PIDGIN_PLUGIN_UI_INFO(plugin); |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
114 | |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
115 | config = ui_info->get_config_frame(plugin); |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
116 | } |
| 5205 | 117 | |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
118 | if (config == NULL && plugin->info->prefs_info |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
119 | && plugin->info->prefs_info->get_plugin_pref_frame) |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
120 | { |
| 15884 | 121 | PurplePluginPrefFrame *frame; |
| 5205 | 122 | |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
123 | frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin); |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
124 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
125 | config = pidgin_plugin_pref_create_frame(frame); |
| 12870 | 126 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
127 | *purple_pref_frame = frame; |
|
11817
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
128 | } |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
129 | |
|
b8622a510778
[gaim-migrate @ 14108]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11813
diff
changeset
|
130 | return config; |
| 5205 | 131 | } |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
132 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
133 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
134 | 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
|
135 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
136 | 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
|
137 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
138 | 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
|
139 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
140 | ui_data = plugin->ui_data; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
141 | 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
|
142 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
143 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
144 | 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
|
145 | 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
|
146 | 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
|
147 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
148 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
149 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
150 | 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
|
151 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
152 | 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
|
153 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
154 | 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
|
155 | 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
|
156 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
157 | 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
|
158 | plugin->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
|
159 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
160 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
161 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
162 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
163 | 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
|
164 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
165 | 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
|
166 | 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
|
167 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
168 | 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
|
169 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
170 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
171 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
172 | static void |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
173 | 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
|
174 | { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
175 | PurplePluginUiInfo *pinfo; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
176 | 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
|
177 | gboolean has_purple_frame, has_purple_request, has_pidgin_frame; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
178 | 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
|
179 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
180 | 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
|
181 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
182 | 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
|
183 | 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
|
184 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
185 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
186 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
187 | if (plugin->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
|
188 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
189 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
190 | pinfo = plugin->info->prefs_info; |
|
34480
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
191 | if (pinfo == NULL) |
|
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
192 | has_purple_frame = has_purple_request = FALSE; |
|
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
193 | else { |
|
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
194 | has_purple_frame = (pinfo->get_plugin_pref_frame != NULL); |
|
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
195 | has_purple_request = (pinfo->get_plugin_pref_request != NULL); |
|
26e7a3057f0c
Plugins API: fix a crash
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34479
diff
changeset
|
196 | } |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
197 | has_pidgin_frame = (PIDGIN_IS_PIDGIN_PLUGIN(plugin) && |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
198 | plugin->info->ui_info && |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
199 | PIDGIN_PLUGIN_UI_INFO(plugin)->get_config_frame); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
200 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
201 | 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
|
202 | if (has_purple_frame) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
203 | prefs_count++; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
204 | if (has_purple_request) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
205 | prefs_count++; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
206 | if (has_pidgin_frame) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
207 | prefs_count++; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
208 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
209 | 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
|
210 | 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
|
211 | " one prefs callback, some will be ignored.", |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
212 | plugin->info->name); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
213 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
214 | 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
|
215 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
216 | plugin->ui_data = ui_data = g_new0(PidginPluginUiData, 1); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
217 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
218 | /* 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
|
219 | * 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
|
220 | */ |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
221 | if (has_purple_request && !has_pidgin_frame) { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
222 | 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
|
223 | 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
|
224 | pinfo->get_plugin_pref_request(plugin); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
225 | 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
|
226 | purple_callback_set_zero, &plugin->ui_data); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
227 | 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
|
228 | 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
|
229 | } else { |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
230 | 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
|
231 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
232 | 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
|
233 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
234 | 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
|
235 | &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
|
236 | 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
|
237 | 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
|
238 | "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
|
239 | 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
|
240 | plugin->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
|
241 | return; |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
242 | } |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
243 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
244 | 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
|
245 | 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
|
246 | 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
|
247 | 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
|
248 | |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | 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
|
253 | 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
|
254 | gtk_window_set_title(GTK_WINDOW(dialog), |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
255 | _(purple_plugin_get_name(plugin))); |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
256 | 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
|
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 | |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
260 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
261 | pidgin_plugins_save(void) |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
262 | { |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15931
diff
changeset
|
263 | purple_plugins_save_loaded(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
|
5981
c91ece01ad12
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
264 | } |
| 11740 | 265 | |
| 266 | static void | |
| 267 | update_plugin_list(void *data) | |
| 268 | { | |
| 269 | GtkListStore *ls = GTK_LIST_STORE(data); | |
| 270 | GtkTreeIter iter; | |
| 271 | GList *probes; | |
| 15884 | 272 | PurplePlugin *plug; |
| 11740 | 273 | |
| 274 | gtk_list_store_clear(ls); | |
| 15884 | 275 | purple_plugins_probe(G_MODULE_SUFFIX); |
| 11740 | 276 | |
| 15884 | 277 | for (probes = purple_plugins_get_all(); |
| 11740 | 278 | probes != NULL; |
| 279 | probes = probes->next) | |
| 280 | { | |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
281 | char *name; |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
282 | char *version; |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
283 | char *summary; |
| 11740 | 284 | char *desc; |
| 285 | plug = probes->data; | |
| 286 | ||
| 15884 | 287 | if (plug->info->type == PURPLE_PLUGIN_LOADER) { |
|
15336
a2454071e986
[gaim-migrate @ 18064]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15177
diff
changeset
|
288 | GList *cur; |
| 15884 | 289 | for (cur = PURPLE_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL; |
|
15336
a2454071e986
[gaim-migrate @ 18064]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15177
diff
changeset
|
290 | cur = cur->next) |
| 15884 | 291 | purple_plugins_probe(cur->data); |
|
15336
a2454071e986
[gaim-migrate @ 18064]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15177
diff
changeset
|
292 | continue; |
| 15884 | 293 | } else if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
| 294 | (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE)) { | |
| 11740 | 295 | continue; |
| 296 | } | |
| 297 | ||
| 298 | gtk_list_store_append (ls, &iter); | |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
299 | |
|
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
|
300 | if (plug->info->name) { |
|
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
|
301 | name = g_markup_escape_text(_(plug->info->name), -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
|
302 | } else { |
|
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
|
303 | char *tmp = g_path_get_basename(plug->path); |
|
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
|
304 | 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
|
305 | 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
|
306 | } |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
307 | version = g_markup_escape_text(purple_plugin_get_version(plug), -1); |
|
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
308 | summary = g_markup_escape_text(purple_plugin_get_summary(plug), -1); |
|
12702
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
309 | |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
310 | desc = g_strdup_printf("<b>%s</b> %s\n%s", name, |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
311 | version, |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
312 | summary); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
313 | g_free(name); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
314 | g_free(version); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
315 | g_free(summary); |
|
fbd3bef47358
[gaim-migrate @ 15045]
Richard Laager <rlaager@pidgin.im>
parents:
12695
diff
changeset
|
316 | |
| 11740 | 317 | gtk_list_store_set(ls, &iter, |
| 15884 | 318 | 0, purple_plugin_is_loaded(plug), |
| 11740 | 319 | 1, desc, |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
320 | 2, plug, |
| 15884 | 321 | 3, purple_plugin_is_unloadable(plug), |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
322 | -1); |
| 11740 | 323 | g_free(desc); |
| 324 | } | |
| 325 | } | |
| 326 | ||
| 15884 | 327 | 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
|
328 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
329 | GtkTreeIter iter; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
330 | GtkTreeModel *model = gtk_tree_view_get_model(view); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
331 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
332 | if (gtk_tree_model_get_iter_first(model, &iter)) { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
333 | do { |
| 15884 | 334 | PurplePlugin *plug; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
335 | GtkTreeSelection *sel; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
336 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
337 | gtk_tree_model_get(model, &iter, 2, &plug, -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
338 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
339 | if (plug != plugin) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
340 | continue; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
341 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
342 | 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
|
343 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
344 | /* If the loaded/unloaded plugin is the selected row, |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
345 | * update the pref_button. */ |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
346 | sel = gtk_tree_view_get_selection(view); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
347 | if (gtk_tree_selection_get_selected(sel, &model, &iter)) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
348 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
349 | gtk_tree_model_get(model, &iter, 2, &plug, -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
350 | if (plug == plugin) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
351 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
352 | 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
|
353 | pidgin_plugin_has_prefs(plug)); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
354 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
355 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
356 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
357 | break; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
358 | } while (gtk_tree_model_iter_next(model, &iter)); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
359 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
360 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
361 | |
| 15884 | 362 | static void plugin_load_cb(PurplePlugin *plugin, gpointer data) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
363 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
364 | GtkTreeView *view = (GtkTreeView *)data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
365 | plugin_loading_common(plugin, view, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
366 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
367 | |
| 15884 | 368 | static void plugin_unload_cb(PurplePlugin *plugin, gpointer data) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
369 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
370 | GtkTreeView *view = (GtkTreeView *)data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
371 | plugin_loading_common(plugin, view, FALSE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
372 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
373 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
374 | static void plugin_unload_confirm_cb(gpointer *data) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
375 | { |
| 15884 | 376 | PurplePlugin *plugin = (PurplePlugin *)data[0]; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
377 | GtkTreeModel *model = (GtkTreeModel *)data[1]; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
378 | GtkTreeIter *iter = (GtkTreeIter *)data[2]; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
379 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
380 | plugin_toggled_stage_two(plugin, model, iter, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
381 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
382 | g_free(data); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
383 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
384 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
385 | static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
| 11740 | 386 | { |
| 387 | GtkTreeModel *model = (GtkTreeModel *)data; | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
388 | GtkTreeIter *iter = g_new(GtkTreeIter, 1); |
| 11740 | 389 | GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
| 15884 | 390 | PurplePlugin *plug; |
| 11740 | 391 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
392 | gtk_tree_model_get_iter(model, iter, path); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
393 | gtk_tree_path_free(path); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
394 | gtk_tree_model_get(model, iter, 2, &plug, -1); |
| 11740 | 395 | |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
396 | /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */ |
| 15884 | 397 | if (purple_plugin_is_unloadable(plug)) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
398 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
399 | g_free(iter); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
400 | return; |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
401 | } |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
402 | |
| 15884 | 403 | if (!purple_plugin_is_loaded(plug)) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
404 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
405 | pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
406 | |
| 15884 | 407 | purple_plugin_load(plug); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
408 | plugin_toggled_stage_two(plug, model, iter, FALSE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
409 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
410 | pidgin_clear_cursor(plugin_dialog); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
411 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
412 | else |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
413 | { |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
414 | pref_dialog_close(plug); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
415 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
416 | if (plug->dependent_plugins != NULL) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
417 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
418 | GString *tmp = g_string_new(_("The following plugins will be unloaded.")); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
419 | GList *l; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
420 | gpointer *cb_data; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
421 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
422 | for (l = plug->dependent_plugins ; l != NULL ; l = l->next) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
423 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
424 | const char *dep_name = (const char *)l->data; |
| 15884 | 425 | PurplePlugin *dep_plugin = purple_plugins_find_with_id(dep_name); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
426 | g_return_if_fail(dep_plugin != NULL); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
427 | |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
428 | g_string_append_printf(tmp, "\n\t%s\n", purple_plugin_get_name(dep_plugin)); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
429 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
430 | |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
431 | cb_data = g_new(gpointer, 3); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
432 | cb_data[0] = plug; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
433 | cb_data[1] = model; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
434 | cb_data[2] = iter; |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
435 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
436 | 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
|
437 | _("Multiple plugins will be unloaded."), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
438 | 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
|
439 | _("Unload Plugins"), |
|
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
33271
diff
changeset
|
440 | 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
|
441 | _("Cancel"), g_free); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
442 | g_string_free(tmp, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
443 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
444 | else |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
445 | plugin_toggled_stage_two(plug, model, iter, TRUE); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
446 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
447 | } |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
448 | |
| 15884 | 449 | static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload) |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
450 | { |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
451 | if (unload) |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
452 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
453 | pidgin_set_cursor(plugin_dialog, GDK_WATCH); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
454 | |
|
20872
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
455 | if (!purple_plugin_unload(plug)) |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
456 | { |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
457 | 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
|
458 | 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
|
459 | |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
460 | if (!plug->error) |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
461 | { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
462 | purple_notify_warning(NULL, NULL, primary, reload, NULL); |
|
20872
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
463 | } |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
464 | else |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
465 | { |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
466 | char *tmp = g_strdup_printf("%s\n\n%s", reload, plug->error); |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
467 | purple_notify_warning(NULL, NULL, primary, tmp, NULL); |
|
20872
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
468 | g_free(tmp); |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
469 | } |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
470 | |
|
fc317689cfef
Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@pidgin.im>
parents:
20147
diff
changeset
|
471 | 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
|
472 | } |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
473 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
474 | pidgin_clear_cursor(plugin_dialog); |
| 11781 | 475 | } |
| 11740 | 476 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
477 | gtk_widget_set_sensitive(pref_button, pidgin_plugin_has_prefs(plug)); |
| 11740 | 478 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
479 | if (plug->error != NULL) |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
480 | { |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
481 | gchar *name = g_markup_escape_text(purple_plugin_get_name(plug), -1); |
| 11781 | 482 | |
| 11740 | 483 | gchar *error = g_markup_escape_text(plug->error, -1); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
484 | gchar *text; |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
485 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
486 | text = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
487 | "<b>%s</b> %s\n<span weight=\"bold\" color=\"red\"%s</span>", |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
488 | purple_plugin_get_name(plug), purple_plugin_get_version(plug), error); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
489 | 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
|
490 | 1, text, |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
491 | -1); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
492 | g_free(text); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
493 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
494 | text = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
495 | "<span weight=\"bold\" color=\"red\">%s</span>", |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
496 | error); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
497 | 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
|
498 | g_free(text); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
499 | |
| 11740 | 500 | g_free(error); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
501 | g_free(name); |
| 11740 | 502 | } |
| 503 | ||
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
504 | gtk_list_store_set(GTK_LIST_STORE (model), iter, |
| 15884 | 505 | 0, purple_plugin_is_loaded(plug), |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
506 | -1); |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
507 | g_free(iter); |
| 11740 | 508 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
509 | pidgin_plugins_save(); |
| 11740 | 510 | } |
| 511 | ||
| 11877 | 512 | static gboolean ensure_plugin_visible(void *data) |
| 513 | { | |
| 514 | GtkTreeSelection *sel = GTK_TREE_SELECTION(data); | |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
515 | GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel); |
| 11877 | 516 | GtkTreeModel *model = gtk_tree_view_get_model(tv); |
| 517 | GtkTreePath *path; | |
| 518 | GtkTreeIter iter; | |
| 519 | if (!gtk_tree_selection_get_selected (sel, &model, &iter)) | |
| 520 | return FALSE; | |
| 521 | path = gtk_tree_model_get_path(model, &iter); | |
| 522 | gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0); | |
| 523 | gtk_tree_path_free(path); | |
| 524 | return FALSE; | |
| 525 | } | |
| 526 | ||
| 11740 | 527 | static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
| 528 | { | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
529 | gchar *buf, *tmp, *name, *version; |
| 11740 | 530 | GtkTreeIter iter; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
531 | GValue val; |
| 15884 | 532 | PurplePlugin *plug; |
| 11740 | 533 | |
|
11833
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
534 | if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
535 | { |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
536 | gtk_widget_set_sensitive(pref_button, FALSE); |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
537 | |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
538 | /* Collapse and disable the expander widget */ |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
539 | gtk_expander_set_expanded(GTK_EXPANDER(expander), FALSE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
540 | gtk_widget_set_sensitive(expander, FALSE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
541 | |
| 11740 | 542 | return; |
|
11833
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
543 | } |
|
119ea75db24b
[gaim-migrate @ 14124]
Mark Doliner <markdoliner@pidgin.im>
parents:
11817
diff
changeset
|
544 | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
545 | gtk_widget_set_sensitive(expander, TRUE); |
|
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
546 | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
547 | val.g_type = 0; |
| 11740 | 548 | gtk_tree_model_get_value (model, &iter, 2, &val); |
| 549 | plug = g_value_get_pointer(&val); | |
| 550 | ||
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
551 | name = g_markup_escape_text(purple_plugin_get_name(plug), -1); |
|
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
552 | version = g_markup_escape_text(purple_plugin_get_version(plug), -1); |
| 11740 | 553 | buf = g_strdup_printf( |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
554 | "<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
|
555 | "<span size=\"smaller\">%s</span>", |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
556 | name, version); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
557 | gtk_label_set_markup(plugin_name, buf); |
|
23180
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
558 | g_free(name); |
|
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
559 | g_free(version); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
560 | g_free(buf); |
| 11740 | 561 | |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
562 | gtk_text_buffer_set_text(plugin_desc, purple_plugin_get_description(plug), -1); |
|
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
563 | gtk_label_set_text(plugin_author, purple_plugin_get_author(plug)); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
564 | gtk_label_set_text(plugin_filename, plug->path); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
565 | |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
566 | g_free(plugin_website_uri); |
|
23100
013db96dd9a7
Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22788
diff
changeset
|
567 | plugin_website_uri = g_strdup(purple_plugin_get_homepage(plug)); |
|
22785
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
568 | 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
|
569 | { |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
570 | 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
|
571 | 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
|
572 | "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
|
573 | 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
|
574 | 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
|
575 | 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
|
576 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
577 | else |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
578 | { |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
579 | 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
|
580 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
581 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
582 | if (plug->error == NULL) |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
583 | { |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
584 | 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
|
585 | } |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
586 | else |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
587 | { |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
588 | tmp = g_markup_escape_text(plug->error, -1); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
589 | buf = g_strdup_printf( |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
590 | _("<span foreground=\"red\" weight=\"bold\">" |
|
12705
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
591 | "Error: %s\n" |
|
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
592 | "Check the plugin website for an update." |
|
7780ec726bdb
[gaim-migrate @ 15048]
Richard Laager <rlaager@pidgin.im>
parents:
12702
diff
changeset
|
593 | "</span>"), |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
594 | tmp); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
595 | gtk_label_set_markup(plugin_error, buf); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
596 | g_free(buf); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
597 | g_free(tmp); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
598 | } |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
599 | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
600 | 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
|
601 | |
| 11877 | 602 | /* Make sure the selected plugin is still visible */ |
| 603 | g_idle_add(ensure_plugin_visible, sel); | |
| 604 | ||
| 11740 | 605 | g_value_unset(&val); |
| 606 | } | |
| 607 | ||
| 11741 | 608 | static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel) |
| 11740 | 609 | { |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
610 | PurplePlugin *plugin; |
| 11740 | 611 | GtkTreeModel *model; |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
612 | GValue val; |
| 11740 | 613 | GtkTreeIter iter; |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
614 | GList *it; |
| 11740 | 615 | |
| 616 | switch (response) { | |
| 617 | case GTK_RESPONSE_CLOSE: | |
| 618 | case GTK_RESPONSE_DELETE_EVENT: | |
| 15884 | 619 | purple_request_close_with_handle(plugin_dialog); |
| 620 | purple_signals_disconnect_by_handle(plugin_dialog); | |
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
621 | for (it = purple_plugins_get_all(); it; it = g_list_next(it)) |
|
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
622 | pref_dialog_close(it->data); |
| 11740 | 623 | gtk_widget_destroy(d); |
| 624 | plugin_dialog = NULL; | |
| 625 | break; | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
626 | case PIDGIN_RESPONSE_CONFIGURE: |
| 11740 | 627 | if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
| 628 | return; | |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
629 | val.g_type = 0; |
|
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12343
diff
changeset
|
630 | 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
|
631 | 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
|
632 | 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
|
633 | if (plugin == NULL) |
| 11740 | 634 | break; |
| 635 | ||
|
34479
7d4651f1035e
Plugins API: add an option to provide plugin configuration using Request API
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34477
diff
changeset
|
636 | pidgin_plugin_open_config(plugin, GTK_WINDOW(d)); |
| 11781 | 637 | |
| 11740 | 638 | break; |
| 639 | } | |
| 640 | } | |
| 641 | ||
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
642 | static void |
|
13718
f29249a2856c
[gaim-migrate @ 16125]
Richard Laager <rlaager@pidgin.im>
parents:
13436
diff
changeset
|
643 | 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
|
644 | { |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
645 | GtkTreeSelection *sel; |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
646 | GtkTreeIter iter; |
| 15884 | 647 | PurplePlugin *plugin; |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
648 | GtkTreeModel *model; |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
649 | |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
650 | sel = gtk_tree_view_get_selection(view); |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
651 | |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
652 | if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
653 | return; |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
654 | |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
655 | gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
656 | |
| 15884 | 657 | if (!purple_plugin_is_loaded(plugin)) |
|
12174
3b0b53e84591
[gaim-migrate @ 14476]
Richard Laager <rlaager@pidgin.im>
parents:
12162
diff
changeset
|
658 | return; |
|
3b0b53e84591
[gaim-migrate @ 14476]
Richard Laager <rlaager@pidgin.im>
parents:
12162
diff
changeset
|
659 | |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
660 | /* Now show the pref-dialog for the plugin */ |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15692
diff
changeset
|
661 | plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel); |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
662 | } |
|
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
663 | |
|
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
|
664 | static gboolean |
|
33161
c248c062f272
Pass the cairo context to the tooltip paint function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33158
diff
changeset
|
665 | 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
|
666 | { |
|
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
|
667 | 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
|
668 | #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
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | #else |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
673 | 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
|
674 | NULL, tipwindow, "tooltip", |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
675 | 6, 6, layout); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33168
diff
changeset
|
676 | #endif |
|
32422
c215bc5d85e4
Whitespace fixes. Try and check your editor settings before writing
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32410
diff
changeset
|
677 | 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
|
678 | } |
|
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
|
679 | |
|
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
|
680 | 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
|
681 | 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
|
682 | 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
|
683 | { |
|
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
|
684 | 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
|
685 | 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
|
686 | PurplePlugin *plugin = 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
|
687 | 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
|
688 | 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
|
689 | int 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
|
690 | char *markup, *name, *desc, *author; |
|
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
|
691 | |
|
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
|
692 | 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
|
693 | 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
|
694 | |
|
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
|
695 | gtk_tree_model_get(model, &iter, 2, &plugin, -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
|
696 | |
|
22533
7e1e39d5db7e
Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22065
diff
changeset
|
697 | markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s", |
|
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
|
698 | name = g_markup_escape_text(purple_plugin_get_name(plugin), -1), |
|
22533
7e1e39d5db7e
Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22065
diff
changeset
|
699 | _("Description"), desc = g_markup_escape_text(purple_plugin_get_description(plugin), -1), |
|
7e1e39d5db7e
Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22065
diff
changeset
|
700 | _("Author"), author = g_markup_escape_text(purple_plugin_get_author(plugin), -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
|
701 | |
|
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
|
702 | 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
|
703 | 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
|
704 | 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
|
705 | 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
|
706 | 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
|
707 | 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
|
708 | |
|
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
|
709 | 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
|
710 | *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
|
711 | 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
|
712 | *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
|
713 | |
|
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
|
714 | 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
|
715 | 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
|
716 | g_free(desc); |
|
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
|
717 | g_free(author); |
|
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
|
718 | |
|
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
|
719 | 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
|
720 | } |
|
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
|
721 | |
|
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
|
722 | 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
|
723 | 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
|
724 | 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
|
725 | { |
|
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
|
726 | 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
|
727 | 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
|
728 | 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
|
729 | } |
|
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
|
730 | 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
|
731 | } |
|
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
|
732 | |
|
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
|
733 | 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
|
734 | 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
|
735 | 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
|
736 | { |
|
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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | } |
|
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
|
741 | 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
|
742 | } |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
743 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
744 | static GtkWidget * |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
745 | create_details() |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
746 | { |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
747 | GtkBox *vbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 3)); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
748 | 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
|
749 | GtkWidget *label, *view, *website_button; |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
750 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
751 | 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
|
752 | 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
|
753 | 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
|
754 | 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
|
755 | 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
|
756 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
757 | view = gtk_text_view_new(); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
758 | 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
|
759 | 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
|
760 | "editable", FALSE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
761 | "left-margin", PIDGIN_HIG_CAT_SPACE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
762 | "right-margin", PIDGIN_HIG_CAT_SPACE, |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
763 | NULL); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
764 | 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
|
765 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
766 | 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
|
767 | 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
|
768 | 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
|
769 | 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
|
770 | 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
|
771 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
772 | plugin_author = GTK_LABEL(gtk_label_new(NULL)); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
773 | gtk_label_set_line_wrap(plugin_author, FALSE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
774 | gtk_misc_set_alignment(GTK_MISC(plugin_author), 0, 0); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
775 | gtk_label_set_selectable(plugin_author, TRUE); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
776 | 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
|
777 | GTK_WIDGET(plugin_author), TRUE, &label); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
778 | 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
|
779 | 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
|
780 | |
|
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
|
781 | 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
|
782 | 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
|
783 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
784 | 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
|
785 | 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
|
786 | "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
787 | 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
|
788 | 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
|
789 | 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
|
790 | 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
|
791 | 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
|
792 | 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
|
793 | 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
|
794 | 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
|
795 | 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
|
796 | |
|
d712839ebf36
Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <resiak@pidgin.im>
parents:
22781
diff
changeset
|
797 | 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
|
798 | 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
|
799 | 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
|
800 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
801 | 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
|
802 | 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
|
803 | 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
|
804 | 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
|
805 | 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
|
806 | GTK_WIDGET(plugin_filename), TRUE, &label); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
807 | 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
|
808 | 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
|
809 | |
|
23180
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
810 | g_object_unref(sg); |
|
5d6a0a35837f
applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <datallah@pidgin.im>
parents:
23100
diff
changeset
|
811 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
812 | return GTK_WIDGET(vbox); |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
813 | } |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
814 | |
|
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
815 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
816 | void pidgin_plugin_dialog_show() |
| 11740 | 817 | { |
| 818 | GtkWidget *event_view; | |
| 819 | GtkListStore *ls; | |
| 820 | GtkCellRenderer *rend, *rendt; | |
| 821 | GtkTreeViewColumn *col; | |
| 822 | GtkTreeSelection *sel; | |
| 823 | ||
| 824 | if (plugin_dialog != NULL) { | |
| 825 | gtk_window_present(GTK_WINDOW(plugin_dialog)); | |
| 826 | return; | |
| 827 | } | |
| 828 | ||
|
33168
f51e53d27b99
Fix a minor warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33161
diff
changeset
|
829 | plugin_dialog = gtk_dialog_new(); |
|
f51e53d27b99
Fix a minor warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33161
diff
changeset
|
830 | gtk_window_set_title(GTK_WINDOW(plugin_dialog), _("Plugins")); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
831 | 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
|
832 | _("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
833 | gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
|
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
834 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); |
| 11813 | 835 | gtk_widget_set_sensitive(pref_button, FALSE); |
| 11747 | 836 | gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins"); |
| 11740 | 837 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
838 | ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN); |
| 11740 | 839 | gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
| 840 | 1, GTK_SORT_ASCENDING); | |
| 841 | ||
| 842 | update_plugin_list(ls); | |
| 11813 | 843 | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
844 | event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); |
| 11740 | 845 | |
| 14359 | 846 | gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(event_view), TRUE); |
| 847 | ||
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
848 | g_signal_connect(G_OBJECT(event_view), "row-activated", |
|
13718
f29249a2856c
[gaim-migrate @ 16125]
Richard Laager <rlaager@pidgin.im>
parents:
13436
diff
changeset
|
849 | G_CALLBACK(show_plugin_prefs_cb), plugin_dialog); |
|
12162
449845a545ab
[gaim-migrate @ 14463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12066
diff
changeset
|
850 | |
| 15884 | 851 | purple_signal_connect(purple_plugins_get_handle(), "plugin-load", plugin_dialog, |
| 852 | PURPLE_CALLBACK(plugin_load_cb), event_view); | |
| 853 | purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", plugin_dialog, | |
| 854 | PURPLE_CALLBACK(plugin_unload_cb), event_view); | |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
855 | |
| 11740 | 856 | rend = gtk_cell_renderer_toggle_new(); |
| 857 | sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
| 858 | ||
| 859 | col = gtk_tree_view_column_new_with_attributes (_("Enabled"), | |
| 860 | rend, | |
| 861 | "active", 0, | |
| 862 | NULL); | |
| 863 | 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
|
864 | gtk_tree_view_column_set_sort_column_id(col, 0); |
|
12927
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
865 | g_signal_connect(G_OBJECT(rend), "toggled", |
|
f3e4ef8958a3
[gaim-migrate @ 15280]
Richard Laager <rlaager@pidgin.im>
parents:
12889
diff
changeset
|
866 | G_CALLBACK(plugin_toggled), ls); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
867 | |
| 11740 | 868 | rendt = gtk_cell_renderer_text_new(); |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
869 | g_object_set(rendt, |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
870 | "foreground", "#c0c0c0", |
|
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
871 | NULL); |
| 11740 | 872 | col = gtk_tree_view_column_new_with_attributes (_("Name"), |
| 873 | rendt, | |
| 874 | "markup", 1, | |
|
12695
0c93a42b7ee2
[gaim-migrate @ 15038]
Richard Laager <rlaager@pidgin.im>
parents:
12600
diff
changeset
|
875 | "foreground-set", 3, |
| 11740 | 876 | NULL); |
| 877 | gtk_tree_view_column_set_expand (col, TRUE); | |
| 878 | g_object_set(rendt, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |
| 879 | 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
|
880 | gtk_tree_view_column_set_sort_column_id(col, 1); |
| 11740 | 881 | g_object_unref(G_OBJECT(ls)); |
|
33158
ad941796372e
Remove some added trailing spaces.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33133
diff
changeset
|
882 | 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
|
883 | 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
|
884 | TRUE, TRUE, 0); |
|
15177
8b6c66e09388
[gaim-migrate @ 17901]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14359
diff
changeset
|
885 | 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
|
886 | 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
|
887 | pidgin_tree_view_search_equal_func, NULL, NULL); |
|
12246
7af1ef3b1cc4
[gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents:
12240
diff
changeset
|
888 | |
|
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
|
889 | 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
|
890 | 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
|
891 | 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
|
892 | |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
893 | |
| 11740 | 894 | expander = gtk_expander_new(_("<b>Plugin Details</b>")); |
| 895 | gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); | |
|
12343
0ede7c5a9465
[gaim-migrate @ 14647]
Mark Doliner <markdoliner@pidgin.im>
parents:
12290
diff
changeset
|
896 | 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
|
897 | 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
|
898 | 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
|
899 | expander, FALSE, FALSE, 0); |
|
22781
c85c7a3609dc
Improve the layout of the plugin description pane.
Will Thompson <resiak@pidgin.im>
parents:
22608
diff
changeset
|
900 | |
| 11740 | 901 | |
| 902 | g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); | |
| 903 | 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
|
904 | 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
|
905 | |
|
30785
9c4ea3886ce5
Remove an unnecessary cast. Get's rid of this compile warning:
Mark Doliner <markdoliner@pidgin.im>
parents:
30760
diff
changeset
|
906 | pidgin_auto_parent_window(plugin_dialog); |
|
30760
7b0121a454cd
Auto-parent the Plugins dialog.
Gabriel Schulhof <nix@go-nix.ca>
parents:
29500
diff
changeset
|
907 | |
| 11740 | 908 | gtk_widget_show_all(plugin_dialog); |
| 909 | } |