[gnome-color-manager] Split the startup into two phases to avoid a jarring of the UI at startup
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Split the startup into two phases to avoid a jarring of the UI at startup
- Date: Thu, 3 Dec 2009 11:14:00 +0000 (UTC)
commit 3200173c98c102652141b81149ec3636c35a8813
Author: Richard Hughes <richard hughsie com>
Date: Thu Dec 3 10:15:53 2009 +0000
Split the startup into two phases to avoid a jarring of the UI at startup
src/gcm-prefs.c | 41 ++++++++++++++++++++++++++++-------------
1 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 64e2be8..a63ab0e 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -1898,14 +1898,35 @@ gcm_prefs_removed_cb (GcmClient *gcm_client_, GcmDevice *gcm_device, gpointer us
}
/**
- * gcm_prefs_startup_idle_cb:
+ * gcm_prefs_startup_phase2_idle_cb:
**/
static gboolean
-gcm_prefs_startup_idle_cb (gpointer user_data)
+gcm_prefs_startup_phase2_idle_cb (gpointer user_data)
{
GtkWidget *widget;
GtkTreeSelection *selection;
GtkTreePath *path;
+
+ /* update list of profiles */
+ gcm_prefs_update_profile_list ();
+
+ /* select a profile to display */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_profiles"));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ path = gtk_tree_path_new_from_string ("0");
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ return FALSE;
+}
+
+/**
+ * gcm_prefs_startup_phase1_idle_cb:
+ **/
+static gboolean
+gcm_prefs_startup_phase1_idle_cb (gpointer user_data)
+{
+ GtkWidget *widget;
gboolean ret;
GError *error = NULL;
@@ -1913,9 +1934,6 @@ gcm_prefs_startup_idle_cb (gpointer user_data)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_profile"));
gcm_prefs_add_profiles (widget);
- /* update list of profiles */
- gcm_prefs_update_profile_list ();
-
/* coldplug plugged in devices */
ret = gcm_client_add_connected (gcm_client, &error);
if (!ret) {
@@ -1932,15 +1950,12 @@ gcm_prefs_startup_idle_cb (gpointer user_data)
goto out;
}
- /* select a profile to display */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_profiles"));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
- path = gtk_tree_path_new_from_string ("0");
- gtk_tree_selection_select_path (selection, path);
- gtk_tree_path_free (path);
-
/* set calibrate button sensitivity */
gcm_prefs_set_calibrate_button_sensitivity ();
+
+ /* start phase 2 of the startup */
+ g_idle_add ((GSourceFunc) gcm_prefs_startup_phase2_idle_cb, NULL);
+
out:
return FALSE;
}
@@ -2366,7 +2381,7 @@ main (int argc, char **argv)
G_CALLBACK (gcm_prefs_radio_cb), NULL);
/* do all this after the window has been set up */
- g_idle_add (gcm_prefs_startup_idle_cb, NULL);
+ g_idle_add (gcm_prefs_startup_phase1_idle_cb, NULL);
/* wait */
g_main_loop_run (loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]