[gnome-control-center/extensible-shell] [appearance] Select the next item when removing the current



commit eabb94f9a83fa43b73eb4173a3339c217587f586
Author: William Jon McCann <jmccann redhat com>
Date:   Sat Jan 16 06:02:39 2010 -0500

    [appearance] Select the next item when removing the current

 capplets/appearance/cc-background-page.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/capplets/appearance/cc-background-page.c b/capplets/appearance/cc-background-page.c
index cd31292..54324fb 100644
--- a/capplets/appearance/cc-background-page.c
+++ b/capplets/appearance/cc-background-page.c
@@ -1214,21 +1214,26 @@ on_remove_button_clicked (GtkWidget        *widget,
         CcBackgroundItem *item;
         GtkTreeIter       iter;
         GtkTreePath      *path;
+        gboolean          valid;
 
         item = get_selected_item (page, &iter);
         if (item == NULL) {
                 return;
         }
 
+        valid = gtk_tree_model_iter_next (page->priv->model, &iter);
+
         if (cc_backgrounds_monitor_remove_item (page->priv->monitor, item)) {
-                path = gtk_tree_model_get_path (page->priv->model, &iter);
-        } else {
-                path = gtk_tree_path_new_first ();
-        }
+                if (valid) {
+                        path = gtk_tree_model_get_path (page->priv->model, &iter);
+                } else {
+                        path = gtk_tree_path_new_first ();
+                }
 
-        gtk_icon_view_select_path (GTK_ICON_VIEW (page->priv->icon_view), path);
-        gtk_icon_view_set_cursor (GTK_ICON_VIEW (page->priv->icon_view), path, NULL, FALSE);
-        gtk_tree_path_free (path);
+                gtk_icon_view_select_path (GTK_ICON_VIEW (page->priv->icon_view), path);
+                gtk_icon_view_set_cursor (GTK_ICON_VIEW (page->priv->icon_view), path, NULL, FALSE);
+                gtk_tree_path_free (path);
+        }
 
         g_object_unref (item);
 }



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