[gnome-software] Move header bar button creation into individual pages
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Move header bar button creation into individual pages
- Date: Thu, 3 Mar 2016 11:32:06 +0000 (UTC)
commit 3ebe78e7a5e621e9c6f731d23a755e62168e2764
Author: Kalev Lember <klember redhat com>
Date: Tue Feb 23 13:46:51 2016 +0100
Move header bar button creation into individual pages
Instead of having page specific header bar buttons defined in the global
gnome-software.ui, move the button handling to individual pages and add
an abstraction in GsShell to show the currently visible page's buttons
in the header bar.
This makes the mode switching code much more self contained, so that we
don't have to leak all the individual page's header bar widgets into the
global GsShell code any more.
src/gnome-software.ui | 60 -----------------------------
src/gs-page.c | 36 +++++++++++++++++
src/gs-page.h | 6 +++
src/gs-shell-installed.c | 33 ++++++++--------
src/gs-shell-updates.c | 66 ++++++++++++++++++--------------
src/gs-shell.c | 94 ++++++++++++++++++++++++++++++++++++---------
6 files changed, 171 insertions(+), 124 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 03d1ef2..3efd34c 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -17,16 +17,6 @@
</object>
</child>
</object>
- <object class="GtkImage" id="button_select_image">
- <property name="visible">True</property>
- <property name="icon_size">0</property>
- <property name="icon_name">object-select-symbolic</property>
- </object>
- <object class="GtkImage" id="button_refresh_image">
- <property name="visible">True</property>
- <property name="icon_size">0</property>
- <property name="icon_name">view-refresh-symbolic</property>
- </object>
<object class="GtkApplicationWindow" id="window_software">
<property name="can_focus">False</property>
<property name="default-width">1200</property>
@@ -252,56 +242,6 @@
</child>
</object>
</child>
- <child>
- <object class="GtkButton" id="button_update_all">
- <property name="use_underline">True</property>
- <property name="label" translatable="yes">Restart & _Install</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_select">
- <property name="image">button_select_image</property>
- <property name="can_focus">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="button-select-accessible">
- <property name="accessible-name" translatable="yes">Select</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_refresh">
- <property name="image">button_refresh_image</property>
- <property name="can_focus">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="button-refresh-accessible">
- <property name="accessible-name" translatable="yes">Check for updates</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinner" id="header_spinner_start">
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gs-page.c b/src/gs-page.c
index fed8fcf..fdd1621 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -34,6 +34,8 @@ typedef struct
GsPluginLoader *plugin_loader;
GCancellable *cancellable;
GsShell *shell;
+ GtkWidget *header_start_widget;
+ GtkWidget *header_end_widget;
} GsPagePrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GsPage, gs_page, GTK_TYPE_BIN)
@@ -122,6 +124,38 @@ out:
install_remove_data_free (data);
}
+GtkWidget *
+gs_page_get_header_start_widget (GsPage *page)
+{
+ GsPagePrivate *priv = gs_page_get_instance_private (page);
+
+ return priv->header_start_widget;
+}
+
+void
+gs_page_set_header_start_widget (GsPage *page, GtkWidget *widget)
+{
+ GsPagePrivate *priv = gs_page_get_instance_private (page);
+
+ g_set_object (&priv->header_start_widget, widget);
+}
+
+GtkWidget *
+gs_page_get_header_end_widget (GsPage *page)
+{
+ GsPagePrivate *priv = gs_page_get_instance_private (page);
+
+ return priv->header_end_widget;
+}
+
+void
+gs_page_set_header_end_widget (GsPage *page, GtkWidget *widget)
+{
+ GsPagePrivate *priv = gs_page_get_instance_private (page);
+
+ g_set_object (&priv->header_end_widget, widget);
+}
+
void
gs_page_install_app (GsPage *page, GsApp *app)
{
@@ -321,6 +355,8 @@ gs_page_dispose (GObject *object)
g_clear_object (&priv->plugin_loader);
g_clear_object (&priv->cancellable);
+ g_clear_object (&priv->header_start_widget);
+ g_clear_object (&priv->header_end_widget);
G_OBJECT_CLASS (gs_page_parent_class)->dispose (object);
}
diff --git a/src/gs-page.h b/src/gs-page.h
index b2a4145..a06505b 100644
--- a/src/gs-page.h
+++ b/src/gs-page.h
@@ -47,6 +47,12 @@ struct _GsPageClass
};
GsPage *gs_page_new (void);
+GtkWidget *gs_page_get_header_start_widget (GsPage *page);
+void gs_page_set_header_start_widget (GsPage *page,
+ GtkWidget *widget);
+GtkWidget *gs_page_get_header_end_widget (GsPage *page);
+void gs_page_set_header_end_widget (GsPage *page,
+ GtkWidget *widget);
void gs_page_install_app (GsPage *page,
GsApp *app);
void gs_page_remove_app (GsPage *page,
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 3e304a9..078176d 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -46,6 +46,7 @@ struct _GsShellInstalled
gboolean cache_valid;
gboolean waiting;
GsShell *shell;
+ GtkWidget *button_select;
gboolean selection_mode;
GtkWidget *bottom_install;
@@ -274,8 +275,7 @@ gs_shell_installed_switch_to (GsPage *page, gboolean scroll_up)
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "buttonbox_main"));
gtk_widget_show (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_select"));
- gtk_widget_show (widget);
+ gtk_widget_show (self->button_select);
if (scroll_up) {
GtkAdjustment *adj;
@@ -510,11 +510,10 @@ set_selection_mode (GsShellInstalled *self, gboolean selection_mode)
if (self->selection_mode) {
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), FALSE);
gtk_style_context_add_class (context, "selection-mode");
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_select"));
- gtk_button_set_image (GTK_BUTTON (widget), NULL);
- gtk_button_set_label (GTK_BUTTON (widget), _("_Cancel"));
- gtk_button_set_use_underline (GTK_BUTTON (widget), TRUE);
- gtk_widget_show (widget);
+ gtk_button_set_image (GTK_BUTTON (self->button_select), NULL);
+ gtk_button_set_label (GTK_BUTTON (self->button_select), _("_Cancel"));
+ gtk_button_set_use_underline (GTK_BUTTON (self->button_select), TRUE);
+ gtk_widget_show (self->button_select);
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "buttonbox_main"));
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "header_selection_menu_button"));
@@ -524,10 +523,9 @@ set_selection_mode (GsShellInstalled *self, gboolean selection_mode)
} else {
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
gtk_style_context_remove_class (context, "selection-mode");
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_select"));
- gtk_button_set_image (GTK_BUTTON (widget), gtk_image_new_from_icon_name
("object-select-symbolic", GTK_ICON_SIZE_MENU));
- gtk_button_set_label (GTK_BUTTON (widget), NULL);
- gtk_widget_show (widget);
+ gtk_button_set_image (GTK_BUTTON (self->button_select), gtk_image_new_from_icon_name
("object-select-symbolic", GTK_ICON_SIZE_MENU));
+ gtk_button_set_label (GTK_BUTTON (self->button_select), NULL);
+ gtk_widget_show (self->button_select);
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "buttonbox_main"));
gtk_widget_show (widget);
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "header_selection_menu_button"));
@@ -676,6 +674,7 @@ gs_shell_installed_setup (GsShellInstalled *self,
GtkBuilder *builder,
GCancellable *cancellable)
{
+ AtkObject *accessible;
GtkWidget *widget;
g_return_if_fail (GS_IS_SHELL_INSTALLED (self));
@@ -708,14 +707,14 @@ gs_shell_installed_setup (GsShellInstalled *self,
g_signal_connect (self->button_folder_remove, "clicked",
G_CALLBACK (remove_folders), self);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_select"));
- g_signal_connect (widget, "clicked",
+ self->button_select = gtk_button_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
+ accessible = gtk_widget_get_accessible (self->button_select);
+ if (accessible != NULL)
+ atk_object_set_name (accessible, _("Select"));
+ gs_page_set_header_end_widget (GS_PAGE (self), self->button_select);
+ g_signal_connect (self->button_select, "clicked",
G_CALLBACK (selection_mode_cb), self);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_select"));
- gtk_button_set_image (GTK_BUTTON (widget), gtk_image_new_from_icon_name ("object-select-symbolic",
GTK_ICON_SIZE_MENU));
- gtk_button_set_label (GTK_BUTTON (widget), NULL);
-
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "select_all_menuitem"));
g_signal_connect (widget, "activate",
G_CALLBACK (select_all_cb), self);
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 72a083c..a2e881f 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -67,6 +67,10 @@ struct _GsShellUpdates
GNetworkMonitor *network_monitor;
GsPluginStatus last_status;
GsShellUpdatesState state;
+ GtkWidget *button_refresh;
+ GtkWidget *button_update_all;
+ GtkWidget *header_spinner_start;
+ GtkWidget *header_start_box;
gboolean has_agreed_to_mobile_data;
gboolean ampm_available;
@@ -204,7 +208,6 @@ gs_shell_updates_get_state_string (GsPluginStatus status)
static void
gs_shell_updates_update_ui_state (GsShellUpdates *self)
{
- GtkWidget *widget;
gboolean allow_mobile_refresh = TRUE;
g_autofree gchar *checked_str = NULL;
g_autofree gchar *spinner_str = NULL;
@@ -260,11 +263,10 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
}
/* headerbar spinner */
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "header_spinner_start"));
switch (self->state) {
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_HAS_UPDATES:
- gtk_widget_show (widget);
- gtk_spinner_start (GTK_SPINNER (widget));
+ gtk_widget_show (self->header_spinner_start);
+ gtk_spinner_start (GTK_SPINNER (self->header_spinner_start));
break;
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_NO_UPDATES:
case GS_SHELL_UPDATES_STATE_ACTION_GET_UPDATES:
@@ -273,8 +275,8 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
case GS_SHELL_UPDATES_STATE_HAS_UPDATES:
case GS_SHELL_UPDATES_STATE_STARTUP:
case GS_SHELL_UPDATES_STATE_FAILED:
- gtk_spinner_stop (GTK_SPINNER (widget));
- gtk_widget_hide (widget);
+ gtk_spinner_stop (GTK_SPINNER (self->header_spinner_start));
+ gtk_widget_hide (self->header_spinner_start);
break;
default:
g_assert_not_reached ();
@@ -282,37 +284,32 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
}
/* headerbar refresh icon */
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh_image"));
switch (self->state) {
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_HAS_UPDATES:
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_NO_UPDATES:
- gtk_image_set_from_icon_name (GTK_IMAGE (widget),
+ gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
"media-playback-stop-symbolic", GTK_ICON_SIZE_MENU);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
- gtk_widget_show (widget);
+ gtk_widget_show (self->button_refresh);
break;
case GS_SHELL_UPDATES_STATE_ACTION_GET_UPDATES:
case GS_SHELL_UPDATES_STATE_STARTUP:
case GS_SHELL_UPDATES_STATE_MANAGED:
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
- gtk_widget_hide (widget);
+ gtk_widget_hide (self->button_refresh);
break;
case GS_SHELL_UPDATES_STATE_FAILED:
case GS_SHELL_UPDATES_STATE_HAS_UPDATES:
- gtk_image_set_from_icon_name (GTK_IMAGE (widget),
+ gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
"view-refresh-symbolic", GTK_ICON_SIZE_MENU);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
- gtk_widget_show (widget);
+ gtk_widget_show (self->button_refresh);
break;
case GS_SHELL_UPDATES_STATE_NO_UPDATES:
- gtk_image_set_from_icon_name (GTK_IMAGE (widget),
+ gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON
(self->button_refresh))),
"view-refresh-symbolic", GTK_ICON_SIZE_MENU);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
if (self->network_monitor != NULL &&
g_network_monitor_get_network_metered (self->network_monitor) &&
!self->has_agreed_to_mobile_data)
allow_mobile_refresh = FALSE;
- gtk_widget_set_visible (widget, allow_mobile_refresh);
+ gtk_widget_set_visible (self->button_refresh, allow_mobile_refresh);
break;
default:
g_assert_not_reached ();
@@ -320,11 +317,10 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
}
/* headerbar update button */
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_update_all"));
switch (self->state) {
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_HAS_UPDATES:
case GS_SHELL_UPDATES_STATE_HAS_UPDATES:
- gtk_widget_show (widget);
+ gtk_widget_show (self->button_update_all);
break;
case GS_SHELL_UPDATES_STATE_STARTUP:
case GS_SHELL_UPDATES_STATE_ACTION_REFRESH_NO_UPDATES:
@@ -332,7 +328,7 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
case GS_SHELL_UPDATES_STATE_NO_UPDATES:
case GS_SHELL_UPDATES_STATE_MANAGED:
case GS_SHELL_UPDATES_STATE_FAILED:
- gtk_widget_hide (widget);
+ gtk_widget_hide (self->button_update_all);
break;
default:
g_assert_not_reached ();
@@ -569,8 +565,7 @@ gs_shell_updates_switch_to (GsPage *page,
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "buttonbox_main"));
gtk_widget_show (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
- gtk_widget_set_visible (widget, TRUE);
+ gtk_widget_set_visible (self->button_refresh, TRUE);
if (scroll_up) {
GtkAdjustment *adj;
@@ -1107,7 +1102,7 @@ gs_shell_updates_setup (GsShellUpdates *self,
GtkBuilder *builder,
GCancellable *cancellable)
{
- GtkWidget *widget;
+ AtkObject *accessible;
g_return_if_fail (GS_IS_SHELL_UPDATES (self));
@@ -1135,14 +1130,29 @@ gs_shell_updates_setup (GsShellUpdates *self,
g_signal_connect (self->upgrade_banner, "install-button-clicked",
G_CALLBACK (gs_shell_updates_install_upgrade_cb), self);
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_update_all"));
- g_signal_connect (widget, "clicked", G_CALLBACK (gs_shell_updates_button_update_all_cb), self);
+ self->button_update_all = gtk_button_new_with_mnemonic (_("Restart & _Install"));
+ gtk_widget_set_visible (self->button_update_all, TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (self->button_update_all),
"suggested-action");
+ gs_page_set_header_end_widget (GS_PAGE (self), self->button_update_all);
+ g_signal_connect (self->button_update_all, "clicked", G_CALLBACK
(gs_shell_updates_button_update_all_cb), self);
+
+ self->header_start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_widget_set_visible (self->header_start_box, TRUE);
+ gs_page_set_header_start_widget (GS_PAGE (self), self->header_start_box);
+
+ self->header_spinner_start = gtk_spinner_new ();
+ gtk_box_pack_end (GTK_BOX (self->header_start_box), self->header_spinner_start, FALSE, FALSE, 0);
/* setup update details window */
- widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_refresh"));
- g_signal_connect (widget, "clicked",
+ self->button_refresh = gtk_button_new_from_icon_name ("view-refresh-symbolic", GTK_ICON_SIZE_MENU);
+ accessible = gtk_widget_get_accessible (self->button_refresh);
+ if (accessible != NULL)
+ atk_object_set_name (accessible, _("Check for updates"));
+ gtk_box_pack_start (GTK_BOX (self->header_start_box), self->button_refresh, FALSE, FALSE, 0);
+ g_signal_connect (self->button_refresh, "clicked",
G_CALLBACK (gs_shell_updates_button_refresh_cb),
self);
+
g_signal_connect (self->button_updates_mobile, "clicked",
G_CALLBACK (gs_shell_updates_button_mobile_refresh_cb),
self);
diff --git a/src/gs-shell.c b/src/gs-shell.c
index fda8a86..2563c1a 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -71,6 +71,8 @@ typedef struct
GsShellDetails *shell_details;
GsShellCategory *shell_category;
GsShellExtras *shell_extras;
+ GtkWidget *header_start_widget;
+ GtkWidget *header_end_widget;
GtkBuilder *builder;
GtkWindow *main_window;
GQueue *back_entry_stack;
@@ -116,6 +118,58 @@ gs_shell_activate (GsShell *shell)
gtk_window_present (priv->main_window);
}
+static void
+gs_shell_set_header_start_widget (GsShell *shell, GtkWidget *widget)
+{
+ GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+ GtkWidget *old_widget;
+ GtkWidget *header;
+
+ old_widget = priv->header_start_widget;
+ header = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
+
+ if (priv->header_start_widget == widget)
+ return;
+
+ if (widget != NULL) {
+ g_object_ref (widget);
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (header), widget);
+ }
+
+ priv->header_start_widget = widget;
+
+ if (old_widget != NULL) {
+ gtk_container_remove (GTK_CONTAINER (header), old_widget);
+ g_object_unref (old_widget);
+ }
+}
+
+static void
+gs_shell_set_header_end_widget (GsShell *shell, GtkWidget *widget)
+{
+ GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+ GtkWidget *old_widget;
+ GtkWidget *header;
+
+ old_widget = priv->header_end_widget;
+ header = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header"));
+
+ if (priv->header_end_widget == widget)
+ return;
+
+ if (widget != NULL) {
+ g_object_ref (widget);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), widget);
+ }
+
+ priv->header_end_widget = widget;
+
+ if (old_widget != NULL) {
+ gtk_container_remove (GTK_CONTAINER (header), old_widget);
+ g_object_unref (old_widget);
+ }
+}
+
void
gs_shell_change_mode (GsShell *shell,
GsShellMode mode,
@@ -124,6 +178,7 @@ gs_shell_change_mode (GsShell *shell,
gboolean scroll_up)
{
GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+ GsPage *new_page;
GtkWidget *widget;
const gchar *text;
GtkStyleContext *context;
@@ -137,15 +192,6 @@ gs_shell_change_mode (GsShell *shell,
/* hide all mode specific header widgets here, they will be shown in the
* refresh functions
*/
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_all"));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header_spinner_start"));
- gtk_spinner_stop (GTK_SPINNER (widget));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_select"));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_refresh"));
- gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_header"));
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
@@ -187,42 +233,50 @@ gs_shell_change_mode (GsShell *shell,
priv->mode = mode;
switch (mode) {
case GS_SHELL_MODE_OVERVIEW:
- gs_page_switch_to (GS_PAGE (priv->shell_overview), scroll_up);
+ new_page = GS_PAGE (priv->shell_overview);
break;
case GS_SHELL_MODE_INSTALLED:
- gs_page_switch_to (GS_PAGE (priv->shell_installed), scroll_up);
+ new_page = GS_PAGE (priv->shell_installed);
break;
case GS_SHELL_MODE_MODERATE:
- gs_page_switch_to (GS_PAGE (priv->shell_moderate), scroll_up);
+ new_page = GS_PAGE (priv->shell_moderate);
break;
case GS_SHELL_MODE_SEARCH:
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "entry_search"));
text = gtk_entry_get_text (GTK_ENTRY (widget));
gs_shell_search_set_text (priv->shell_search, text);
- gs_page_switch_to (GS_PAGE (priv->shell_search), scroll_up);
+ new_page = GS_PAGE (priv->shell_search);
break;
case GS_SHELL_MODE_UPDATES:
- gs_page_switch_to (GS_PAGE (priv->shell_updates), scroll_up);
+ new_page = GS_PAGE (priv->shell_updates);
break;
case GS_SHELL_MODE_DETAILS:
- if (app != NULL) {
+ if (app != NULL)
gs_shell_details_set_app (priv->shell_details, app);
- gs_page_switch_to (GS_PAGE (priv->shell_details), scroll_up);
- }
if (data != NULL)
gs_shell_details_set_filename (priv->shell_details, data);
+ new_page = GS_PAGE (priv->shell_details);
break;
case GS_SHELL_MODE_CATEGORY:
gs_shell_category_set_category (priv->shell_category,
GS_CATEGORY (data));
- gs_page_switch_to (GS_PAGE (priv->shell_category), scroll_up);
+ new_page = GS_PAGE (priv->shell_category);
break;
case GS_SHELL_MODE_EXTRAS:
- gs_page_switch_to (GS_PAGE (priv->shell_extras), scroll_up);
+ new_page = GS_PAGE (priv->shell_extras);
break;
default:
g_assert_not_reached ();
}
+
+ gs_page_switch_to (new_page, scroll_up);
+
+ /* update header bar widgets */
+ widget = gs_page_get_header_start_widget (new_page);
+ gs_shell_set_header_start_widget (shell, widget);
+
+ widget = gs_page_get_header_end_widget (new_page);
+ gs_shell_set_header_end_widget (shell, widget);
}
/**
@@ -852,6 +906,8 @@ gs_shell_dispose (GObject *object)
g_clear_object (&priv->builder);
g_clear_object (&priv->cancellable);
g_clear_object (&priv->plugin_loader);
+ g_clear_object (&priv->header_start_widget);
+ g_clear_object (&priv->header_end_widget);
G_OBJECT_CLASS (gs_shell_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]