[Xfce4-commits] [apps/xfdashboard] 02/03: Add help button to xfdashboard-settings standalone dialog (not plugged into xfce4-settings-manager). Fixes bug #16332.

noreply at xfce.org noreply at xfce.org
Mon Jan 13 21:31:40 CET 2020


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

n   o   m   a   d       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfdashboard.

commit b1350679c35f9513650fe6f2c4c7f2b4965cfe99
Author: Stephan Haller <nomad at froevel.de>
Date:   Mon Jan 13 12:28:17 2020 +0100

    Add help button to xfdashboard-settings standalone dialog (not plugged into xfce4-settings-manager). Fixes bug #16332.
---
 data/data/preferences.ui | 17 ++++++++++++++++-
 settings/Makefile.am     |  2 ++
 settings/settings.c      | 44 ++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/data/data/preferences.ui b/data/data/preferences.ui
index b0958cc..f23ef63 100644
--- a/data/data/preferences.ui
+++ b/data/data/preferences.ui
@@ -960,6 +960,21 @@ When not enabled it will select the last known active window of the running appl
             <property name="margin_top">8</property>
             <property name="layout_style">end</property>
             <child>
+              <object class="GtkButton" id="help-button">
+                <property name="label">gtk-help</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">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkButton" id="close-button">
                 <property name="label">gtk-close</property>
                 <property name="visible">True</property>
@@ -971,7 +986,7 @@ When not enabled it will select the last known active window of the running appl
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="pack_type">end</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </object>
diff --git a/settings/Makefile.am b/settings/Makefile.am
index 9e49b62..169b100 100644
--- a/settings/Makefile.am
+++ b/settings/Makefile.am
@@ -29,6 +29,7 @@ xfdashboard_settings_CFLAGS = \
 	$(CLUTTER_CFLAGS) \
 	$(LIBXFCONF_CFLAGS) \
 	$(LIBXFCE4UTIL_CFLAGS) \
+	$(LIBXFCE4UI_CFLAGS) \
 	$(PLATFORM_CFLAGS)
 
 xfdashboard_settings_LDADD = \
@@ -36,6 +37,7 @@ xfdashboard_settings_LDADD = \
 	$(CLUTTER_LIBS) \
 	$(LIBXFCONF_LIBS) \
 	$(LIBXFCE4UTIL_LIBS) \
+	$(LIBXFCE4UI_LIBS) \
 	$(LIBM) \
 	$(top_builddir)/libxfdashboard/libxfdashboard.la
 
diff --git a/settings/settings.c b/settings/settings.c
index f3232c6..84a6db7 100644
--- a/settings/settings.c
+++ b/settings/settings.c
@@ -28,6 +28,7 @@
 #include "settings.h"
 
 #include <glib/gi18n-lib.h>
+#include <libxfce4ui/libxfce4ui.h>
 #include <xfconf/xfconf.h>
 #include <math.h>
 
@@ -43,11 +44,13 @@ struct _XfdashboardSettingsPrivate
 	XfconfChannel					*xfconfChannel;
 
 	GtkBuilder						*builder;
+	GObject							*dialog;
 
 	XfdashboardSettingsGeneral		*general;
 	XfdashboardSettingsThemes		*themes;
 	XfdashboardSettingsPlugins		*plugins;
 
+	GtkWidget						*widgetHelpButton;
 	GtkWidget						*widgetCloseButton;
 };
 
@@ -61,6 +64,28 @@ G_DEFINE_TYPE_WITH_PRIVATE(XfdashboardSettings,
 #define PREFERENCES_UI_FILE							"preferences.ui"
 
 
+/* Help button was clicked */
+static void _xfdashboard_settings_on_help_clicked(XfdashboardSettings *self,
+													GtkWidget *inWidget)
+{
+	XfdashboardSettingsPrivate				*priv;
+	GtkWindow								*window;
+
+	g_return_if_fail(XFDASHBOARD_IS_SETTINGS(self));
+
+	priv=self->priv;
+
+	/* Show online manual for xfdashboard but ask user if needed */
+	window=NULL;
+	if(GTK_IS_WINDOW(priv->dialog)) window=GTK_WINDOW(priv->dialog);
+
+	xfce_dialog_show_help_with_version(window,
+										"xfdashboard",
+										"start",
+										NULL,
+										NULL);
+}
+
 /* Close button was clicked */
 static void _xfdashboard_settings_on_close_clicked(XfdashboardSettings *self,
 													GtkWidget *inWidget)
@@ -153,6 +178,12 @@ static gboolean _xfdashboard_settings_create_builder(XfdashboardSettings *self)
 	g_debug("Loaded UI resources from '%s' successfully.", builderFile);
 
 	/* Setup common widgets */
+	priv->widgetHelpButton=GTK_WIDGET(gtk_builder_get_object(priv->builder, "help-button"));
+	g_signal_connect_swapped(priv->widgetHelpButton,
+								"clicked",
+								G_CALLBACK(_xfdashboard_settings_on_help_clicked),
+								self);
+
 	priv->widgetCloseButton=GTK_WIDGET(gtk_builder_get_object(priv->builder, "close-button"));
 	g_signal_connect_swapped(priv->widgetCloseButton,
 								"clicked",
@@ -186,6 +217,8 @@ static void _xfdashboard_settings_dispose(GObject *inObject)
 	XfdashboardSettingsPrivate	*priv=self->priv;
 
 	/* Release allocated resouces */
+	priv->dialog=NULL;
+	priv->widgetHelpButton=NULL;
 	priv->widgetCloseButton=NULL;
 
 	if(priv->themes)
@@ -245,9 +278,11 @@ static void xfdashboard_settings_init(XfdashboardSettings *self)
 	/* Set default values */
 	priv->xfconfChannel=xfconf_channel_get(XFDASHBOARD_XFCONF_CHANNEL);
 	priv->builder=NULL;
+	priv->dialog=NULL;
 	priv->general=NULL;
 	priv->themes=NULL;
 	priv->plugins=NULL;
+	priv->widgetHelpButton=NULL;
 	priv->widgetCloseButton=NULL;
 }
 
@@ -263,7 +298,6 @@ XfdashboardSettings* xfdashboard_settings_new(void)
 GtkWidget* xfdashboard_settings_create_dialog(XfdashboardSettings *self)
 {
 	XfdashboardSettingsPrivate	*priv;
-	GObject						*dialog;
 
 	g_return_val_if_fail(XFDASHBOARD_IS_SETTINGS(self), NULL);
 
@@ -277,15 +311,17 @@ GtkWidget* xfdashboard_settings_create_dialog(XfdashboardSettings *self)
 	}
 
 	/* Get dialog object */
-	dialog=gtk_builder_get_object(priv->builder, "preferences-dialog");
-	if(!dialog)
+	g_assert(priv->dialog==NULL);
+
+	priv->dialog=gtk_builder_get_object(priv->builder, "preferences-dialog");
+	if(!priv->dialog)
 	{
 		g_critical(_("Could not get dialog from UI file."));
 		return(NULL);
 	}
 
 	/* Return widget */
-	return(GTK_WIDGET(dialog));
+	return(GTK_WIDGET(priv->dialog));
 }
 
 /* Create "pluggable" dialog for this settings instance */

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


More information about the Xfce4-commits mailing list