[Xfce4-commits] [apps/xfdashboard] 01/02: Implement plugin preferences dialog in settings application

noreply at xfce.org noreply at xfce.org
Mon Feb 22 13:17:33 CET 2016


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 6b971bfd46c13c6052d65fd59482cdeeb4ca5eb3
Author: Stephan Haller <nomad at froevel.de>
Date:   Mon Feb 22 12:58:01 2016 +0100

    Implement plugin preferences dialog in settings application
    
    The plugins do not have any preferences widgets yet and only plugin "clock-view" shows a "not yet implemented" label.
---
 data/data/preferences.ui    | 121 +++++++++++++++++
 libxfdashboard/marshal.list |   1 +
 libxfdashboard/plugin.c     |   4 +-
 libxfdashboard/plugin.h     |   2 +-
 plugins/clock-view/plugin.c |  17 ++-
 settings/plugins.c          | 322 +++++++++++++++++++++++++++++++++++++++-----
 6 files changed, 431 insertions(+), 36 deletions(-)

diff --git a/data/data/preferences.ui b/data/data/preferences.ui
index f13ddf7..27d34cf 100644
--- a/data/data/preferences.ui
+++ b/data/data/preferences.ui
@@ -13,6 +13,127 @@
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">1</property>
   </object>
+  <object class="GtkDialog" id="plugin-preferences-dialog">
+    <property name="can_focus">False</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="plugin-preferences-dialog-close-button">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">end</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="plugin-preferences-widget-box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">8</property>
+            <property name="margin_bottom">8</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="box14">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_bottom">8</property>
+                <child>
+                  <object class="GtkImage" id="image3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="icon_name">xfdashboard</property>
+                    <property name="icon_size">6</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox" id="box15">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="label14">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xpad">8</property>
+                        <property name="label" translatable="yes"><span size="large"><b>Xfdashboard settings</b></span></property>
+                        <property name="use_markup">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="configure-plugin-title-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xpad">8</property>
+                        <property name="label" translatable="yes">Configure plugin</property>
+                        <property name="use_markup">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
   <object class="GtkWindow" id="preferences-dialog">
     <property name="can_focus">False</property>
     <property name="icon_name">xfdashboard</property>
diff --git a/libxfdashboard/marshal.list b/libxfdashboard/marshal.list
index 42824a7..0120dfc 100644
--- a/libxfdashboard/marshal.list
+++ b/libxfdashboard/marshal.list
@@ -10,3 +10,4 @@ BOOLEAN:OBJECT,ENUM
 BOOLEAN:OBJECT,FLOAT,FLOAT
 BOOLEAN:OBJECT,STRING,OBJECT
 BOOLEAN:VOID
+OBJECT:VOID
diff --git a/libxfdashboard/plugin.c b/libxfdashboard/plugin.c
index 29268c6..db10e2a 100644
--- a/libxfdashboard/plugin.c
+++ b/libxfdashboard/plugin.c
@@ -872,8 +872,8 @@ static void xfdashboard_plugin_class_init(XfdashboardPluginClass *klass)
 						G_STRUCT_OFFSET(XfdashboardPluginClass, configure),
 						NULL,
 						NULL,
-						g_cclosure_marshal_VOID__VOID,
-						G_TYPE_NONE,
+						_xfdashboard_marshal_OBJECT__VOID,
+						G_TYPE_OBJECT,
 						0);
 }
 
diff --git a/libxfdashboard/plugin.h b/libxfdashboard/plugin.h
index ad99651..644f693 100644
--- a/libxfdashboard/plugin.h
+++ b/libxfdashboard/plugin.h
@@ -76,7 +76,7 @@ struct _XfdashboardPluginClass
 	void (*enable)(XfdashboardPlugin *self);
 	void (*disable)(XfdashboardPlugin *self);
 
-	void (*configure)(XfdashboardPlugin *self);
+	GObject* (*configure)(XfdashboardPlugin *self);
 };
 
 /* Error */
diff --git a/plugins/clock-view/plugin.c b/plugins/clock-view/plugin.c
index 144ee42..049e7b5 100644
--- a/plugins/clock-view/plugin.c
+++ b/plugins/clock-view/plugin.c
@@ -29,8 +29,10 @@
 
 #include <libxfce4util/libxfce4util.h>
 
-#include "libxfdashboard/plugin.h"
-#include "libxfdashboard/view-manager.h"
+#include <libxfdashboard/plugin.h>
+#include <libxfdashboard/view-manager.h>
+
+#include <gtk/gtk.h>
 
 
 /* IMPLEMENTATION: XfdashboardPlugin */
@@ -38,6 +40,16 @@
 /* Forward declarations */
 G_MODULE_EXPORT void plugin_init(XfdashboardPlugin *self);
 
+/* Plugin configuration function */
+static GObject* plugin_configure(XfdashboardPlugin *self, gpointer inUserData)
+{
+	GtkWidget		*label;
+
+	label=gtk_label_new("Not yet implemented!");
+
+	return(G_OBJECT(label));
+}
+
 /* Plugin enable function */
 static void plugin_enable(XfdashboardPlugin *self, gpointer inUserData)
 {
@@ -83,4 +95,5 @@ G_MODULE_EXPORT void plugin_init(XfdashboardPlugin *self)
 	/* Connect plugin action handlers */
 	g_signal_connect(self, "enable", G_CALLBACK(plugin_enable), NULL);
 	g_signal_connect(self, "disable", G_CALLBACK(plugin_disable), NULL);
+	g_signal_connect(self, "configure", G_CALLBACK(plugin_configure), NULL);
 }
diff --git a/settings/plugins.c b/settings/plugins.c
index 76e5548..3830bf8 100644
--- a/settings/plugins.c
+++ b/settings/plugins.c
@@ -32,6 +32,7 @@
 
 #include <libxfdashboard/plugin.h>
 
+
 /* Define this class in GObject system */
 G_DEFINE_TYPE(XfdashboardSettingsPlugins,
 				xfdashboard_settings_plugins,
@@ -60,6 +61,8 @@ struct _XfdashboardSettingsPluginsPrivate
 	GtkWidget		*widgetPluginLicense;
 	GtkWidget		*widgetPluginDescriptionLabel;
 	GtkWidget		*widgetPluginDescription;
+	GtkWidget		*widgetPluginPreferencesDialog;
+	GtkWidget		*widgetPluginPreferencesWidgetBox;
 };
 
 /* Properties */
@@ -81,6 +84,8 @@ static GParamSpec* XfdashboardSettingsPluginsProperties[PROP_LAST]={ 0, };
 #define ENABLED_PLUGINS_XFCONF_PROP					"/enabled-plugins"
 #define DEFAULT_ENABLED_PLUGINS						NULL
 
+#define XFDASHBOARD_TREE_VIEW_COLUMN_ID				"column-id"
+
 enum
 {
 	XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_ID,
@@ -102,6 +107,232 @@ enum
 	XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_LAST
 };
 
+/* Close button in plugin's preferences dialog was clicked */
+static void _xfdashboard_settings_plugins_on_perferences_dialog_close_clicked(XfdashboardSettingsPlugins *self,
+																				GtkWidget *inWidget)
+{
+	GtkWidget		*dialog;
+
+	g_return_if_fail(XFDASHBOARD_IS_SETTINGS_PLUGINS(self));
+	g_return_if_fail(GTK_IS_WIDGET(inWidget));
+
+	/* Get dialog this widget belongs to */
+	dialog=inWidget;
+	while(!GTK_IS_DIALOG(dialog)) dialog=gtk_widget_get_parent(dialog);
+
+	/* Send response if dialog was found */
+	if(dialog)
+	{
+		gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
+	}
+}
+
+/* Preferences icon in tree view was clicked */
+static gboolean _xfdashboard_settings_plugins_call_preferences(XfdashboardSettingsPlugins *self,
+																GdkEvent *inEvent,
+																GtkTreeView *inTreeView,
+																GtkTreePath *inPath)
+{
+	XfdashboardSettingsPluginsPrivate		*priv;
+	GtkTreeModel							*model;
+	GtkTreeIter								iter;
+	gboolean								isConfigurable;
+	XfdashboardPlugin						*plugin;
+	GtkWidget								*pluginPreferencesWidget;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_SETTINGS_PLUGINS(self), FALSE);
+	g_return_val_if_fail(inEvent, FALSE);
+	g_return_val_if_fail(GTK_IS_TREE_VIEW(inTreeView), FALSE);
+	g_return_val_if_fail(inPath, FALSE);
+
+	priv=self->priv;
+	isConfigurable=FALSE;
+	plugin=NULL;
+	pluginPreferencesWidget=NULL;
+
+	/* We only handle released single left-clicks in this event handler */
+	if(inEvent->button.button!=1)
+	{
+		g_debug("Will not handle event: Got button %d in button event but expected 1.",
+					inEvent->button.button);
+		return(FALSE);
+	}
+
+	if(inEvent->type!=GDK_BUTTON_RELEASE)
+	{
+		g_debug("Will not handle event: Got button event %d in button event but expected %d.",
+					inEvent->type,
+					GDK_BUTTON_RELEASE);
+		return(FALSE);
+	}
+
+	/* If a preferences window is visible do nothing because only one
+	 * window of this kind can be visible and set up at a time.
+	 */
+	if(gtk_widget_is_visible(priv->widgetPluginPreferencesDialog))
+	{
+		g_debug("Will not handle event: Only one preferences window can be visible at a time.");
+		return(FALSE);
+	}
+
+	/* Get plugins' model */
+	model=gtk_tree_view_get_model(GTK_TREE_VIEW(inTreeView));
+
+	/* Get iterator for path */
+	if(G_UNLIKELY(!gtk_tree_model_get_iter(model, &iter, inPath)))
+	{
+		g_debug("Could not get iterator for selection path");
+		return(FALSE);
+	}
+
+	/* Check if it plugin is marked to be configurable */
+	gtk_tree_model_get(model, &iter,
+						XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_CONFIGURABLE, &isConfigurable,
+						XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_PLUGIN, &plugin,
+						-1);
+
+	if(!isConfigurable)
+	{
+		g_debug("Plugin '%s' is not configurable", xfdashboard_plugin_get_id(plugin));
+
+		/* Release allocated resources */
+		if(plugin) g_object_unref(plugin);
+
+		return(FALSE);
+	}
+
+	/* Emit action "configure" at plugin */
+	g_debug("Emitting signal 'configure' at plugin '%s' of type %s",
+				xfdashboard_plugin_get_id(plugin),
+				G_OBJECT_TYPE_NAME(plugin));
+
+	g_signal_emit_by_name(plugin, "configure", &pluginPreferencesWidget);
+
+	/* If plugin returned a GTK+ widget then create window and add the returned widget to it */
+	if(pluginPreferencesWidget)
+	{
+		gint								response;
+
+		/* Add returned widget from plugin to dialog */
+		gtk_widget_show_all(pluginPreferencesWidget);
+		gtk_container_add(GTK_CONTAINER(priv->widgetPluginPreferencesWidgetBox), pluginPreferencesWidget);
+
+		/* Show dialog in modal mode but do not care about dialog's response code
+		 * as "close" is the only action.
+		 */
+		response=gtk_dialog_run(GTK_DIALOG(priv->widgetPluginPreferencesDialog));
+		g_debug("Plugins preferences dialog response for plugin '%s' is %d",
+				xfdashboard_plugin_get_id(plugin),
+				response);
+
+		/* First hide dialog */
+		gtk_widget_hide(priv->widgetPluginPreferencesDialog);
+
+		/* Now destroy returned widget from plugin to get it removed from dialog */
+		gtk_widget_destroy(pluginPreferencesWidget);
+	}
+
+	/* Release allocated resources */
+	if(plugin) g_object_unref(plugin);
+
+	/* If we get here the event was handled */
+    return(TRUE);
+}
+
+/* A button was pressed in tree view */
+static gboolean _xfdashboard_settings_plugins_on_treeview_button_pressed(XfdashboardSettingsPlugins *self,
+																			GdkEvent *inEvent,
+																			gpointer inUserData)
+{
+	GtkTreeView								*treeView;
+	GtkTreePath								*path;
+	GtkTreeViewColumn						*column;
+	GtkTreeModel							*model;
+	GtkTreeIter								iter;
+	guint									columnID;
+	gboolean								isValid;
+	gboolean								eventHandled;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_SETTINGS_PLUGINS(self), FALSE);
+	g_return_val_if_fail(inEvent, FALSE);
+	g_return_val_if_fail(GTK_IS_TREE_VIEW(inUserData), FALSE);
+
+	treeView=GTK_TREE_VIEW(inUserData);
+	path=NULL;
+	column=NULL;
+	isValid=FALSE;
+	eventHandled=FALSE;
+
+	/* Get tree path where event happened */
+	if(!gtk_tree_view_get_path_at_pos(treeView, inEvent->button.x, inEvent->button.y, &path, &column, NULL, NULL) ||
+		!path ||
+		!column)
+	{
+		g_debug("Could not get path and colum in tree view for position %.2f, %.2f",
+				inEvent->button.x,
+				inEvent->button.y);
+
+		/* Release allocated resources */
+		if(path) gtk_tree_path_free(path);
+
+		/* Event was not handled */
+		return(FALSE);
+	}
+
+	/* Get plugins' model */
+	model=gtk_tree_view_get_model(treeView);
+
+	/* Get iterator for path */
+	if(G_UNLIKELY(!gtk_tree_model_get_iter(model, &iter, path)))
+	{
+		g_debug("Could not get iterator for selection path");
+
+		/* Release allocated resources */
+		if(path) gtk_tree_path_free(path);
+
+		/* Event was not handled */
+		return(FALSE);
+	}
+
+	/* Get plugin at path and check if it is valid. If it is invalid we do not need to process
+	 * this event any futher.
+	 */
+	gtk_tree_model_get(model, &iter,
+						XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID, &isValid,
+						-1);
+
+	if(!isValid)
+	{
+		g_debug("Will not process event for invalid plugin.");
+
+		/* Release allocated resources */
+		if(path) gtk_tree_path_free(path);
+
+		/* Event was not handled */
+		return(FALSE);
+	}
+
+	/* Check if column where event happened can be handled */
+	columnID=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(column), XFDASHBOARD_TREE_VIEW_COLUMN_ID));
+	switch(columnID)
+	{
+		case XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_CONFIGURABLE:
+			eventHandled=_xfdashboard_settings_plugins_call_preferences(self, inEvent, treeView, path);
+			break;
+
+		default:
+			g_debug("This event is not handled for column ID %d", columnID);
+			break;
+	}
+
+	/* Release allocated resources */
+	if(path) gtk_tree_path_free(path);
+
+	/* Return result if event was handled */
+    return(eventHandled);
+}
+
+
 /* Selection in plugins tree view changed */
 static void _xfdashboard_settings_plugins_enabled_plugins_on_plugins_selection_changed(XfdashboardSettingsPlugins *self,
 																						GtkTreeSelection *inSelection)
@@ -573,7 +804,7 @@ static void _xfdashboard_settings_plugins_populate_plugins_list(XfdashboardSetti
 			/* Determine if plugin is configurable */
 			pluginIsConfigurable=FALSE;
 
-			signalID=g_signal_lookup("enable", XFDASHBOARD_TYPE_PLUGIN);
+			signalID=g_signal_lookup("configure", XFDASHBOARD_TYPE_PLUGIN);
 			handlerID=g_signal_handler_find(plugin,
 											G_SIGNAL_MATCH_ID,
 											signalID,
@@ -581,7 +812,7 @@ static void _xfdashboard_settings_plugins_populate_plugins_list(XfdashboardSetti
 											NULL,
 											NULL,
 											NULL);
-			if(!handlerID)
+			if(handlerID)
 			{
 				pluginIsConfigurable=TRUE;
 				g_debug("Plugin '%s' is configurable", pluginID);
@@ -659,9 +890,13 @@ static void _xfdashboard_settings_plugins_set_builder(XfdashboardSettingsPlugins
 	priv->widgetPluginDescriptionLabel=GTK_WIDGET(gtk_builder_get_object(priv->builder, "plugin-description-label"));
 	priv->widgetPluginDescription=GTK_WIDGET(gtk_builder_get_object(priv->builder, "plugin-description"));
 
+	priv->widgetPluginPreferencesDialog=GTK_WIDGET(gtk_builder_get_object(priv->builder, "plugin-preferences-dialog"));
+	priv->widgetPluginPreferencesWidgetBox=GTK_WIDGET(gtk_builder_get_object(priv->builder, "plugin-preferences-widget-box"));
+
 	/* Set up theme list */
 	if(priv->widgetPlugins)
 	{
+		GtkTreeViewColumn				*column;
 		GtkTreeSelection				*selection;
 		GtkCellRenderer					*renderer;
 		GIcon							*icon;
@@ -674,26 +909,26 @@ static void _xfdashboard_settings_plugins_set_builder(XfdashboardSettingsPlugins
 						"stock-size", GTK_ICON_SIZE_MENU,
 						NULL);
 		if(icon) g_object_unref(icon);
-		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(priv->widgetPlugins),
-													-1,
-													N_(""),
-													renderer,
-													"visible", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_INVALID,
-													"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
-													NULL);
+		column=gtk_tree_view_column_new_with_attributes(N_(""),
+														renderer,
+														"visible", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_INVALID,
+														"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
+														NULL);
+		g_object_set_data(G_OBJECT(column), XFDASHBOARD_TREE_VIEW_COLUMN_ID, GINT_TO_POINTER(XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID));
+		gtk_tree_view_insert_column(GTK_TREE_VIEW(priv->widgetPlugins), column, -1);
 
 		renderer=gtk_cell_renderer_toggle_new();
 		g_signal_connect_swapped(renderer,
 									"toggled",
 									G_CALLBACK(_xfdashboard_settings_plugins_enabled_plugins_changed_by_widget),
 									self);
-		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(priv->widgetPlugins),
-													-1,
-													N_(""),
-													renderer,
-													"active", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_ENABLED,
-													"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
-													NULL);
+		column=gtk_tree_view_column_new_with_attributes(N_(""),
+														renderer,
+														"active", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_ENABLED,
+														"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
+														NULL);
+		g_object_set_data(G_OBJECT(column), XFDASHBOARD_TREE_VIEW_COLUMN_ID, GINT_TO_POINTER(XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_ENABLED));
+		gtk_tree_view_insert_column(GTK_TREE_VIEW(priv->widgetPlugins), column, -1);
 
 		renderer=gtk_cell_renderer_pixbuf_new();
 		icon=g_themed_icon_new_with_default_fallbacks("preferences-desktop-symbolic");
@@ -702,22 +937,22 @@ static void _xfdashboard_settings_plugins_set_builder(XfdashboardSettingsPlugins
 						"stock-size", GTK_ICON_SIZE_MENU,
 						NULL);
 		if(icon) g_object_unref(icon);
-		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(priv->widgetPlugins),
-													-1,
-													N_(""),
-													renderer,
-													"visible", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_CONFIGURABLE,
-													"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
-													NULL);
+		column=gtk_tree_view_column_new_with_attributes(N_(""),
+														renderer,
+														"visible", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_CONFIGURABLE,
+														"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
+														NULL);
+		g_object_set_data(G_OBJECT(column), XFDASHBOARD_TREE_VIEW_COLUMN_ID, GINT_TO_POINTER(XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_CONFIGURABLE));
+		gtk_tree_view_insert_column(GTK_TREE_VIEW(priv->widgetPlugins), column, -1);
 
 		renderer=gtk_cell_renderer_text_new();
-		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(priv->widgetPlugins),
-													-1,
-													_("name"),
-													renderer,
-													"text", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_NAME,
-													"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
-													NULL);
+		column=gtk_tree_view_column_new_with_attributes(_("Name"),
+														renderer,
+														"text", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_NAME,
+														"sensitive", XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_IS_VALID,
+														NULL);
+		g_object_set_data(G_OBJECT(column), XFDASHBOARD_TREE_VIEW_COLUMN_ID, GINT_TO_POINTER(XFDASHBOARD_SETTINGS_PLUGINS_COLUMN_NAME));
+		gtk_tree_view_insert_column(GTK_TREE_VIEW(priv->widgetPlugins), column, -1);
 
 		/* Ensure only one selection at time is possible */
 		selection=gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->widgetPlugins));
@@ -743,7 +978,27 @@ static void _xfdashboard_settings_plugins_set_builder(XfdashboardSettingsPlugins
 									G_CALLBACK(_xfdashboard_settings_plugins_enabled_plugins_changed_by_xfconf),
 									self);
 
-		/* Release allocated resources */
+		g_signal_connect_swapped(priv->widgetPlugins,
+									"button-press-event",
+									G_CALLBACK(_xfdashboard_settings_plugins_on_treeview_button_pressed),
+									self);
+		g_signal_connect_swapped(priv->widgetPlugins,
+									"button-release-event",
+									G_CALLBACK(_xfdashboard_settings_plugins_on_treeview_button_pressed),
+									self);
+	}
+
+	/* Set up dialog for plugin preferences */
+	if(priv->widgetPluginPreferencesDialog)
+	{
+		GtkWidget						*widgetCloseButton;
+
+		/* Connect signals */
+		widgetCloseButton=GTK_WIDGET(gtk_builder_get_object(priv->builder, "plugin-preferences-dialog-close-button"));
+		g_signal_connect_swapped(widgetCloseButton,
+									"clicked",
+									G_CALLBACK(_xfdashboard_settings_plugins_on_perferences_dialog_close_clicked),
+									self);
 	}
 }
 
@@ -767,6 +1022,8 @@ static void _xfdashboard_settings_plugins_dispose(GObject *inObject)
 	priv->widgetPluginLicense=NULL;
 	priv->widgetPluginDescriptionLabel=NULL;
 	priv->widgetPluginDescription=NULL;
+	priv->widgetPluginPreferencesDialog=NULL;
+	priv->widgetPluginPreferencesWidgetBox=NULL;
 
 	if(priv->builder)
 	{
@@ -875,6 +1132,9 @@ static void xfdashboard_settings_plugins_init(XfdashboardSettingsPlugins *self)
 	priv->widgetPluginLicense=NULL;
 	priv->widgetPluginDescriptionLabel=NULL;
 	priv->widgetPluginDescription=NULL;
+
+	priv->widgetPluginPreferencesDialog=NULL;
+	priv->widgetPluginPreferencesWidgetBox=NULL;
 }
 
 /* IMPLEMENTATION: Public API */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list