pidgin/pidgin

8f2da2bb2e1b
Parents ca648c0e192d
Children 006fdc542235
Get the new plugin dialog working. Needs a bit of cleanup yet
--- a/pidgin/pidginpluginsdialog.c Fri Nov 01 00:37:38 2019 -0500
+++ b/pidgin/pidginpluginsdialog.c Fri Nov 01 00:38:08 2019 -0500
@@ -25,10 +25,16 @@
#include <glib/gi18n.h>
+#include <gplugin.h>
+#include <gplugin-gtk.h>
+
struct _PidginPluginsDialog {
GtkDialog parent;
GtkWidget *close_button;
+ GtkWidget *plugin_info;
+
+ GtkListStore *plugin_store;
};
/******************************************************************************
@@ -43,6 +49,25 @@
gtk_widget_destroy(GTK_WIDGET(data));
}
+static void
+pidgin_plugins_dialog_selection_cb(GtkTreeSelection *sel, gpointer data) {
+ PidginPluginsDialog *dialog = PIDGIN_PLUGINS_DIALOG(data);
+ GPluginPlugin *plugin = NULL;
+ GtkTreeModel *model = NULL;
+ GtkTreeIter iter;
+
+ if(gtk_tree_selection_get_selected(sel, &model, &iter)) {
+ gtk_tree_model_get(model, &iter,
+ GPLUGIN_GTK_STORE_PLUGIN_COLUMN, &plugin,
+ -1);
+ }
+
+ gplugin_gtk_plugin_info_set_plugin(
+ GPLUGIN_GTK_PLUGIN_INFO(dialog->plugin_info),
+ plugin
+ );
+}
+
/******************************************************************************
* GObject Implementation
*****************************************************************************/
@@ -58,6 +83,10 @@
);
gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, close_button);
+ gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_info);
+ gtk_widget_class_bind_template_child(widget_class, PidginPluginsDialog, plugin_store);
+
+ gtk_widget_class_bind_template_callback(widget_class, pidgin_plugins_dialog_selection_cb);
}
static void
@@ -71,6 +100,13 @@
G_CALLBACK(pidgin_plugins_dialog_close),
dialog
);
+
+ /* set the sort column for the plugin_store */
+ gtk_tree_sortable_set_sort_column_id(
+ GTK_TREE_SORTABLE(dialog->plugin_store),
+ GPLUGIN_GTK_STORE_MARKUP_COLUMN,
+ GTK_SORT_ASCENDING
+ );
}
GtkWidget *
--- a/pidgin/resources/Plugins/dialog.ui Fri Nov 01 00:37:38 2019 -0500
+++ b/pidgin/resources/Plugins/dialog.ui Fri Nov 01 00:38:08 2019 -0500
@@ -3,8 +3,11 @@
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="gplugin-gtk" version="0.28"/>
- <object class="GPluginGtkStore" id="pluginstore"/>
- <template class="PidginPluginDialog" parent="GtkDialog">
+ <object class="GPluginGtkStore" id="raw_plugin_store"/>
+ <object class="GtkTreeModelSort" id="plugin_store">
+ <property name="model">raw_plugin_store</property>
+ </object>
+ <template class="PidginPluginsDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<child>
@@ -66,11 +69,12 @@
<object class="GPluginGtkView">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">pluginstore</property>
- <property name="headers_visible">False</property>
+ <property name="model">plugin_store</property>
<property name="headers_clickable">False</property>
<child internal-child="selection">
- <object class="GtkTreeSelection"/>
+ <object class="GtkTreeSelection">
+ <signal name="changed" handler="pidgin_plugins_dialog_selection_cb" object="PidginPluginDialog" swapped="no"/>
+ </object>
</child>
</object>
</child>
@@ -82,7 +86,7 @@
</packing>
</child>
<child>
- <object class="GPluginGtkPluginInfo">
+ <object class="GPluginGtkPluginInfo" id="plugin_info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>