[gnome-software/wip/attente/gapplication] Split out window construction
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/attente/gapplication] Split out window construction
- Date: Tue, 22 Mar 2016 22:20:47 +0000 (UTC)
commit e9e14ef1174fbe58dfd2a1dd46acdd9b5d725ff4
Author: William Hua <william hua canonical com>
Date: Tue Mar 22 17:05:26 2016 -0400
Split out window construction
src/gs-shell.c | 66 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 49 insertions(+), 17 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 66bbe38..a675846 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -655,6 +655,25 @@ gs_shell_monitor_permission (GsShell *shell)
G_CALLBACK (on_permission_changed), shell);
}
+static void
+gs_shell_main_window_destroyed_cb (GtkWidget *object,
+ gpointer user_data)
+{
+ GsShell *shell = user_data;
+ GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+
+ priv->shell_category = NULL;
+ priv->shell_details = NULL;
+ priv->shell_search = NULL;
+ priv->shell_moderate = NULL;
+ priv->shell_installed = NULL;
+ priv->shell_extras = NULL;
+ priv->shell_updates = NULL;
+ priv->shell_overview = NULL;
+ priv->main_window = NULL;
+ g_clear_object (&priv->builder);
+}
+
static gboolean
in_desktop (const gchar *name)
{
@@ -672,33 +691,22 @@ in_desktop (const gchar *name)
return names[i] != NULL;
}
-/**
- * gs_shell_setup:
- */
-void
-gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *cancellable)
+static void
+setup_builder (GsShell *shell)
{
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
GtkWidget *widget;
- g_return_if_fail (GS_IS_SHELL (shell));
-
- priv->plugin_loader = g_object_ref (plugin_loader);
- g_signal_connect (priv->plugin_loader, "updates-changed",
- G_CALLBACK (gs_shell_updates_changed_cb), shell);
- priv->cancellable = g_object_ref (cancellable);
-
- gs_shell_monitor_permission (shell);
+ if (priv->builder != NULL)
+ return;
/* get UI */
priv->builder = gtk_builder_new_from_resource ("/org/gnome/Software/gnome-software.ui");
priv->main_window = GTK_WINDOW (gtk_builder_get_object (priv->builder, "window_software"));
g_signal_connect (priv->main_window, "map",
G_CALLBACK (gs_shell_main_window_mapped_cb), shell);
-
- /* add application specific icons to search path */
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- GS_DATA G_DIR_SEPARATOR_S "icons");
+ g_signal_connect (priv->main_window, "destroy",
+ G_CALLBACK (gs_shell_main_window_destroyed_cb), shell);
/* fix up the header bar */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
@@ -808,6 +816,30 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
}
/**
+ * gs_shell_setup:
+ */
+void
+gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *cancellable)
+{
+ GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+
+ g_return_if_fail (GS_IS_SHELL (shell));
+
+ priv->plugin_loader = g_object_ref (plugin_loader);
+ g_signal_connect (priv->plugin_loader, "updates-changed",
+ G_CALLBACK (gs_shell_updates_changed_cb), shell);
+ priv->cancellable = g_object_ref (cancellable);
+
+ gs_shell_monitor_permission (shell);
+
+ /* add application specific icons to search path */
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+ GS_DATA G_DIR_SEPARATOR_S "icons");
+
+ setup_builder (shell);
+}
+
+/**
* gs_shell_set_mode:
**/
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]