[gnome-software] Move more functionality out to the update shell file



commit 6dea9b959335481ccca82ab935ed997a39774f1c
Author: Richard Hughes <richard hughsie com>
Date:   Thu Aug 22 09:54:15 2013 +0100

    Move more functionality out to the update shell file

 src/gs-main.c          |   39 ---------------------------------------
 src/gs-shell-updates.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 39 deletions(-)
---
diff --git a/src/gs-main.c b/src/gs-main.c
index 0e805af..70fe892 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -1063,33 +1063,6 @@ gs_main_overview_button_cb (GtkWidget *widget, GsMainPrivate *priv)
 }
 
 /**
- * gs_main_button_updates_close_cb:
- **/
-static void
-gs_main_button_updates_close_cb (GtkWidget *widget, GsMainPrivate *priv)
-{
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_update"));
-       gtk_widget_hide (widget);
-}
-
-/**
- * gs_main_button_updates_back_cb:
- **/
-static void
-gs_main_button_updates_back_cb (GtkWidget *widget, GsMainPrivate *priv)
-{
-       /* return to the list view */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_back"));
-       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, "scrolledwindow_update_details"));
-       gtk_widget_hide (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update"));
-       gtk_widget_show (widget);
-}
-
-/**
  * gs_main_back_button_cb:
  **/
 static void
@@ -1251,18 +1224,6 @@ gs_main_startup_cb (GApplication *application, GsMainPrivate *priv)
        g_signal_connect (widget, "clicked",
                          G_CALLBACK (gs_main_overview_button_cb), priv);
 
-       /* setup update details window */
-       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);
-        
-
        /* setup UI */
        priv->shell_updates = gs_shell_updates_new ();
        gs_shell_updates_setup (priv->shell_updates,
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index e3642fe..e01c32d 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -318,6 +318,36 @@ gs_shell_updates_list_header_func (GtkListBoxRow *row,
 }
 
 /**
+ * gs_shell_updates_button_close_cb:
+ **/
+static void
+gs_shell_updates_button_close_cb (GtkWidget *widget, GsShellUpdates *shell_updates)
+{
+       GsShellUpdatesPrivate *priv = shell_updates->priv;
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_update"));
+       gtk_widget_hide (widget);
+}
+
+/**
+ * gs_shell_updates_button_back_cb:
+ **/
+static void
+gs_shell_updates_button_back_cb (GtkWidget *widget, GsShellUpdates *shell_updates)
+{
+       GsShellUpdatesPrivate *priv = shell_updates->priv;
+
+       /* return to the list view */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_back"));
+       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, "scrolledwindow_update_details"));
+       gtk_widget_hide (widget);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "scrolledwindow_update"));
+       gtk_widget_show (widget);
+}
+
+/**
  * gs_shell_updates_setup:
  */
 void
@@ -374,6 +404,20 @@ gs_shell_updates_setup (GsShellUpdates *shell_updates,
        g_signal_connect (treeview, "row-activated",
                          G_CALLBACK (gs_shell_updates_row_activated_cb),
                          shell_updates);
+
+       /* setup update details window */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_close"));
+       g_signal_connect (widget, "clicked",
+                         G_CALLBACK (gs_shell_updates_button_close_cb),
+                         shell_updates);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_update"));
+        g_signal_connect (widget, "delete-event",
+                         G_CALLBACK (gtk_widget_hide_on_delete),
+                         shell_updates);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_back"));
+       g_signal_connect (widget, "clicked",
+                         G_CALLBACK (gs_shell_updates_button_back_cb),
+                         shell_updates);
 }
 
 /**


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