[gnome-color-manager] trivial: ensure the first device in the list is selected at startup
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: ensure the first device in the list is selected at startup
- Date: Mon, 15 Feb 2010 08:21:38 +0000 (UTC)
commit 18358e4234f3a713c14af211f0bc0bb022098da8
Author: Richard Hughes <richard hughsie com>
Date: Sun Feb 14 20:16:35 2010 +0000
trivial: ensure the first device in the list is selected at startup
src/gcm-prefs.c | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 07a9ec6..97a1955 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -2306,14 +2306,30 @@ gcm_prefs_profile_store_changed_cb (GcmProfileStore *_profile_store, gpointer us
}
/**
+ * gcm_prefs_select_first_device_idle_cb:
+ **/
+static gboolean
+gcm_prefs_select_first_device_idle_cb (gpointer data)
+{
+ GtkTreePath *path;
+ GtkWidget *widget;
+
+ /* set the cursor on the first device */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_devices"));
+ path = gtk_tree_path_new_from_string ("0");
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+
+ return FALSE;
+}
+
+/**
* gcm_prefs_client_notify_loading_cb:
**/
static void
gcm_prefs_client_notify_loading_cb (GcmClient *client, GParamSpec *pspec, gpointer data)
{
gboolean loading;
- GtkTreePath *path;
- GtkWidget *widget;
/* get the new state */
g_object_get (client, "loading", &loading, NULL);
@@ -2327,11 +2343,8 @@ gcm_prefs_client_notify_loading_cb (GcmClient *client, GParamSpec *pspec, gpoint
/* otherwise clear the loading widget */
gtk_widget_hide (info_bar);
- /* set the cursor on the first device */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_devices"));
- path = gtk_tree_path_new_from_string ("0");
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
- gtk_tree_path_free (path);
+ /* idle callback */
+ g_idle_add (gcm_prefs_select_first_device_idle_cb, NULL);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]