[gnome-photos/wip/rishi/enable-gear-menu-when-item-is-loaded] main-toolbar: Enable the gear menu only when the item is loaded
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/enable-gear-menu-when-item-is-loaded] main-toolbar: Enable the gear menu only when the item is loaded
- Date: Sat, 2 Feb 2019 08:37:58 +0000 (UTC)
commit 354f925dc26f26b41ba5fe8e673f56c812c18bc0
Author: Yi-Soo An <yisooan gmail com>
Date: Sat Feb 2 09:25:45 2019 +0100
main-toolbar: Enable the gear menu only when the item is loaded
The "app.gear-menu" GAction is enabled and disabled from both
photos_application_actions_update and the MainToolbar when the mode
changes. This makes things unpredictable by relying on the order in
which the callbacks are invoked. Currently the MainToolbar was
winning and rendering parts of commit 031df27c42a99c83 ineffective.
Instead, this should only be handled in one place -
photos_application_actions_update. It's a lot more fine-grained and
informed than the MainToolbar itself. eg., the MainToolbar only knows
about the mode changing to PREVIEW, but doesn't know whether the item
has finished loading.
This code was added in commit 7e12154b23933562, and the above rationale
held true even then. However, back then, the item's loading state was
not looked at. This is probably why the problem got overlooked.
https://gitlab.gnome.org/GNOME/gnome-photos/merge_requests/94
src/photos-main-toolbar.c | 6 ------
1 file changed, 6 deletions(-)
---
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index d82796b9..df0ef79b 100644
--- a/src/photos-main-toolbar.c
+++ b/src/photos-main-toolbar.c
@@ -45,7 +45,6 @@ struct _PhotosMainToolbar
{
GtkBox parent_instance;
GAction *search;
- GSimpleAction *gear_menu;
GtkWidget *favorite_button;
GtkWidget *header_bar;
GtkWidget *remote_display_button;
@@ -381,8 +380,6 @@ photos_main_toolbar_clear_toolbar (PhotosMainToolbar *self)
gtk_container_foreach (GTK_CONTAINER (self->header_bar), (GtkCallback) gtk_widget_destroy, NULL);
context = gtk_widget_get_style_context (self->header_bar);
gtk_style_context_remove_class (context, "selection-mode");
-
- g_simple_action_set_enabled (self->gear_menu, FALSE);
}
@@ -578,8 +575,6 @@ photos_main_toolbar_populate_for_preview (PhotosMainToolbar *self)
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (menu_button), G_MENU_MODEL (preview_menu));
gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header_bar), menu_button);
- g_simple_action_set_enabled (self->gear_menu, TRUE);
-
share_button = gtk_button_new_from_icon_name ("emblem-shared-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_actionable_set_action_name (GTK_ACTIONABLE (share_button), "app.share-current");
gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header_bar), share_button);
@@ -718,7 +713,6 @@ photos_main_toolbar_init (PhotosMainToolbar *self)
app = g_application_get_default ();
state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
- self->gear_menu = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (app), "gear-menu"));
self->search = g_action_map_lookup_action (G_ACTION_MAP (app), "search");
action = g_action_map_lookup_action (G_ACTION_MAP (app), "selection-mode");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]