[gnome-software/gnome-3-12] app folders: Select newly created folders



commit 25c82af2586a7db7d04b8edcad49c740f4d6130c
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 8 00:02:01 2014 -0400

    app folders: Select newly created folders
    
    This is the expected behavior.
    https://bugzilla.gnome.org/show_bug.cgi?id=726972

 src/gs-app-folder-dialog.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-app-folder-dialog.c b/src/gs-app-folder-dialog.c
index ac22285..e5c4a7a 100644
--- a/src/gs-app-folder-dialog.c
+++ b/src/gs-app-folder-dialog.c
@@ -227,16 +227,11 @@ populate_list (GsAppFolderDialog *dialog)
 }
 
 static void
-row_activated (GtkListBox *list_box, GtkListBoxRow *row, GsAppFolderDialog *dialog)
+select_row (GtkListBox *list_box, GtkListBoxRow *row, GsAppFolderDialog *dialog)
 {
        GsAppFolderDialogPrivate *priv = PRIVATE (dialog);
        GtkWidget *image;
 
-       if (row == priv->new_folder_button) {
-               new_folder_cb (dialog);
-               return;
-       }
-
        if (priv->selected_row) {
                image = g_object_get_data (G_OBJECT (priv->selected_row), "image");
                gtk_widget_hide (image);
@@ -253,6 +248,18 @@ row_activated (GtkListBox *list_box, GtkListBoxRow *row, GsAppFolderDialog *dial
 }
 
 static void
+row_activated (GtkListBox *list_box, GtkListBoxRow *row, GsAppFolderDialog *dialog)
+{
+       GsAppFolderDialogPrivate *priv = PRIVATE (dialog);
+
+       if (row == priv->new_folder_button) {
+               new_folder_cb (dialog);
+       } else {
+               select_row (list_box, row, dialog);
+       }
+}
+
+static void
 update_sensitive (GObject *entry, GParamSpec *pspec, GtkWidget *button)
 {
        guint16 len;
@@ -278,10 +285,15 @@ add_folder_add (GtkButton *button, GsAppFolderDialog *dialog)
        folder = gtk_entry_get_text (GTK_ENTRY (priv->new_folder_entry));
        if (folder[0] != '\0') {
                const gchar *id;
+               GtkWidget *row;
                id = gs_folders_add_folder (priv->folders, folder);
+               row = create_row (dialog, id);
                gtk_list_box_insert (GTK_LIST_BOX (priv->app_folder_list), 
-                                    create_row (dialog, id),
+                                    row,
                                     gtk_list_box_row_get_index (priv->new_folder_button));
+               select_row (GTK_LIST_BOX (priv->app_folder_list),
+                            GTK_LIST_BOX_ROW (row),
+                            dialog);
        }
 }
 


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