[Xfce4-commits] [apps/xfdashboard] 03/04: Make delay timeout interval configurable in settings dialog
noreply at xfce.org
noreply at xfce.org
Thu May 21 21:37:39 CEST 2015
This is an automated email from the git hooks/post-receive script.
nomad pushed a commit to branch master
in repository apps/xfdashboard.
commit f5796e58ff4fe9bcb24cf8785a0527178dc3c93f
Author: Stephan Haller <nomad at froevel.de>
Date: Thu May 21 21:36:07 2015 +0200
Make delay timeout interval configurable in settings dialog
---
data/data/preferences.ui | 61 +++++++++++++++++++++++++++++
settings/settings.c | 96 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 156 insertions(+), 1 deletion(-)
diff --git a/data/data/preferences.ui b/data/data/preferences.ui
index e8b24d4..fb51626 100644
--- a/data/data/preferences.ui
+++ b/data/data/preferences.ui
@@ -2,6 +2,11 @@
<!-- Generated with glade 3.18.3 -->
<interface domain="xfdashboard">
<requires lib="gtk+" version="3.2"/>
+ <object class="GtkAdjustment" id="delay-search-timeout-adjustment">
+ <property name="upper">1000</property>
+ <property name="step_increment">10</property>
+ <property name="page_increment">100</property>
+ </object>
<object class="GtkAdjustment" id="notification-timeout-adjustment">
<property name="lower">1</property>
<property name="upper">30</property>
@@ -277,6 +282,62 @@ The duration is calculated by the length of the text to show in notification. Th
<property name="position">8</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">16</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Search view:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_markup" translatable="yes">Sets the minimum time a notification is being shown.
+
+The duration is calculated by the length of the text to show in notification. This setting allows you to specify how long the notification must be shown at least.</property>
+ <property name="label" translatable="yes">Delay initial search interval:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="delay-search-timeout">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_markup" translatable="yes">Sets the minimum time a notification is being shown.
+
+The duration is calculated by the length of the text to show in notification. This setting allows you to specify how long the notification must be shown at least.</property>
+ <property name="round_digits">1</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">False</property>
+ <property name="fill">True</property>
+ <property name="position">10</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="tab_fill">False</property>
diff --git a/settings/settings.c b/settings/settings.c
index c74dc2b..bebb6c7 100644
--- a/settings/settings.c
+++ b/settings/settings.c
@@ -53,6 +53,7 @@ struct _XfdashboardSettingsPrivate
GtkWidget *widgetEnableUnmappedWindowWorkaround;
GtkWidget *widgetShowAllApps;
GtkWidget *widgetScrollEventChangedWorkspace;
+ GtkWidget *widgetDelaySearchTimeout;
GtkWidget *widgetThemes;
GtkWidget *widgetThemeScreenshot;
GtkWidget *widgetThemeNameLabel;
@@ -71,6 +72,7 @@ struct _XfdashboardSettingsPrivate
#define XFDASHBOARD_THEME_SUBPATH "xfdashboard-1.0"
#define XFDASHBOARD_THEME_FILE "xfdashboard.theme"
#define XFDASHBOARD_THEME_GROUP "Xfdashboard Theme"
+#define DEFAULT_DELAY_SEARCH_TIMEOUT 250
#define DEFAULT_NOTIFICATION_TIMEOUT 3000
#define DEFAULT_RESET_SEARCH_ON_RESUME TRUE
#define DEFAULT_SWITCH_VIEW_ON_RESUME NULL
@@ -224,6 +226,66 @@ static gchar* _xfdashboard_settings_on_format_notification_timeout_value(GtkScal
return(text);
}
+/* Setting '/components/search-view/delay-search-timeout' changed either at widget or at xfconf property */
+static void _xfdashboard_settings_widget_changed_delay_search_timeout(XfdashboardSettings *self, GtkRange *inRange)
+{
+ XfdashboardSettingsPrivate *priv;
+ guint value;
+
+ g_return_if_fail(XFDASHBOARD_IS_SETTINGS(self));
+ g_return_if_fail(GTK_IS_RANGE(inRange));
+
+ priv=self->priv;
+
+ /* Get value from widget */
+ value=floor(gtk_range_get_value(inRange));
+
+ /* Set value at xfconf property */
+ xfconf_channel_set_uint(priv->xfconfChannel, "/components/search-view/delay-search-timeout", value);
+}
+
+static void _xfdashboard_settings_xfconf_changed_delay_search_timeout(XfdashboardSettings *self,
+ const gchar *inProperty,
+ const GValue *inValue,
+ XfconfChannel *inChannel)
+{
+ XfdashboardSettingsPrivate *priv;
+ guint newValue;
+
+ g_return_if_fail(XFDASHBOARD_IS_SETTINGS(self));
+ g_return_if_fail(inValue);
+ g_return_if_fail(XFCONF_IS_CHANNEL(inChannel));
+
+ priv=self->priv;
+
+ /* Get new value to set at widget */
+ if(G_UNLIKELY(G_VALUE_TYPE(inValue)!=G_TYPE_UINT)) newValue=DEFAULT_DELAY_SEARCH_TIMEOUT;
+ else newValue=g_value_get_uint(inValue);
+
+ /* Set new value at widget */
+ gtk_range_set_value(GTK_RANGE(priv->widgetDelaySearchTimeout), (gdouble)newValue);
+}
+
+/* Format value to show in delay search timeout slider */
+static gchar* _xfdashboard_settings_on_format_delay_search_timeout_value(GtkScale *inWidget,
+ gdouble inValue,
+ gpointer inUserData)
+{
+ gchar *text;
+
+ if(inValue>0.0)
+ {
+ text=g_strdup_printf("%u %s", (guint)inValue, _("ms"));
+ }
+ else
+ {
+ text=g_strdup(_("Immediately"));
+ }
+
+ return(text);
+}
+
+
/* Setting '/theme' changed either at widget or at xfconf property */
static void _xfdashboard_settings_widget_changed_theme(XfdashboardSettings *self, GtkTreeSelection *inSelection)
{
@@ -1050,6 +1112,37 @@ static gboolean _xfdashboard_settings_create_builder(XfdashboardSettings *self)
priv->widgetScrollEventChangedWorkspace,
"active");
+ priv->widgetDelaySearchTimeout=GTK_WIDGET(gtk_builder_get_object(priv->builder, "delay-search-timeout"));
+ if(priv->widgetDelaySearchTimeout)
+ {
+ GtkAdjustment *adjustment;
+ gdouble defaultValue;
+
+ /* Get default value */
+ defaultValue=xfconf_channel_get_uint(priv->xfconfChannel, "/components/search-view/delay-search-timeout", DEFAULT_DELAY_SEARCH_TIMEOUT);
+
+ /* Set up scaling settings of widget */
+ adjustment=GTK_ADJUSTMENT(gtk_builder_get_object(priv->builder, "delay-search-timeout-adjustment"));
+ gtk_range_set_adjustment(GTK_RANGE(priv->widgetDelaySearchTimeout), adjustment);
+
+ /* Set up default value */
+ gtk_range_set_value(GTK_RANGE(priv->widgetDelaySearchTimeout), defaultValue);
+
+ /* Connect signals */
+ g_signal_connect(priv->widgetDelaySearchTimeout,
+ "format-value",
+ G_CALLBACK(_xfdashboard_settings_on_format_delay_search_timeout_value),
+ NULL);
+ g_signal_connect_swapped(priv->widgetDelaySearchTimeout,
+ "value-changed",
+ G_CALLBACK(_xfdashboard_settings_widget_changed_delay_search_timeout),
+ self);
+ g_signal_connect_swapped(priv->xfconfChannel,
+ "property-changed::/components/search-view/delay-search-timeout",
+ G_CALLBACK(_xfdashboard_settings_xfconf_changed_delay_search_timeout),
+ self);
+ }
+
priv->widgetCloseButton=GTK_WIDGET(gtk_builder_get_object(priv->builder, "close-button"));
g_signal_connect_swapped(priv->widgetCloseButton,
"clicked",
@@ -1144,6 +1237,7 @@ static void _xfdashboard_settings_dispose(GObject *inObject)
priv->widgetNotificationTimeout=NULL;
priv->widgetEnableUnmappedWindowWorkaround=NULL;
priv->widgetScrollEventChangedWorkspace=NULL;
+ priv->widgetDelaySearchTimeout=NULL;
priv->widgetThemes=NULL;
priv->widgetThemeScreenshot=NULL;
priv->widgetThemeNameLabel=NULL;
@@ -1157,7 +1251,6 @@ static void _xfdashboard_settings_dispose(GObject *inObject)
if(priv->xfconfChannel)
{
- // TODO: xfconf_g_property_unbind_all(priv->xfconfChannel);
priv->xfconfChannel=NULL;
}
@@ -1205,6 +1298,7 @@ static void xfdashboard_settings_init(XfdashboardSettings *self)
priv->widgetNotificationTimeout=NULL;
priv->widgetEnableUnmappedWindowWorkaround=NULL;
priv->widgetScrollEventChangedWorkspace=NULL;
+ priv->widgetDelaySearchTimeout=NULL;
priv->widgetThemes=NULL;
priv->widgetThemeScreenshot=NULL;
priv->widgetThemeNameLabel=NULL;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list