annotate pidgin/gtkplugin.c @ 29871:6d2ba42595fe

oscar: Fix a race condition that leads to a crash. With SSL enabled, if we start connecting and something calls purple_account_disconnect between when an SSL flap connection is started and when the connection is actually established, it isn't properly cleaned up (and we try to close the flap), which leads to free-after-use. You can simulate this by adding a timeout-triggered disconnect to the end of oscar_connect_to_bos. [02/22/10 17:11:51] <libpurple/oscar> Destroying oscar connection of type 0x0002. Disconnect reason is 0 [02/22/10 17:11:51] <libpurple/oscar> Disconnected. Code is 0x0000 and msg is (hiicq:17126): GLib-WARNING **: giounix.c:400Error while getting flags for FD: Bad file descriptor (9) [02/22/10 17:11:51] <libpurple/oscar> Scheduling destruction of FLAP connection of type 0x0002 [02/22/10 17:11:51] <libpurple/oscar> Signed off. ... [02/22/10 17:11:51] <libpurple/oscar> Destroying oscar connection of type 0x7261. Disconnect reason is 1668179315
author Paul Aurich <paul@darkrain42.org>
date Mon, 22 Feb 2010 17:53:38 +0000
parents 48ea900ee72a
children c8a5c09df242
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gtkplugin.c GTK+ Plugins support
16193
247e421c4fa6 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@wiktel.com>
parents: 16062
diff changeset
3 * @ingroup pidgin
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19680
diff changeset
6 /* pidgin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15871
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15823
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19567
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "internal.h"
15514
535f002e7b0f More pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15501
diff changeset
27 #include "pidgin.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "gtkplugin.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "gtkpluginpref.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "gtkutils.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "prefs.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "request.h"
21946
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
34 #include "pidgintooltip.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include <string.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
15820
c02a897a67c7 More Gaim to Pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
38 #define PIDGIN_RESPONSE_CONFIGURE 98121
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
40 static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 GtkTreeIter *iter, gboolean unload);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 static GtkWidget *expander = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 static GtkWidget *plugin_dialog = NULL;
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
45
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
46 static GtkLabel *plugin_name = NULL;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
47 static GtkTextBuffer *plugin_desc = NULL;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
48 static GtkLabel *plugin_error = NULL;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
49 static GtkLabel *plugin_author = NULL;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
50 static GtkLabel *plugin_website = NULL;
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
51 static gchar *plugin_website_uri = NULL;
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
52 static GtkLabel *plugin_filename = NULL;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
53
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 static GtkWidget *pref_button = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 static GHashTable *plugin_pref_dialogs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 GtkWidget *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
58 pidgin_plugin_get_config_frame(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 GtkWidget *config = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62 g_return_val_if_fail(plugin != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15514
diff changeset
64 if (PIDGIN_IS_PIDGIN_PLUGIN(plugin) && plugin->info->ui_info
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
65 && PIDGIN_PLUGIN_UI_INFO(plugin)->get_config_frame)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
67 PidginPluginUiInfo *ui_info;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
69 ui_info = PIDGIN_PLUGIN_UI_INFO(plugin);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 config = ui_info->get_config_frame(plugin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 if (plugin->info->prefs_info
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 && plugin->info->prefs_info->get_plugin_pref_frame)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
76 purple_debug_warning("gtkplugin",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 "Plugin %s contains both, ui_info and "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 "prefs_info preferences; prefs_info will be "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 "ignored.", plugin->info->name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 if (config == NULL && plugin->info->prefs_info
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 && plugin->info->prefs_info->get_plugin_pref_frame)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
86 PurplePluginPrefFrame *frame;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
90 config = pidgin_plugin_pref_create_frame(frame);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
22460
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
92 plugin->info->prefs_info->frame = frame;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 return config;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 void
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
99 pidgin_plugins_save(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 {
16062
07554cc5d090 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents: 15871
diff changeset
101 purple_plugins_save_loaded(PIDGIN_PREFS_ROOT "/plugins/loaded");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 update_plugin_list(void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 GtkListStore *ls = GTK_LIST_STORE(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 GList *probes;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
110 PurplePlugin *plug;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 gtk_list_store_clear(ls);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
113 purple_plugins_probe(G_MODULE_SUFFIX);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
115 for (probes = purple_plugins_get_all();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 probes != NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 probes = probes->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 char *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 char *version;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 char *summary;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 char *desc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 plug = probes->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
125 if (plug->info->type == PURPLE_PLUGIN_LOADER) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 GList *cur;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
127 for (cur = PURPLE_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 cur = cur->next)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
129 purple_plugins_probe(cur->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 continue;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
131 } else if (plug->info->type != PURPLE_PLUGIN_STANDARD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
132 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 gtk_list_store_append (ls, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
26594
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
138 if (plug->info->name) {
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
139 name = g_markup_escape_text(_(plug->info->name), -1);
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
140 } else {
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
141 char *tmp = g_path_get_basename(plug->path);
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
142 name = g_markup_escape_text(tmp, -1);
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
143 g_free(tmp);
865ed80b17e1 More Pidgin updates for GTK+ 3.0. Removes any deprecated functions for GLib
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23040
diff changeset
144 }
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
145 version = g_markup_escape_text(purple_plugin_get_version(plug), -1);
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
146 summary = g_markup_escape_text(purple_plugin_get_summary(plug), -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 desc = g_strdup_printf("<b>%s</b> %s\n%s", name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 version,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 summary);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 g_free(version);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 g_free(summary);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 gtk_list_store_set(ls, &iter,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
156 0, purple_plugin_is_loaded(plug),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 1, desc,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 2, plug,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
159 3, purple_plugin_is_unloadable(plug),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 g_free(desc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
165 static void plugin_loading_common(PurplePlugin *plugin, GtkTreeView *view, gboolean loaded)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 GtkTreeModel *model = gtk_tree_view_get_model(view);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 if (gtk_tree_model_get_iter_first(model, &iter)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 do {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
172 PurplePlugin *plug;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 gtk_tree_model_get(model, &iter, 2, &plug, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 if (plug != plugin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, loaded, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 /* If the loaded/unloaded plugin is the selected row,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 * update the pref_button. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 sel = gtk_tree_view_get_selection(view);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 if (gtk_tree_selection_get_selected(sel, &model, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 gtk_tree_model_get(model, &iter, 2, &plug, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 if (plug == plugin)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 gtk_widget_set_sensitive(pref_button,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 loaded
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15514
diff changeset
192 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
193 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 || (plug->info->prefs_info
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 && plug->info->prefs_info->get_plugin_pref_frame)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 } while (gtk_tree_model_iter_next(model, &iter));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
204 static void plugin_load_cb(PurplePlugin *plugin, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 GtkTreeView *view = (GtkTreeView *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 plugin_loading_common(plugin, view, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
210 static void plugin_unload_cb(PurplePlugin *plugin, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 GtkTreeView *view = (GtkTreeView *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 plugin_loading_common(plugin, view, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
216 static void pref_dialog_response_cb(GtkWidget *d, int response, PurplePlugin *plug)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 switch (response) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 case GTK_RESPONSE_DELETE_EVENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 g_hash_table_remove(plugin_pref_dialogs, plug);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 if (g_hash_table_size(plugin_pref_dialogs) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 g_hash_table_destroy(plugin_pref_dialogs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 plugin_pref_dialogs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 gtk_widget_destroy(d);
22460
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
227
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
228 if (plug->info->prefs_info && plug->info->prefs_info->frame) {
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
229 purple_plugin_pref_frame_destroy(plug->info->prefs_info->frame);
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
230 plug->info->prefs_info->frame = NULL;
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
231 }
f693749f82d2 Leak fix from SF bug #1407047 which actually had a patch attached (on 2006-01-17 !)
Stu Tomlinson <stu@nosnilmot.com>
parents: 22385
diff changeset
232
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 static void plugin_unload_confirm_cb(gpointer *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
239 PurplePlugin *plugin = (PurplePlugin *)data[0];
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 GtkTreeModel *model = (GtkTreeModel *)data[1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 GtkTreeIter *iter = (GtkTreeIter *)data[2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 plugin_toggled_stage_two(plugin, model, iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 g_free(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 GtkTreeModel *model = (GtkTreeModel *)data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 GtkTreeIter *iter = g_new(GtkTreeIter, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 GtkTreePath *path = gtk_tree_path_new_from_string(pth);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
253 PurplePlugin *plug;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 GtkWidget *dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 gtk_tree_model_get_iter(model, iter, path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 gtk_tree_model_get(model, iter, 2, &plug, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
261 if (purple_plugin_is_unloadable(plug))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 g_free(iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
267 if (!purple_plugin_is_loaded(plug))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
269 pidgin_set_cursor(plugin_dialog, GDK_WATCH);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
271 purple_plugin_load(plug);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 plugin_toggled_stage_two(plug, model, iter, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
274 pidgin_clear_cursor(plugin_dialog);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 if (plugin_pref_dialogs != NULL &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 (dialog = g_hash_table_lookup(plugin_pref_dialogs, plug)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 pref_dialog_response_cb(dialog, GTK_RESPONSE_DELETE_EVENT, plug);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 if (plug->dependent_plugins != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 GString *tmp = g_string_new(_("The following plugins will be unloaded."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 GList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 gpointer *cb_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 for (l = plug->dependent_plugins ; l != NULL ; l = l->next)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 const char *dep_name = (const char *)l->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
291 PurplePlugin *dep_plugin = purple_plugins_find_with_id(dep_name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 g_return_if_fail(dep_plugin != NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
294 g_string_append_printf(tmp, "\n\t%s\n", purple_plugin_get_name(dep_plugin));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 cb_data = g_new(gpointer, 3);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 cb_data[0] = plug;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 cb_data[1] = model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 cb_data[2] = iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
302 purple_request_action(plugin_dialog, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 _("Multiple plugins will be unloaded."),
16442
08db93bbd798 Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents: 16193
diff changeset
304 tmp->str, 0,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
305 NULL, NULL, NULL,
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
306 cb_data, 2,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 _("Unload Plugins"), G_CALLBACK(plugin_unload_confirm_cb),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 _("Cancel"), g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 g_string_free(tmp, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 plugin_toggled_stage_two(plug, model, iter, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
316 static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 if (unload)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 {
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
320 pidgin_set_cursor(plugin_dialog, GDK_WATCH);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321
21201
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
322 if (!purple_plugin_unload(plug))
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
323 {
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
324 const char *primary = _("Could not unload plugin");
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
325 const char *reload = _("The plugin could not be unloaded now, but will be disabled at the next startup.");
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
326
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
327 if (!plug->error)
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
328 {
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
329 purple_notify_warning(NULL, NULL, primary, reload);
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
330 }
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
331 else
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
332 {
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
333 char *tmp = g_strdup_printf("%s\n\n%s", reload, plug->error);
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
334 purple_notify_warning(NULL, NULL, primary, tmp);
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
335 g_free(tmp);
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
336 }
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
337
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
338 purple_plugin_disable(plug);
3695fbebc8bf Use the new purple_plugin_disable() function and purple_plugin_unload()'s
Richard Laager <rlaager@wiktel.com>
parents: 20074
diff changeset
339 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
341 pidgin_clear_cursor(plugin_dialog);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 gtk_widget_set_sensitive(pref_button,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
345 purple_plugin_is_loaded(plug)
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15514
diff changeset
346 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
347 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 || (plug->info->prefs_info
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 && plug->info->prefs_info->get_plugin_pref_frame)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
351 if (plug->error != NULL)
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
352 {
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
353 gchar *name = g_markup_escape_text(purple_plugin_get_name(plug), -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 gchar *error = g_markup_escape_text(plug->error, -1);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
356 gchar *text;
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
357
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
358 text = g_strdup_printf(
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
359 "<b>%s</b> %s\n<span weight=\"bold\" color=\"red\"%s</span>",
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
360 purple_plugin_get_name(plug), purple_plugin_get_version(plug), error);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 gtk_list_store_set(GTK_LIST_STORE (model), iter,
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
362 1, text,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 -1);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
364 g_free(text);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
365
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
366 text = g_strdup_printf(
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
367 "<span weight=\"bold\" color=\"red\">%s</span>",
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
368 error);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
369 gtk_label_set_markup(plugin_error, text);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
370 g_free(text);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
371
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 g_free(error);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
373 g_free(name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 gtk_list_store_set(GTK_LIST_STORE (model), iter,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
377 0, purple_plugin_is_loaded(plug),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 g_free(iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
381 pidgin_plugins_save();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 static gboolean ensure_plugin_visible(void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 GtkTreeSelection *sel = GTK_TREE_SELECTION(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 GtkTreeModel *model = gtk_tree_view_get_model(tv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 GtkTreePath *path;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 if (!gtk_tree_selection_get_selected (sel, &model, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 path = gtk_tree_model_get_path(model, &iter);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 gtk_tree_path_free(path);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 return FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 {
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
401 gchar *buf, *tmp, *name, *version;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 GValue val;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
404 PurplePlugin *plug;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406 if (!gtk_tree_selection_get_selected (sel, &model, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 gtk_widget_set_sensitive(pref_button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 /* Collapse and disable the expander widget */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 gtk_expander_set_expanded(GTK_EXPANDER(expander), FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 gtk_widget_set_sensitive(expander, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 gtk_widget_set_sensitive(expander, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 val.g_type = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 gtk_tree_model_get_value (model, &iter, 2, &val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 plug = g_value_get_pointer(&val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
423 name = g_markup_escape_text(purple_plugin_get_name(plug), -1);
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
424 version = g_markup_escape_text(purple_plugin_get_version(plug), -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 buf = g_strdup_printf(
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
426 "<span size=\"larger\" weight=\"bold\">%s</span> "
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
427 "<span size=\"smaller\">%s</span>",
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
428 name, version);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
429 gtk_label_set_markup(plugin_name, buf);
23040
4ead1ab25573 applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22939
diff changeset
430 g_free(name);
4ead1ab25573 applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22939
diff changeset
431 g_free(version);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
432 g_free(buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
434 gtk_text_buffer_set_text(plugin_desc, purple_plugin_get_description(plug), -1);
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
435 gtk_label_set_text(plugin_author, purple_plugin_get_author(plug));
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
436 gtk_label_set_text(plugin_filename, plug->path);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
437
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
438 g_free(plugin_website_uri);
22939
917bc972a141 Translate the description of the plugin in the plugins dialog. Thanks to
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22628
diff changeset
439 plugin_website_uri = g_strdup(purple_plugin_get_homepage(plug));
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
440 if (plugin_website_uri)
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
441 {
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
442 tmp = g_markup_escape_text(plugin_website_uri, -1);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
443 buf = g_strdup_printf("<span underline=\"single\" "
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
444 "foreground=\"blue\">%s</span>", tmp);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
445 gtk_label_set_markup(plugin_website, buf);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
446 g_free(tmp);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
447 g_free(buf);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
448 }
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
449 else
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
450 {
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
451 gtk_label_set_text(plugin_website, NULL);
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
452 }
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
453
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
454 if (plug->error == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 {
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
456 gtk_label_set_text(plugin_error, NULL);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
457 }
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
458 else
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
459 {
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
460 tmp = g_markup_escape_text(plug->error, -1);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
461 buf = g_strdup_printf(
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
462 _("<span foreground=\"red\" weight=\"bold\">"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 "Error: %s\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 "Check the plugin website for an update."
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 "</span>"),
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
466 tmp);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
467 gtk_label_set_markup(plugin_error, buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 g_free(buf);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
469 g_free(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 gtk_widget_set_sensitive(pref_button,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
473 purple_plugin_is_loaded(plug)
15632
a830f9756f23 Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15514
diff changeset
474 && ((PIDGIN_IS_PIDGIN_PLUGIN(plug) && plug->info->ui_info
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
475 && PIDGIN_PLUGIN_UI_INFO(plug)->get_config_frame)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 || (plug->info->prefs_info
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 && plug->info->prefs_info->get_plugin_pref_frame)));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 /* Make sure the selected plugin is still visible */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 g_idle_add(ensure_plugin_visible, sel);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 g_value_unset(&val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
487 PurplePlugin *plug;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 GtkWidget *dialog, *box;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 GValue val;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 GtkTreeIter iter;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 switch (response) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 case GTK_RESPONSE_CLOSE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 case GTK_RESPONSE_DELETE_EVENT:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
496 purple_request_close_with_handle(plugin_dialog);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
497 purple_signals_disconnect_by_handle(plugin_dialog);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 gtk_widget_destroy(d);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 if (plugin_pref_dialogs != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 g_hash_table_destroy(plugin_pref_dialogs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 plugin_pref_dialogs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 plugin_dialog = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 break;
15820
c02a897a67c7 More Gaim to Pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
505 case PIDGIN_RESPONSE_CONFIGURE:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 val.g_type = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 gtk_tree_model_get_value(model, &iter, 2, &val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 plug = g_value_get_pointer(&val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 if (plug == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 if (plugin_pref_dialogs != NULL &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 g_hash_table_lookup(plugin_pref_dialogs, plug))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 break;
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
516 box = pidgin_plugin_get_config_frame(plug);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 if (box == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519
15821
cebfc6af3eb5 More Gaim to Pidgin stuff
Sean Egan <seanegan@gmail.com>
parents: 15820
diff changeset
520 dialog = gtk_dialog_new_with_buttons(PIDGIN_ALERT_TITLE, GTK_WINDOW(d),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
522 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 if (plugin_pref_dialogs == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 plugin_pref_dialogs = g_hash_table_new(NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 g_hash_table_insert(plugin_pref_dialogs, plug, dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529 g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
532 gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plug)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 gtk_widget_show_all(dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 g_value_unset(&val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GtkWidget *dialog)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 GtkTreeIter iter;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
544 PurplePlugin *plugin;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 GtkTreeModel *model;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
547 sel = gtk_tree_view_get_selection(view);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 if (!gtk_tree_selection_get_selected(sel, &model, &iter))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 gtk_tree_model_get(model, &iter, 2, &plugin, -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
554 if (!purple_plugin_is_loaded(plugin))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 /* Now show the pref-dialog for the plugin */
15820
c02a897a67c7 More Gaim to Pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
558 plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560
21946
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
561 static gboolean
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
562 pidgin_plugins_paint_tooltip(GtkWidget *tipwindow, gpointer data)
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
563 {
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
564 PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin");
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
565 gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE,
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
566 NULL, tipwindow, "tooltip",
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
567 6, 6, layout);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
568 return TRUE;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
569 }
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
570
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
571 static gboolean
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
572 pidgin_plugins_create_tooltip(GtkWidget *tipwindow, GtkTreePath *path,
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
573 gpointer data, int *w, int *h)
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
574 {
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
575 GtkTreeIter iter;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
576 GtkTreeView *treeview = GTK_TREE_VIEW(data);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
577 PurplePlugin *plugin = NULL;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
578 GtkTreeModel *model = gtk_tree_view_get_model(treeview);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
579 PangoLayout *layout;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
580 int width, height;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
581 char *markup, *name, *desc, *author;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
582
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
583 if (!gtk_tree_model_get_iter(model, &iter, path))
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
584 return FALSE;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
585
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
586 gtk_tree_model_get(model, &iter, 2, &plugin, -1);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
587
22385
19f26913fe71 Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21946
diff changeset
588 markup = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>\n<b>%s:</b> %s\n<b>%s:</b> %s",
21946
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
589 name = g_markup_escape_text(purple_plugin_get_name(plugin), -1),
22385
19f26913fe71 Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21946
diff changeset
590 _("Description"), desc = g_markup_escape_text(purple_plugin_get_description(plugin), -1),
19f26913fe71 Allow translation/transliteration foo in the plugin window tooltip.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21946
diff changeset
591 _("Author"), author = g_markup_escape_text(purple_plugin_get_author(plugin), -1));
21946
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
592
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
593 layout = gtk_widget_create_pango_layout(tipwindow, NULL);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
594 pango_layout_set_markup(layout, markup, -1);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
595 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
596 pango_layout_set_width(layout, 600000);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
597 pango_layout_get_size(layout, &width, &height);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
598 g_object_set_data_full(G_OBJECT(tipwindow), "tooltip-plugin", layout, g_object_unref);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
599
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
600 if (w)
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
601 *w = PANGO_PIXELS(width) + 12;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
602 if (h)
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
603 *h = PANGO_PIXELS(height) + 12;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
604
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
605 g_free(markup);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
606 g_free(name);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
607 g_free(desc);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
608 g_free(author);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
609
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
610 return TRUE;
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
611 }
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
612
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
613 static gboolean
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
614 website_button_motion_cb(GtkWidget *button, GdkEventCrossing *event,
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
615 gpointer unused)
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
616 {
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
617 if (plugin_website_uri) {
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
618 pidgin_set_cursor(button, GDK_HAND2);
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
619 return TRUE;
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
620 }
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
621 return FALSE;
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
622 }
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
623
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
624 static gboolean
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
625 website_button_clicked_cb(GtkButton *button, GdkEventButton *event,
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
626 gpointer unused)
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
627 {
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
628 if (plugin_website_uri) {
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
629 purple_notify_uri(NULL, plugin_website_uri);
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
630 return TRUE;
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
631 }
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
632 return FALSE;
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
633 }
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
634
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
635 static GtkWidget *
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
636 create_details()
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
637 {
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
638 GtkBox *vbox = GTK_BOX(gtk_vbox_new(FALSE, 3));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
639 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
640 GtkWidget *label, *view, *website_button;
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
641
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
642 plugin_name = GTK_LABEL(gtk_label_new(NULL));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
643 gtk_misc_set_alignment(GTK_MISC(plugin_name), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
644 gtk_label_set_line_wrap(plugin_name, FALSE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
645 gtk_label_set_selectable(plugin_name, TRUE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
646 gtk_box_pack_start(vbox, GTK_WIDGET(plugin_name), FALSE, FALSE, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
647
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
648 view = gtk_text_view_new();
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
649 plugin_desc = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
650 g_object_set(view, "wrap-mode", GTK_WRAP_WORD,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
651 "editable", FALSE,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
652 "left-margin", PIDGIN_HIG_CAT_SPACE,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
653 "right-margin", PIDGIN_HIG_CAT_SPACE,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
654 NULL);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
655 gtk_box_pack_start(vbox, view, TRUE, TRUE, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
656
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
657 plugin_error = GTK_LABEL(gtk_label_new(NULL));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
658 gtk_misc_set_alignment(GTK_MISC(plugin_error), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
659 gtk_label_set_line_wrap(plugin_error, FALSE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
660 gtk_label_set_selectable(plugin_error, TRUE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
661 gtk_box_pack_start(vbox, GTK_WIDGET(plugin_error), FALSE, FALSE, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
662
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
663 plugin_author = GTK_LABEL(gtk_label_new(NULL));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
664 gtk_label_set_line_wrap(plugin_author, FALSE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
665 gtk_misc_set_alignment(GTK_MISC(plugin_author), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
666 gtk_label_set_selectable(plugin_author, TRUE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
667 pidgin_add_widget_to_vbox(vbox, "", sg,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
668 GTK_WIDGET(plugin_author), TRUE, &label);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
669 gtk_label_set_markup(GTK_LABEL(label), _("<b>Written by:</b>"));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
670 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
671
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
672 website_button = gtk_event_box_new();
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
673 gtk_event_box_set_visible_window(GTK_EVENT_BOX(website_button), FALSE);
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
674
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
675 plugin_website = GTK_LABEL(gtk_label_new(NULL));
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
676 g_object_set(G_OBJECT(plugin_website),
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
677 "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
678 gtk_misc_set_alignment(GTK_MISC(plugin_website), 0, 0);
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
679 gtk_container_add(GTK_CONTAINER(website_button),
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
680 GTK_WIDGET(plugin_website));
22628
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
681 g_signal_connect(website_button, "button-release-event",
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
682 G_CALLBACK(website_button_clicked_cb), NULL);
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
683 g_signal_connect(website_button, "enter-notify-event",
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
684 G_CALLBACK(website_button_motion_cb), NULL);
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
685 g_signal_connect(website_button, "leave-notify-event",
58b109b8a4e8 Use an event-box instead of a button for the link, and change the cursor
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22625
diff changeset
686 G_CALLBACK(pidgin_clear_cursor), NULL);
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
687
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
688 pidgin_add_widget_to_vbox(vbox, "", sg, website_button, TRUE, &label);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
689 gtk_label_set_markup(GTK_LABEL(label), _("<b>Web site:</b>"));
22625
5c8d236b50ee Make plugin website URLs clickable; it's a button with blue underlined text.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22621
diff changeset
690 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
691
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
692 plugin_filename = GTK_LABEL(gtk_label_new(NULL));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
693 gtk_label_set_line_wrap(plugin_filename, FALSE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
694 gtk_misc_set_alignment(GTK_MISC(plugin_filename), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
695 gtk_label_set_selectable(plugin_filename, TRUE);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
696 pidgin_add_widget_to_vbox(vbox, "", sg,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
697 GTK_WIDGET(plugin_filename), TRUE, &label);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
698 gtk_label_set_markup(GTK_LABEL(label), _("<b>Filename:</b>"));
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
699 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
700
23040
4ead1ab25573 applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22939
diff changeset
701 g_object_unref(sg);
4ead1ab25573 applied changes from 97a20dd56598fa5c690eabcbc8ec3ff6e560aefd
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22939
diff changeset
702
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
703 return GTK_WIDGET(vbox);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
704 }
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
705
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
706
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
707 void pidgin_plugin_dialog_show()
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 GtkWidget *sw;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 GtkWidget *event_view;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 GtkListStore *ls;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 GtkCellRenderer *rend, *rendt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 GtkTreeViewColumn *col;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 GtkTreeSelection *sel;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 if (plugin_dialog != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 gtk_window_present(GTK_WINDOW(plugin_dialog));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 GTK_DIALOG_NO_SEPARATOR,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
15820
c02a897a67c7 More Gaim to Pidgin changes
Sean Egan <seanegan@gmail.com>
parents: 15632
diff changeset
726 _("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 gtk_widget_set_sensitive(pref_button, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730 gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 sw = gtk_scrolled_window_new(NULL,NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), sw, TRUE, TRUE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 1, GTK_SORT_ASCENDING);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 update_plugin_list(ls);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744 event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(event_view), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 g_signal_connect(G_OBJECT(event_view), "row-activated",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 G_CALLBACK(show_plugin_prefs_cb), plugin_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
751 purple_signal_connect(purple_plugins_get_handle(), "plugin-load", plugin_dialog,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
752 PURPLE_CALLBACK(plugin_load_cb), event_view);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
753 purple_signal_connect(purple_plugins_get_handle(), "plugin-unload", plugin_dialog,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15821
diff changeset
754 PURPLE_CALLBACK(plugin_unload_cb), event_view);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
756 rend = gtk_cell_renderer_toggle_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
757 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
758
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 col = gtk_tree_view_column_new_with_attributes (_("Enabled"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 rend,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 "active", 0,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 gtk_tree_view_column_set_sort_column_id(col, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 g_signal_connect(G_OBJECT(rend), "toggled",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766 G_CALLBACK(plugin_toggled), ls);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
767
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
768 rendt = gtk_cell_renderer_text_new();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
769 g_object_set(rendt,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
770 "foreground", "#c0c0c0",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772 col = gtk_tree_view_column_new_with_attributes (_("Name"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
773 rendt,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 "markup", 1,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
775 "foreground-set", 3,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
777 gtk_tree_view_column_set_expand (col, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 g_object_set(rendt, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
779 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 gtk_tree_view_column_set_sort_column_id(col, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
781 g_object_unref(G_OBJECT(ls));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782 gtk_container_add(GTK_CONTAINER(sw), event_view);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 gtk_tree_view_set_search_column(GTK_TREE_VIEW(event_view), 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
784 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(event_view),
15501
d75099d2567e gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
785 pidgin_tree_view_search_equal_func, NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
786
21946
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
787 pidgin_tooltip_setup_for_treeview(event_view, event_view,
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
788 pidgin_plugins_create_tooltip,
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
789 pidgin_plugins_paint_tooltip);
ddd53c9174bc Add tooltips to the plugin window. I did it mostly to test the new tooltip
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21354
diff changeset
790
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
791
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
792 expander = gtk_expander_new(_("<b>Plugin Details</b>"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 gtk_widget_set_sensitive(expander, FALSE);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
795 gtk_container_add(GTK_CONTAINER(expander), create_details());
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
796 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), expander,
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
797 FALSE, FALSE, 0);
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
798
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 g_signal_connect(G_OBJECT(plugin_dialog), "response", G_CALLBACK(plugin_dialog_response_cb), sel);
22621
efc232f1822b Improve the layout of the plugin description pane.
Will Thompson <will.thompson@collabora.co.uk>
parents: 22460
diff changeset
802 gtk_window_set_default_size(GTK_WINDOW(plugin_dialog), 430, 530);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 gtk_widget_show_all(plugin_dialog);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 }