[Xfce4-commits] [apps/xfdashboard] 01/01: Make new experimental code to create and resume window content in an idle source configurable in settings application also
noreply at xfce.org
noreply at xfce.org
Sat Jun 27 02:12:14 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 10c09bee560bc5f9d304e3259738f5693ce0982b
Author: Stephan Haller <nomad at froevel.de>
Date: Sat Jun 27 02:11:48 2015 +0200
Make new experimental code to create and resume window content in an idle source configurable in settings application also
---
data/data/preferences.ui | 56 ++++++++++++---
settings/settings.c | 171 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 204 insertions(+), 23 deletions(-)
diff --git a/data/data/preferences.ui b/data/data/preferences.ui
index 355e81c..f9a6bf5 100644
--- a/data/data/preferences.ui
+++ b/data/data/preferences.ui
@@ -220,6 +220,46 @@ The duration is calculated by the length of the text to show in notification. Th
</packing>
</child>
<child>
+ <object class="GtkBox" id="box9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_markup" translatable="yes">This value defines how fast the window content should be created. While the value 'immediate' tells xfdashboard to create the window content at the time it is requested, all other values will set up a queue and value defines how fast the queue will be processed.
+
+<b>NOTE:</b> Only change this value from 'immediate' to other value if your graphics card, driver or system is too slow to create the window contents immediately. You have to try each value to find the one fitting your system.</property>
+ <property name="label" translatable="yes">Priority of window content creation</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="window-creation-priority">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_markup" translatable="yes">This value defines how fast the window content should be created. While the value 'immediate' tells xfdashboard to create the window content at the time it is requested, all other values will set up a queue and value defines how fast the queue will be processed.
+
+<b>NOTE:</b> Only change this value from 'immediate' to other value if your graphics card, driver or system is too slow to create the window contents immediately. You have to try each value to find the one fitting your system.</property>
+ </object>
+ <packing>
+ <property name="expand">False</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">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -231,7 +271,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -247,7 +287,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
@@ -262,7 +302,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">7</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -279,7 +319,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">8</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -294,7 +334,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
<child>
@@ -305,9 +345,7 @@ The duration is calculated by the length of the text to show in notification. Th
<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="tooltip_markup" translatable="yes">Sets the interval the search should be delayed by after the first character was entered.</property>
<property name="label" translatable="yes">Delay initial search interval:</property>
</object>
<packing>
@@ -333,7 +371,7 @@ The duration is calculated by the length of the text to show in notification. Th
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">10</property>
+ <property name="position">11</property>
</packing>
</child>
</object>
diff --git a/settings/settings.c b/settings/settings.c
index 13e4ab0..84f4e67 100644
--- a/settings/settings.c
+++ b/settings/settings.c
@@ -51,6 +51,7 @@ struct _XfdashboardSettingsPrivate
GtkWidget *widgetSwitchViewOnResume;
GtkWidget *widgetNotificationTimeout;
GtkWidget *widgetEnableUnmappedWindowWorkaround;
+ GtkWidget *widgetWindowCreationPriority;
GtkWidget *widgetShowAllApps;
GtkWidget *widgetScrollEventChangedWorkspace;
GtkWidget *widgetDelaySearchTimeout;
@@ -67,20 +68,21 @@ struct _XfdashboardSettingsPrivate
};
/* IMPLEMENTATION: Private variables and methods */
-#define XFDASHBOARD_XFCONF_CHANNEL "xfdashboard"
-#define PREFERENCES_UI_FILE "preferences.ui"
-#define XFDASHBOARD_THEME_SUBPATH "xfdashboard-1.0"
-#define XFDASHBOARD_THEME_FILE "xfdashboard.theme"
-#define XFDASHBOARD_THEME_GROUP "Xfdashboard Theme"
-#define DEFAULT_DELAY_SEARCH_TIMEOUT 0
-#define DEFAULT_NOTIFICATION_TIMEOUT 3000
-#define DEFAULT_RESET_SEARCH_ON_RESUME TRUE
-#define DEFAULT_SWITCH_VIEW_ON_RESUME NULL
-#define DEFAULT_THEME "xfdashboard"
-#define DEFAULT_ENABLE_HOTKEY FALSE
-#define MAX_SCREENSHOT_WIDTH 400
-
-typedef struct _XfdashboardSettingsResumableViews XfdashboardSettingsResumableViews;
+#define XFDASHBOARD_XFCONF_CHANNEL "xfdashboard"
+#define PREFERENCES_UI_FILE "preferences.ui"
+#define XFDASHBOARD_THEME_SUBPATH "xfdashboard-1.0"
+#define XFDASHBOARD_THEME_FILE "xfdashboard.theme"
+#define XFDASHBOARD_THEME_GROUP "Xfdashboard Theme"
+#define DEFAULT_DELAY_SEARCH_TIMEOUT 0
+#define DEFAULT_NOTIFICATION_TIMEOUT 3000
+#define DEFAULT_RESET_SEARCH_ON_RESUME TRUE
+#define DEFAULT_SWITCH_VIEW_ON_RESUME NULL
+#define DEFAULT_THEME "xfdashboard"
+#define DEFAULT_ENABLE_HOTKEY FALSE
+#define DEFAULT_WINDOW_CONTENT_CREATION_PRIORITY "immediate"
+#define MAX_SCREENSHOT_WIDTH 400
+
+typedef struct _XfdashboardSettingsResumableViews XfdashboardSettingsResumableViews;
struct _XfdashboardSettingsResumableViews
{
const gchar *displayName;
@@ -95,6 +97,22 @@ static XfdashboardSettingsResumableViews resumableViews[]=
{ NULL, NULL }
};
+typedef struct _XfdashboardSettingsWindowContentPriority XfdashboardSettingsWindowContentPriority;
+struct _XfdashboardSettingsWindowContentPriority
+{
+ const gchar *displayName;
+ const gchar *priorityName;
+};
+
+static XfdashboardSettingsWindowContentPriority windowCreationPriorities[]=
+{
+ { N_("Immediately"), "immediate", },
+ { N_("High"), "high"},
+ { N_("Normal"), "normal" },
+ { N_("Low"), "low" },
+ { NULL, NULL },
+};
+
enum
{
COLUMN_THEME_NAME,
@@ -174,6 +192,71 @@ static void _xfdashboard_settings_xfconf_changed_switch_view_on_resume(Xfdashboa
}
}
+/* Setting '/window-content-creation-priority' changed either at widget or at xfconf property */
+static void _xfdashboard_settings_widget_changed_window_creation_priority(XfdashboardSettings *self, GtkComboBox *inComboBox)
+{
+ XfdashboardSettingsPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *value;
+
+ g_return_if_fail(XFDASHBOARD_IS_SETTINGS(self));
+ g_return_if_fail(GTK_IS_COMBO_BOX(inComboBox));
+
+ priv=self->priv;
+
+ /* Get selected entry from combo box */
+ model=gtk_combo_box_get_model(inComboBox);
+ gtk_combo_box_get_active_iter(inComboBox, &iter);
+ gtk_tree_model_get(model, &iter, 1, &value, -1);
+
+ /* Set value at xfconf property */
+ xfconf_channel_set_string(priv->xfconfChannel, "/window-content-creation-priority", value);
+
+ /* Release allocated resources */
+ if(value) g_free(value);
+}
+
+static void _xfdashboard_settings_xfconf_changed_window_creation_priority(XfdashboardSettings *self,
+ const gchar *inProperty,
+ const GValue *inValue,
+ XfconfChannel *inChannel)
+{
+ XfdashboardSettingsPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *value;
+ const gchar *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 lookup and set at combo box */
+ if(G_UNLIKELY(G_VALUE_TYPE(inValue)!=G_TYPE_STRING)) newValue=DEFAULT_WINDOW_CONTENT_CREATION_PRIORITY;
+ else newValue=g_value_get_string(inValue);
+
+ /* Iterate through combo box value and set new value if match is found */
+ model=gtk_combo_box_get_model(GTK_COMBO_BOX(priv->widgetWindowCreationPriority));
+ if(gtk_tree_model_get_iter_first(model, &iter))
+ {
+ do
+ {
+ gtk_tree_model_get(model, &iter, 1, &value, -1);
+ if(G_UNLIKELY(g_str_equal(value, newValue)))
+ {
+ g_free(value);
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(priv->widgetWindowCreationPriority), &iter);
+ break;
+ }
+ g_free(value);
+ }
+ while(gtk_tree_model_iter_next(model, &iter));
+ }
+}
+
/* Setting '/min-notification-timeout' changed either at widget or at xfconf property */
static void _xfdashboard_settings_widget_changed_notification_timeout(XfdashboardSettings *self, GtkRange *inRange)
{
@@ -1149,6 +1232,65 @@ static gboolean _xfdashboard_settings_create_builder(XfdashboardSettings *self)
G_CALLBACK(_xfdashboard_settings_on_close_clicked),
self);
+ priv->widgetWindowCreationPriority=GTK_WIDGET(gtk_builder_get_object(priv->builder, "window-creation-priority"));
+ if(priv->widgetWindowCreationPriority)
+ {
+ GtkCellRenderer *renderer;
+ GtkListStore *listStore;
+ GtkTreeIter listStoreIter;
+ GtkTreeIter *defaultListStoreIter;
+ XfdashboardSettingsWindowContentPriority *iter;
+ gchar *defaultValue;
+
+ /* Get default value from settings */
+ defaultValue=xfconf_channel_get_string(priv->xfconfChannel, "/window-content-creation-priority", DEFAULT_WINDOW_CONTENT_CREATION_PRIORITY);
+ if(!defaultValue) defaultValue=g_strdup(windowCreationPriorities[0].priorityName);
+
+ /* Clear combo box */
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(priv->widgetWindowCreationPriority));
+
+ /* Set up renderer for combo box */
+ renderer=gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(priv->widgetWindowCreationPriority), renderer, TRUE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(priv->widgetWindowCreationPriority), renderer, "text", 0);
+
+ /* Set up list to show at combo box */
+ defaultListStoreIter=NULL;
+ listStore=gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
+ for(iter=windowCreationPriorities; iter->displayName; ++iter)
+ {
+ gtk_list_store_append(listStore, &listStoreIter);
+ gtk_list_store_set(listStore, &listStoreIter, 0, _(iter->displayName), 1, iter->priorityName, -1);
+ if(!g_strcmp0(iter->priorityName, defaultValue))
+ {
+ defaultListStoreIter=gtk_tree_iter_copy(&listStoreIter);
+ }
+ }
+ gtk_combo_box_set_model(GTK_COMBO_BOX(priv->widgetWindowCreationPriority), GTK_TREE_MODEL(listStore));
+ g_object_unref(G_OBJECT(listStore));
+
+ /* Set up default value */
+ if(defaultListStoreIter)
+ {
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(priv->widgetWindowCreationPriority), defaultListStoreIter);
+ gtk_tree_iter_free(defaultListStoreIter);
+ defaultListStoreIter=NULL;
+ }
+
+ /* Connect signals */
+ g_signal_connect_swapped(priv->widgetWindowCreationPriority,
+ "changed",
+ G_CALLBACK(_xfdashboard_settings_widget_changed_window_creation_priority),
+ self);
+ g_signal_connect_swapped(priv->xfconfChannel,
+ "property-changed::/window-content-creation-priority",
+ G_CALLBACK(_xfdashboard_settings_xfconf_changed_window_creation_priority),
+ self);
+
+ /* Release allocated resources */
+ if(defaultValue) g_free(defaultValue);
+ }
+
/* Tab: Themes */
priv->widgetThemeScreenshot=GTK_WIDGET(gtk_builder_get_object(priv->builder, "theme-screenshot"));
priv->widgetThemeNameLabel=GTK_WIDGET(gtk_builder_get_object(priv->builder, "theme-name-label"));
@@ -1297,6 +1439,7 @@ static void xfdashboard_settings_init(XfdashboardSettings *self)
priv->widgetSwitchViewOnResume=NULL;
priv->widgetNotificationTimeout=NULL;
priv->widgetEnableUnmappedWindowWorkaround=NULL;
+ priv->widgetWindowCreationPriority=NULL;
priv->widgetScrollEventChangedWorkspace=NULL;
priv->widgetDelaySearchTimeout=NULL;
priv->widgetThemes=NULL;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list