| 141 |
140 |
| 142 /****************************************************************************** |
141 /****************************************************************************** |
| 143 * Callbacks |
142 * Callbacks |
| 144 *****************************************************************************/ |
143 *****************************************************************************/ |
| 145 static void |
144 static void |
| 146 pidgin_plugins_dialog_close(GtkWidget *b, gpointer data) { |
|
| 147 gtk_widget_destroy(GTK_WIDGET(data)); |
|
| 148 } |
|
| 149 |
|
| 150 static void |
|
| 151 pidgin_plugins_dialog_selection_cb(GtkTreeSelection *sel, gpointer data) { |
145 pidgin_plugins_dialog_selection_cb(GtkTreeSelection *sel, gpointer data) { |
| 152 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data); |
146 PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data); |
| 153 GPluginPlugin *plugin = NULL; |
147 GPluginPlugin *plugin = NULL; |
| 154 GtkTreeModel *model = NULL; |
148 GtkTreeModel *model = NULL; |
| 155 GtkTreeIter iter; |
149 GtkTreeIter iter; |
| 163 gplugin_gtk_plugin_info_set_plugin( |
157 gplugin_gtk_plugin_info_set_plugin( |
| 164 GPLUGIN_GTK_PLUGIN_INFO(dialog->plugin_info), |
158 GPLUGIN_GTK_PLUGIN_INFO(dialog->plugin_info), |
| 165 plugin |
159 plugin |
| 166 ); |
160 ); |
| 167 |
161 |
| 168 gtk_widget_set_sensitive( |
162 if(GPLUGIN_IS_PLUGIN(plugin)) { |
| 169 GTK_WIDGET(dialog->configure_plugin_button), |
163 gtk_widget_set_sensitive( |
| 170 pidgin_plugins_dialog_plugin_has_config(plugin) |
164 GTK_WIDGET(dialog->configure_plugin_button), |
| 171 ); |
165 pidgin_plugins_dialog_plugin_has_config(plugin) |
| 172 |
166 ); |
| 173 g_object_unref(G_OBJECT(plugin)); |
167 |
| |
168 g_object_unref(G_OBJECT(plugin)); |
| |
169 } |
| 174 } |
170 } |
| 175 |
171 |
| 176 static void |
172 static void |
| 177 pidgin_plugins_dialog_pref_dialog_response_cb(GtkWidget *dialog, int response, |
173 pidgin_plugins_dialog_pref_dialog_response_cb(GtkWidget *dialog, int response, |
| 178 gpointer data) |
174 gpointer data) |
| 308 "/im/pidgin/Pidgin/Plugins/dialog.ui" |
304 "/im/pidgin/Pidgin/Plugins/dialog.ui" |
| 309 ); |
305 ); |
| 310 |
306 |
| 311 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, tree_view); |
307 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, tree_view); |
| 312 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, configure_plugin_button); |
308 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, configure_plugin_button); |
| 313 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, close_button); |
|
| 314 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_info); |
309 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_info); |
| 315 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_store); |
310 gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_store); |
| 316 |
311 |
| 317 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_selection_cb); |
312 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_selection_cb); |
| 318 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_config_plugin_cb); |
313 gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_config_plugin_cb); |
| 319 } |
314 } |
| 320 |
315 |
| 321 static void |
316 static void |
| 322 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) { |
317 pidgin_plugins_dialog_init(PidginPluginsDialog *dialog) { |
| 323 gtk_widget_init_template(GTK_WIDGET(dialog)); |
318 gtk_widget_init_template(GTK_WIDGET(dialog)); |
| 324 |
|
| 325 /* wire up the close button */ |
|
| 326 g_signal_connect( |
|
| 327 dialog->close_button, |
|
| 328 "clicked", |
|
| 329 G_CALLBACK(pidgin_plugins_dialog_close), |
|
| 330 dialog |
|
| 331 ); |
|
| 332 |
319 |
| 333 /* set the sort column for the plugin_store */ |
320 /* set the sort column for the plugin_store */ |
| 334 gtk_tree_sortable_set_sort_column_id( |
321 gtk_tree_sortable_set_sort_column_id( |
| 335 GTK_TREE_SORTABLE(dialog->plugin_store), |
322 GTK_TREE_SORTABLE(dialog->plugin_store), |
| 336 GPLUGIN_GTK_STORE_MARKUP_COLUMN, |
323 GPLUGIN_GTK_STORE_MARKUP_COLUMN, |
| 337 GTK_SORT_ASCENDING |
324 GTK_SORT_ASCENDING |
| 338 ); |
325 ); |
| 339 } |
326 } |
| 340 |
327 |
| |
328 /****************************************************************************** |
| |
329 * Public API |
| |
330 *****************************************************************************/ |
| 341 GtkWidget * |
331 GtkWidget * |
| 342 pidgin_plugins_dialog_new(void) { |
332 pidgin_plugins_dialog_new(void) { |
| 343 return g_object_new( |
333 return GTK_WIDGET(g_object_new(PIDGIN_TYPE_PLUGINS_DIALOG, NULL)); |
| 344 PIDGIN_TYPE_PLUGINS_DIALOG, |
334 } |
| 345 "title", _("Plugins"), |
335 |
| 346 NULL |
|
| 347 ); |
|
| 348 } |
|
| 349 |
|