pidgin/pidginpluginsdialog.c

Sat, 22 Aug 2020 04:02:53 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sat, 22 Aug 2020 04:02:53 -0500
changeset 40518
d587dad11411
parent 40502
875489636847
child 40544
a144fe8ec06f
permissions
-rw-r--r--

Remove purple_chat_user_[sg]et_ui_data.

Remove `purple_chat_user_[gs]et_ui_data`.
Remove `deleting-chat-user` signal. It's unused now, and just a substitute for a finalization notification.

Testing Done:
Compile only.

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

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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
119 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
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
139 g_free(ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
140 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
141 }
40216
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 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 * Callbacks
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 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
148 gtk_widget_destroy(GTK_WIDGET(data));
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
151 static void
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
152 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
153 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
154 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
155 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
156 GtkTreeIter iter;
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
157
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
158 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
159 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
160 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
161 -1);
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
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_set_plugin(
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
165 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
166 plugin
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
167 );
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
168
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
169 gtk_widget_set_sensitive(
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
170 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
171 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
172 );
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
173
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
174 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
175 }
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
176
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
177 static void
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
178 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
179 gpointer data)
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
180 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
181 if (response == GTK_RESPONSE_CLOSE ||
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
182 response == GTK_RESPONSE_DELETE_EVENT)
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
183 {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
184 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
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
188 static void
40220
1af60f2ac6b6 Wire up the rest of the dialog to stubs
Gary Kramlich <grim@reaperworld.com>
parents: 40218
diff changeset
189 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
190 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
191 PidginPluginUiData *ui_data;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
192 PurplePluginInfo *info;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
193 PurplePluginPrefFrameCb pref_frame_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
194 PurplePluginPrefRequestCb pref_request_cb;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
195 GPluginPlugin *plugin = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
196 GPluginPluginInfo *ginfo = NULL;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
197 gint prefs_count;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
198
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
199 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
200 if(!GPLUGIN_IS_PLUGIN(plugin)) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
201 return;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
204 ginfo = gplugin_plugin_get_info(plugin);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
205 info = PURPLE_PLUGIN_INFO(ginfo);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
206
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
207 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
208 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
209 return;
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
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
212 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
213 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
214
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
215 ui_data = g_new0(PidginPluginUiData, 1);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
216 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
217
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
218 prefs_count = 0;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
219 if (pref_frame_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
220 prefs_count++;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
221
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
222 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
223 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
224
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
225 if (pref_request_cb) {
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
226 prefs_count++;
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
227 }
40222
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 if (prefs_count > 1) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
230 purple_debug_warning("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
231 "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
232 "callback, some will be ignored.",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
233 gplugin_plugin_info_get_name(ginfo));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
234 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
235 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
236
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
237
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
238 /* 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
239 * 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
240 */
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
241 if (pref_request_cb) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
242 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
243 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
244 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
245 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
246 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
247 g_free, ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
248 } else {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
249 GtkWidget *box, *pdialog, *content, *sw;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
250
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
251 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
252
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
253 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
254 if (box == NULL) {
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
255 purple_debug_error("gtkplugin",
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
256 "Failed to display prefs frame");
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
257 g_free(ui_data);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
258 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
259 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
260 return;
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
261 }
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
262 gtk_widget_set_vexpand(box, TRUE);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
263
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
264 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
265 PIDGIN_ALERT_TITLE, GTK_WINDOW(dialog),
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
266 GTK_DIALOG_DESTROY_WITH_PARENT,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
267 _("Close"), GTK_RESPONSE_CLOSE,
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
268 NULL);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
269
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
270 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
271 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
272
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
273 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
274
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
275 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
276 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
277 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
278 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
279 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
280 GTK_SHADOW_IN);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
281 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
282
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
283 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
284
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
285 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
286 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
287 _(gplugin_plugin_info_get_name(
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
288 GPLUGIN_PLUGIN_INFO(info))));
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
289 gtk_widget_show_all(pdialog);
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
290 }
40225
b6f1592a07ec Clean up some reference counting, doc comments and a build tweak
Gary Kramlich <grim@reaperworld.com>
parents: 40224
diff changeset
291 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
292 }
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
293
40216
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 /******************************************************************************
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 * GObject Implementation
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 *****************************************************************************/
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 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
298
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 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
301 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
302
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 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
304 widget_class,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 "/im/pidgin/Pidgin/Plugins/dialog.ui"
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 );
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307
40222
40f2888f85c1 delete gtkplugin.[ch] and deal with the repercussions
Gary Kramlich <grim@reaperworld.com>
parents: 40220
diff changeset
308 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
309 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
310 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
311 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
312 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
313
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_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
315 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
316 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 static void
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 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
321
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 /* wire up the close button */
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 g_signal_connect(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 dialog->close_button,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 "clicked",
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 G_CALLBACK(pidgin_plugins_dialog_close),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 dialog
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 );
40218
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
329
8f2da2bb2e1b Get the new plugin dialog working. Needs a bit of cleanup yet
Gary Kramlich <grim@reaperworld.com>
parents: 40216
diff changeset
330 /* 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
331 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
332 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
333 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
334 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
335 );
40216
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
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 GtkWidget *
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 pidgin_plugins_dialog_new(void) {
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 return g_object_new(
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 PIDGIN_TYPE_PLUGINS_DIALOG,
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 "title", _("Plugins"),
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 NULL
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 }
bf78d5476c6a initial start of moving the plugins dialog to glade
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346

mercurial