summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2010-01-16 06:02:39 -0500
committerWilliam Jon McCann <jmccann@redhat.com>2010-01-16 06:02:39 -0500
commiteabb94f9a83fa43b73eb4173a3339c217587f586 (patch)
tree8457b35f88e2d0e0958e610f7d2cee6767608368
parentf7cf140b9bfec156a929908ecab3bed394af300d (diff)
downloadgnome-control-center-eabb94f9a83fa43b73eb4173a3339c217587f586.tar.gz
[appearance] Select the next item when removing the current
-rw-r--r--capplets/appearance/cc-background-page.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/capplets/appearance/cc-background-page.c b/capplets/appearance/cc-background-page.c
index cd3129289..54324fbd9 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);
}