pidgin/pidginpluginsdialog.c

Wed, 07 Oct 2020 01:14:43 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Wed, 07 Oct 2020 01:14:43 -0500
changeset 40544
a144fe8ec06f
parent 40502
875489636847
child 40736
c2b876aa4c03
permissions
-rw-r--r--

Remove PurplePluginInfo->ui_data.

Testing Done:
Compile.

Reviewed at https://reviews.imfreedom.org/r/147/

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"
40496
6941fece679b phase2 of pidgin.h: move existing file to pidgincore.h
Gary Kramlich <grim@reaperworld.com>
parents: 40225
diff changeset
34 #include "pidgincore.h"
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
35
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 struct _PidginPluginsDialog {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 GtkDialog parent;
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
39 GtkWidget *tree_view;
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
40 GtkWidget *configure_plugin_button;
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 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
42 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
43
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
44 GtkListStore *plugin_store;
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 };
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
47 /* 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
48 typedef struct
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
49 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
50 enum
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
51 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
52 PIDGIN_PLUGIN_UI_DATA_TYPE_FRAME,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
53 PIDGIN_PLUGIN_UI_DATA_TYPE_REQUEST
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
54 } type;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
55
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
56 union
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
57 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
58 struct
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
59 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
60 GtkWidget *dialog;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
61 PurplePluginPrefFrame *pref_frame;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
62 } frame;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
63
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
64 gpointer request_handle;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
65 } u;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
66 } PidginPluginUiData;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
67
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 * Helpers
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 *****************************************************************************/
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
71 static gboolean
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
72 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
73 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
74 PurplePluginInfo *info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
75 GPluginPluginState state;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
76
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
77 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
78
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
79 state = gplugin_plugin_get_state(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
80
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
81 if (state != GPLUGIN_PLUGIN_STATE_LOADED) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
82 return FALSE;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
83 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
84
40224
6b658d1458c8 Fix a handful of issues found in review
Gary Kramlich <grim@reaperworld.com>
parents: 40222
diff changeset
85 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
86 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
87 }
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
88
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
89 static GPluginPlugin *
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
90 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
91 GPluginPlugin *plugin = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
92 GtkTreeSelection *selection = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
93 GtkTreeModel *model = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
94 GtkTreeIter iter;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
95
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
96 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
97
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
98 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
99 /* 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
100 if(selection == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
101 return NULL;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
104 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
105 gtk_tree_model_get(model, &iter,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
106 GPLUGIN_GTK_STORE_PLUGIN_COLUMN, &plugin,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
107 -1);
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
110 return plugin;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
113 static void
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
114 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
115 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
116 PurplePluginInfo *info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
117 PidginPluginUiData *ui_data;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
118
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
119 ui_data = g_object_get_data(G_OBJECT(info), "pidgin-ui-data");
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
120 if (ui_data == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
121 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
122 return;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
125 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
126 purple_request_close(PURPLE_REQUEST_FIELDS,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
127 ui_data->u.request_handle);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
128 return;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
131 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
132
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
133 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
134
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
135 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
136 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
137 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
138
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
139 g_object_set_data(G_OBJECT(info), "pidgin-ui-data", NULL);
40222
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
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
188 pidgin_plugins_dialog_request_close_cb(PurplePluginInfo *info)
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
189 {
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
190 g_object_set_data(G_OBJECT(info), "pidgin-ui-data", NULL);
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
191 }
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
192
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
193 static void
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
194 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
195 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
196 PidginPluginUiData *ui_data;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
197 PurplePluginInfo *info;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
198 PurplePluginPrefFrameCb pref_frame_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
199 PurplePluginPrefRequestCb pref_request_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
200 GPluginPlugin *plugin = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
201 GPluginPluginInfo *ginfo = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
202 gint prefs_count;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
203
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
204 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
205 if(!GPLUGIN_IS_PLUGIN(plugin)) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
206 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
207 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
208
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
209 ginfo = gplugin_plugin_get_info(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
210 info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
211
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
212 if (g_object_get_data(G_OBJECT(info), "pidgin-ui-data")) {
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
213 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
214 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
215 }
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 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
218 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
219
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
220 ui_data = g_new0(PidginPluginUiData, 1);
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
221 g_object_set_data_full(G_OBJECT(info), "pidgin-ui-data", ui_data, g_free);
40222
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 prefs_count = 0;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
224 if (pref_frame_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
225 prefs_count++;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
226
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
227 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
228 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
229
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
230 if (pref_request_cb) {
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
231 prefs_count++;
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
232 }
40222
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 if (prefs_count > 1) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
235 purple_debug_warning("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
236 "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
237 "callback, some will be ignored.",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
238 gplugin_plugin_info_get_name(ginfo));
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 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
241
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
242
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
243 /* 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
244 * 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
245 */
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
246 if (pref_request_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
247 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
248 ui_data->u.request_handle = pref_request_cb(plugin);
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
249 purple_request_add_close_notify(
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
250 ui_data->u.request_handle,
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
251 (GDestroyNotify)pidgin_plugins_dialog_request_close_cb, info);
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
252 } else {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
253 GtkWidget *box, *pdialog, *content, *sw;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
254
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
255 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
256
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
257 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
258 if (box == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
259 purple_debug_error("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
260 "Failed to display prefs frame");
40544
a144fe8ec06f Remove PurplePluginInfo->ui_data.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40502
diff changeset
261 g_object_set_data(G_OBJECT(info), "pidgin-ui-data", NULL);
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
262 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
263 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
264 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
265 gtk_widget_set_vexpand(box, TRUE);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
266
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
267 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
268 PIDGIN_ALERT_TITLE, GTK_WINDOW(dialog),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
269 GTK_DIALOG_DESTROY_WITH_PARENT,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
270 _("Close"), GTK_RESPONSE_CLOSE,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
271 NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
272
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
273 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
274 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
275
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
276 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
277
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
278 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
279 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
280 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
281 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
282 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
283 GTK_SHADOW_IN);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
284 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
285
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
286 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
287
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
288 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
289 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
290 _(gplugin_plugin_info_get_name(
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
291 GPLUGIN_PLUGIN_INFO(info))));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
292 gtk_widget_show_all(pdialog);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
293 }
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
294 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
295 }
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
296
40216
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 * GObject Implementation
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 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
301
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 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
304 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
305
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 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
307 widget_class,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308 "/im/pidgin/Pidgin/Plugins/dialog.ui"
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 );
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
311 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
312 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
313 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
314 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
315 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
316
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
317 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
318 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
319 }
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 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 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
324
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 /* wire up the close button */
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 g_signal_connect(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 dialog->close_button,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 "clicked",
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 G_CALLBACK(pidgin_plugins_dialog_close),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 dialog
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 );
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
332
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
333 /* 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
334 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
335 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
336 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
337 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
338 );
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 GtkWidget *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 pidgin_plugins_dialog_new(void) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 return g_object_new(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 PIDGIN_TYPE_PLUGINS_DIALOG,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345 "title", _("Plugins"),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 NULL
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 );
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349

mercurial