[gnome-software] Fix up the update details dialog



commit 492897fa612bc52fc448775c68166e1f2f9f4ec6
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 22 00:20:19 2013 -0400

    Fix up the update details dialog
    
    Fix the crash with Escape, and also add a scrolled window to the
    details, since those can be long (e.g. control-center). Finally,
    show the app header for both normal and system updates.

 src/gnome-software.ui  |   33 +++++++++++++++++++++++++++------
 src/gs-main.c          |    7 +++++--
 src/gs-shell-updates.c |   15 +++++++++++++--
 3 files changed, 45 insertions(+), 10 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index ffdbe18..9746340 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -960,15 +960,27 @@ with multi-level undo.
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label_update_details">
+              <object class="GtkScrolledWindow" id="scrolledwindow_update_details">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
-                <property name="label">New in kmod 14-1
+                <property name="can_focus">True</property>
+                <property name="vexpand">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">in</property>
+                <property name="kinetic_scrolling">False</property>
+                <child>
+                  <object class="GtkLabel" id="label_update_details">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
+                    <property name="margin">6</property>
+                    <property name="label">New in kmod 14-1
 * Moo
 * bar</property>
-                <property name="wrap">True</property>
+                    <property name="wrap">True</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -982,6 +994,7 @@ with multi-level undo.
                 <property name="can_focus">True</property>
                 <property name="vexpand">True</property>
                 <property name="hscrollbar_policy">never</property>
+                <property name="hscrollbar_policy">automatic</property>
                 <property name="shadow_type">in</property>
                 <property name="kinetic_scrolling">False</property>
                 <child>
@@ -1024,4 +1037,12 @@ with multi-level undo.
       <widget name="entry_search"/>
     </widgets>
   </object>
+  <object class="GtkSizeGroup" id="sizegroup_update_details">
+    <property name="ignore-hidden">False</property>
+    <property name="mode">horizontal</property>
+    <widgets>
+      <widget name="scrolledwindow_update"/>
+      <widget name="scrolledwindow_update_details"/>
+    </widgets>
+  </object>
 </interface>
diff --git a/src/gs-main.c b/src/gs-main.c
index 80373ed..3703561 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -1250,7 +1250,7 @@ gs_main_button_updates_back_cb (GtkWidget *widget, GsMainPrivate *priv)
        gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box_update_header"));
        gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_update_details"));
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update_details"));
        gtk_widget_hide (widget);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update"));
        gtk_widget_show (widget);
@@ -1553,10 +1553,13 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_close"));
        g_signal_connect (widget, "clicked",
                          G_CALLBACK (gs_main_button_updates_close_cb), priv);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_update"));
+        g_signal_connect (widget, "delete-event",
+                          G_CALLBACK (gtk_widget_hide_on_delete), NULL);
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_back"));
        g_signal_connect (widget, "clicked",
                          G_CALLBACK (gs_main_button_updates_back_cb), priv);
-       //FIXME: connect to dialog_update and just hide widget if user closes modal
+        
 
        /* setup updates UI */
        priv->shell_updates = gs_shell_updates_new ();
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 08f6f27..e0648d8 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -144,6 +144,14 @@ gs_shell_updates_set_updates_description_ui (GsShellUpdates *shell_updates, GsAp
        /* set window title */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_update"));
        kind = gs_app_get_kind (app);
+g_print ("app %s: ", gs_app_get_name (app));
+switch (kind) {
+case GS_APP_KIND_UNKNOWN: g_print ("unknown\n"); break;
+case GS_APP_KIND_SYSTEM: g_print ("system\n"); break;
+case GS_APP_KIND_PACKAGE: g_print ("package\n"); break;
+case GS_APP_KIND_OS_UPDATE: g_print ("os update\n"); break;
+default:;
+}
        if (kind == GS_APP_KIND_OS_UPDATE) {
                gtk_window_set_title (GTK_WINDOW (widget), gs_app_get_name (app));
        } else {
@@ -156,9 +164,12 @@ gs_shell_updates_set_updates_description_ui (GsShellUpdates *shell_updates, GsAp
 
        /* set update header */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box_update_header"));
-       gtk_widget_set_visible (widget, kind == GS_APP_KIND_NORMAL);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_update_details"));
+       gtk_widget_set_visible (widget, kind == GS_APP_KIND_NORMAL || kind == GS_APP_KIND_SYSTEM);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update_details"));
        gtk_widget_set_visible (widget, kind != GS_APP_KIND_OS_UPDATE);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update"));
+       gtk_widget_set_visible (widget, kind == GS_APP_KIND_OS_UPDATE);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_update_details"));
        gtk_label_set_label (GTK_LABEL (widget), gs_app_get_metadata_item (app, "update-details"));
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_update_icon"));
        gtk_image_set_from_pixbuf (GTK_IMAGE (widget), gs_app_get_pixbuf (app));


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