[gnome-software/wip/kalev/confirm-upgrade-removals] fixup! Add a dialog to confirm upgrade removals



commit e5cab1f092fb207a8d6e48bd87c960aeb1f462b9
Author: Kalev Lember <klember redhat com>
Date:   Tue Jul 12 14:04:12 2016 +0200

    fixup! Add a dialog to confirm upgrade removals

 src/gs-removal-dialog.c  |   23 +++++++++--------------
 src/gs-removal-dialog.h  |    4 ++--
 src/gs-removal-dialog.ui |    4 +++-
 src/gs-shell-updates.c   |    4 ++--
 4 files changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-removal-dialog.c b/src/gs-removal-dialog.c
index 8b36d03..7fb29c7 100644
--- a/src/gs-removal-dialog.c
+++ b/src/gs-removal-dialog.c
@@ -112,21 +112,24 @@ insert_details_widget (GtkMessageDialog *dialog, GtkWidget *widget)
 }
 
 void
-gs_removal_dialog_show_system_upgrade_removals (GsRemovalDialog *self,
-                                                GsApp *system_upgrade)
+gs_removal_dialog_show_upgrade_removals (GsRemovalDialog *self,
+                                         GsApp *upgrade)
 {
        GPtrArray *removals;
        guint i;
        g_autofree gchar *name_version = NULL;
 
        name_version = g_strdup_printf ("%s %s",
-                                       gs_app_get_name (system_upgrade),
-                                       gs_app_get_version (system_upgrade));
+                                       gs_app_get_name (upgrade),
+                                       gs_app_get_version (upgrade));
        /* TRANSLATORS: This is a text displayed during a distro upgrade. %s
           will be replaced by the name and version of distro, e.g. 'Fedora 23'. */
-       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (self), _("Some of the currently 
installed software is not compatible with %s. If you continue, the following will be automatically removed 
during the upgrade:"), name_version);
+       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (self),
+                                                 _("Some of the currently installed software is not 
compatible with %s. "
+                                                   "If you continue, the following will be automatically 
removed during the upgrade:"),
+                                                 name_version);
 
-       removals = gs_app_get_related (system_upgrade);
+       removals = gs_app_get_related (upgrade);
        for (i = 0; i < removals->len; i++) {
                GsApp *app = g_ptr_array_index (removals, i);
                g_autofree gchar *tmp = NULL;
@@ -138,12 +141,6 @@ gs_removal_dialog_show_system_upgrade_removals (GsRemovalDialog *self,
 }
 
 static void
-unset_focus (GtkWidget *widget)
-{
-       gtk_window_set_focus (GTK_WINDOW (widget), NULL);
-}
-
-static void
 gs_removal_dialog_init (GsRemovalDialog *self)
 {
        gtk_widget_init_template (GTK_WIDGET (self));
@@ -157,8 +154,6 @@ gs_removal_dialog_init (GsRemovalDialog *self)
        gtk_list_box_set_sort_func (GTK_LIST_BOX (self->listbox),
                                    list_sort_func,
                                    self, NULL);
-
-       g_signal_connect_after (self, "show", G_CALLBACK (unset_focus), NULL);
 }
 
 static void
diff --git a/src/gs-removal-dialog.h b/src/gs-removal-dialog.h
index 0e1da3d..9c1d586 100644
--- a/src/gs-removal-dialog.h
+++ b/src/gs-removal-dialog.h
@@ -33,8 +33,8 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (GsRemovalDialog, gs_removal_dialog, GS, REMOVAL_DIALOG, GtkMessageDialog)
 
 GtkWidget      *gs_removal_dialog_new                          (void);
-void            gs_removal_dialog_show_system_upgrade_removals (GsRemovalDialog         *self,
-                                                                GsApp                   *system_upgrade);
+void            gs_removal_dialog_show_upgrade_removals        (GsRemovalDialog         *self,
+                                                                GsApp                   *upgrade);
 
 G_END_DECLS
 
diff --git a/src/gs-removal-dialog.ui b/src/gs-removal-dialog.ui
index 44bfe2b..b6ba829 100644
--- a/src/gs-removal-dialog.ui
+++ b/src/gs-removal-dialog.ui
@@ -39,10 +39,12 @@
         <property name="visible">True</property>
         <property name="label" translatable="yes">_Continue</property>
         <property name="use_underline">True</property>
+        <property name="can_default">True</property>
+        <property name="receives_default">True</property>
       </object>
     </child>
     <action-widgets>
-      <action-widget response="accept">button_continue</action-widget>
+      <action-widget response="accept" default="true">button_continue</action-widget>
       <action-widget response="cancel">button_cancel</action-widget>
     </action-widgets>
   </template>
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 2421d7c..c3d005c 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -1173,8 +1173,8 @@ gs_shell_updates_upgrade_install_cb (GsUpgradeBanner *upgrade_banner,
        g_signal_connect (dialog, "response",
                          G_CALLBACK (gs_shell_updates_upgrade_confirm_cb),
                          self);
-       gs_removal_dialog_show_system_upgrade_removals (GS_REMOVAL_DIALOG (dialog),
-                                                       upgrade);
+       gs_removal_dialog_show_upgrade_removals (GS_REMOVAL_DIALOG (dialog),
+                                                upgrade);
        gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
 }
 


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