pidgin/pidginpluginsdialog.c

Wed, 05 Feb 2020 02:01:25 -0600

author
Koosha Khajehmoogahi <koosha@posteo.de>
date
Wed, 05 Feb 2020 02:01:25 -0600
changeset 40288
b72d9137eca7
parent 40225
b6f1592a07ec
child 40496
6941fece679b
permissions
-rw-r--r--

Fix whitespace

Signed-off-by: Richard Laager <rlaager@pidgin.im>

40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * pidgin
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include "pidginpluginsdialog.h"
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include <glib/gi18n.h>
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
28 #include <gplugin.h>
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
29 #include <gplugin-gtk.h>
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
30
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
31 #include <purple.h>
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
32
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
33 #include "gtkpluginpref.h"
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
34
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 struct _PidginPluginsDialog {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 GtkDialog parent;
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
38 GtkWidget *tree_view;
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
39 GtkWidget *configure_plugin_button;
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 GtkWidget *close_button;
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
41 GtkWidget *plugin_info;
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
42
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
43 GtkListStore *plugin_store;
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 };
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
46 /* this has a short life left to it... */
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
47 typedef struct
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
48 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
49 enum
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
50 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
51 PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
52 PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
53 } type;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
54
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
55 union
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
56 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
57 struct
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
58 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
59 GtkWidget *dialog;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
60 PurplePluginPrefFrame *pref_frame;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
61 } frame;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
62
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
63 gpointer request_handle;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
64 } u;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
65 } PidginPluginUiData;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
66
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 * Helpers
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 *****************************************************************************/
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
70 static gboolean
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
71 pidgin_plugins_dialog_plugin_has_config(GPluginPlugin *plugin) {
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
72 GPluginPluginInfo *ginfo = gplugin_plugin_get_info(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
73 PurplePluginInfo *info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
74 GPluginPluginState state;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
75
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
76 g_return_val_if_fail(GPLUGIN_IS_PLUGIN(plugin), FALSE);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
77
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
78 state = gplugin_plugin_get_state(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
79
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
80 if (state != GPLUGIN_PLUGIN_STATE_LOADED) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
81 return FALSE;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
82 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
83
40224
6b658d1458c8 Fix a handful of issues found in review
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
84 return (purple_plugin_info_get_pref_frame_cb(info) ||
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
85 purple_plugin_info_get_pref_request_cb(info));
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
86 }
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
87
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
88 static GPluginPlugin *
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
89 pidgin_plugins_dialog_get_selected(PidginPluginsDialog *dialog) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
90 GPluginPlugin *plugin = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
91 GtkTreeSelection *selection = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
92 GtkTreeModel *model = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
93 GtkTreeIter iter;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
94
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
95 g_return_val_if_fail(PIDGIN_IS_PLUGINS_DIALOG(dialog), NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
96
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
97 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->tree_view));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
98 /* not sure if this is necessary, but playing defense. - grim 20191112 */
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
99 if(selection == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
100 return NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
101 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
102
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
103 if(gtk_tree_selection_get_selected(selection, &model, &iter)) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
104 gtk_tree_model_get(model, &iter,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
105 GPLUGIN_GTK_STORE_PLUGIN_COLUMN, &plugin,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
106 -1);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
107 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
108
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
109 return plugin;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
110 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
111
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
112 static void
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
113 pidgin_plugins_dialog_pref_dialog_close(GPluginPlugin *plugin) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
114 GPluginPluginInfo *ginfo = gplugin_plugin_get_info(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
115 PurplePluginInfo *info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
116 PidginPluginUiData *ui_data;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
117
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
118 ui_data = purple_plugin_info_get_ui_data(info);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
119 if (ui_data == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
120 purple_debug_info("PidginPluginsDialog", "failed to find uidata\n");
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
121 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
122 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
123
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
124 if (ui_data->type == PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
125 purple_request_close(PURPLE_REQUEST_FIELDS,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
126 ui_data->u.request_handle);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
127 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
128 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
129
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
130 g_return_if_fail(ui_data->type == PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
131
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
132 gtk_widget_destroy(ui_data->u.frame.dialog);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
133
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
134 if (ui_data->u.frame.pref_frame) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
135 purple_plugin_pref_frame_destroy(ui_data->u.frame.pref_frame);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
136 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
137
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
138 g_free(ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
139 purple_plugin_info_set_ui_data(info, NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
140 }
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 * Callbacks
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 pidgin_plugins_dialog_close(GtkWidget *b, gpointer data) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 gtk_widget_destroy(GTK_WIDGET(data));
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
150 static void
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
151 pidgin_plugins_dialog_selection_cb(GtkTreeSelection *sel, gpointer data) {
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
152 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data);
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
153 GPluginPlugin *plugin = NULL;
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
154 GtkTreeModel *model = NULL;
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
155 GtkTreeIter iter;
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
156
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
157 if(gtk_tree_selection_get_selected(sel, &model, &iter)) {
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
158 gtk_tree_model_get(model, &iter,
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
159 GPLUGIN_GTK_STORE_PLUGIN_COLUMN, &plugin,
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
160 -1);
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
161 }
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
162
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
163 gplugin_gtk_plugin_info_set_plugin(
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
164 GPLUGIN_GTK_PLUGIN_INFO(dialog->plugin_info),
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
165 plugin
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
166 );
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
167
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
168 gtk_widget_set_sensitive(
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
169 GTK_WIDGET(dialog->configure_plugin_button),
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
170 pidgin_plugins_dialog_plugin_has_config(plugin)
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
171 );
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
172
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
173 g_object_unref(G_OBJECT(plugin));
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
174 }
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
175
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
176 static void
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
177 pidgin_plugins_dialog_pref_dialog_response_cb(GtkWidget *dialog, int response,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
178 gpointer data)
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
179 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
180 if (response == GTK_RESPONSE_CLOSE ||
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
181 response == GTK_RESPONSE_DELETE_EVENT)
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
182 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
183 pidgin_plugins_dialog_pref_dialog_close(GPLUGIN_PLUGIN(data));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
184 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
185 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
186
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
187 static void
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
188 pidgin_plugins_dialog_config_plugin_cb(GtkWidget *button, gpointer data) {
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
189 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
190 PidginPluginUiData *ui_data;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
191 PurplePluginInfo *info;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
192 PurplePluginPrefFrameCb pref_frame_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
193 PurplePluginPrefRequestCb pref_request_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
194 GPluginPlugin *plugin = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
195 GPluginPluginInfo *ginfo = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
196 gint prefs_count;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
197
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
198 plugin = pidgin_plugins_dialog_get_selected(dialog);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
199 if(!GPLUGIN_IS_PLUGIN(plugin)) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
200 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
201 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
202
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
203 ginfo = gplugin_plugin_get_info(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
204 info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
205
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
206 if(purple_plugin_info_get_ui_data(info)) {
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
207 g_object_unref(G_OBJECT(plugin));
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
208 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
209 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
210
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
211 pref_frame_cb = purple_plugin_info_get_pref_frame_cb(info);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
212 pref_request_cb = purple_plugin_info_get_pref_request_cb(info);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
213
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
214 ui_data = g_new0(PidginPluginUiData, 1);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
215 purple_plugin_info_set_ui_data(info, ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
216
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
217 prefs_count = 0;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
218 if (pref_frame_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
219 prefs_count++;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
220
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
221 ui_data->u.frame.pref_frame = pref_frame_cb(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
222 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
223
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
224 if (pref_request_cb) {
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
225 prefs_count++;
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
226 }
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
227
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
228 if (prefs_count > 1) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
229 purple_debug_warning("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
230 "Plugin %s contains more than one prefs "
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
231 "callback, some will be ignored.",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
232 gplugin_plugin_info_get_name(ginfo));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
233 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
234 g_return_if_fail(prefs_count > 0);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
235
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
236
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
237 /* Priority: pidgin frame > purple request > purple frame
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
238 * Purple frame could be replaced with purple request some day.
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
239 */
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
240 if (pref_request_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
241 ui_data->type = PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
242 ui_data->u.request_handle = pref_request_cb(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
243 purple_request_add_close_notify(ui_data->u.request_handle,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
244 purple_callback_set_zero, &info->ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
245 purple_request_add_close_notify(ui_data->u.request_handle,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
246 g_free, ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
247 } else {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
248 GtkWidget *box, *pdialog, *content, *sw;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
249
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
250 ui_data->type = PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
251
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
252 box = pidgin_plugin_pref_create_frame(ui_data->u.frame.pref_frame);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
253 if (box == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
254 purple_debug_error("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
255 "Failed to display prefs frame");
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
256 g_free(ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
257 purple_plugin_info_set_ui_data(info, NULL);
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
258 g_object_unref(G_OBJECT(plugin));
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
259 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
260 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
261 gtk_widget_set_vexpand(box, TRUE);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
262
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
263 ui_data->u.frame.dialog = pdialog = gtk_dialog_new_with_buttons(
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
264 PIDGIN_ALERT_TITLE, GTK_WINDOW(dialog),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
265 GTK_DIALOG_DESTROY_WITH_PARENT,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
266 _("Close"), GTK_RESPONSE_CLOSE,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
267 NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
268
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
269 g_signal_connect(G_OBJECT(pdialog), "response",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
270 G_CALLBACK(pidgin_plugins_dialog_pref_dialog_response_cb), plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
271
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
272 content = gtk_dialog_get_content_area(GTK_DIALOG(pdialog));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
273
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
274 sw = gtk_scrolled_window_new(NULL, NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
275 gtk_container_add(GTK_CONTAINER(content), sw);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
276 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
277 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
278 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
279 GTK_SHADOW_IN);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
280 gtk_widget_set_size_request(sw, 400, 400);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
281
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
282 gtk_container_add(GTK_CONTAINER(sw), box);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
283
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
284 gtk_window_set_role(GTK_WINDOW(pdialog), "plugin_config");
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
285 gtk_window_set_title(GTK_WINDOW(pdialog),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
286 _(gplugin_plugin_info_get_name(
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
287 GPLUGIN_PLUGIN_INFO(info))));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
288 gtk_widget_show_all(pdialog);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
289 }
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
290 g_object_unref(G_OBJECT(plugin));
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
291 }
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
292
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 * GObject Implementation
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 G_DEFINE_TYPE(PidginPluginsDialog, pidgin_plugins_dialog, GTK_TYPE_DIALOG);
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 pidgin_plugins_dialog_class_init(PidginPluginsDialogClass *klass) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 gtk_widget_class_set_template_from_resource(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 widget_class,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 "/im/pidgin/Pidgin/Plugins/dialog.ui"
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 );
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
307 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, tree_view);
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
308 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, configure_plugin_button);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, close_button);
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
310 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_info);
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
311 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_store);
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
312
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
313 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_selection_cb);
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
314 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_config_plugin_cb);
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 gtk_widget_init_template(GTK_WIDGET(dialog));
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 /* wire up the close button */
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 g_signal_connect(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 dialog->close_button,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 "clicked",
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 G_CALLBACK(pidgin_plugins_dialog_close),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 dialog
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 );
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
328
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
329 /* set the sort column for the plugin_store */
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
330 gtk_tree_sortable_set_sort_column_id(
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
331 GTK_TREE_SORTABLE(dialog->plugin_store),
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
332 GPLUGIN_GTK_STORE_MARKUP_COLUMN,
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
333 GTK_SORT_ASCENDING
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
334 );
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 GtkWidget *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 pidgin_plugins_dialog_new(void) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 return g_object_new(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 PIDGIN_TYPE_PLUGINS_DIALOG,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 "title", _("Plugins"),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 NULL
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 );
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345

mercurial