[gnome-control-center/gnome-3-2] color: After removing a profile select the device so the UI is correct



commit 58854af53e2aea4f59df0c146a0f1ef57957295b
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 13 17:03:51 2011 +0100

    color: After removing a profile select the device so the UI is correct
    
    Resolves https://bugzilla.gnome.org/show_bug.cgi?id=661658

 panels/color/cc-color-panel.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 210ddc1..9f03118 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -1645,11 +1645,13 @@ out:
 static void
 gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
 {
-  GtkTreeIter iter;
-  GtkTreeModel *model;
   const gchar *id;
-  gchar *id_tmp;
   gboolean ret;
+  gchar *id_tmp;
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  GtkTreeSelection *selection;
+  GtkWidget *widget;
   CcColorPanelPrivate *priv = prefs->priv;
 
   /* get first element */
@@ -1666,7 +1668,15 @@ gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
                           GCM_PREFS_COLUMN_DEVICE_PATH, &id_tmp,
                           -1);
       if (g_strcmp0 (id_tmp, id) == 0)
-        gcm_prefs_device_set_model_by_iter (prefs, device, &iter);
+        {
+          /* populate device, and then select it */
+          gcm_prefs_device_set_model_by_iter (prefs, device, &iter);
+          widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                                       "treeview_devices"));
+          selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+          gtk_tree_selection_select_iter (selection, &iter);
+
+        }
       g_free (id_tmp);
     } while (gtk_tree_model_iter_next (model, &iter));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]