[gnome-photos/menu-retirement: 3/3] Refactor preview menu action name
- From: Yi-Soo An <yisooan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/menu-retirement: 3/3] Refactor preview menu action name
- Date: Mon, 21 Jan 2019 03:30:12 +0000 (UTC)
commit 46a6c5fc3c6f2536fc6a1ec2ebbf43f6093f9e10
Author: Yi-Soo An <yisooan gmail com>
Date: Mon Jan 21 12:21:27 2019 +0900
Refactor preview menu action name
Since primary menu has been added, all the name of actions related to
preview menu should have a prefix as preview or preview-menu instead of gear-menu.
That improve maintainability.
src/photos-application.c | 12 ++++++------
src/photos-main-toolbar.c | 8 +-------
2 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 26a71af6..16385e3c 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -91,13 +91,13 @@ struct _PhotosApplication
GSimpleAction *edit_done_action;
GSimpleAction *edit_revert_action;
GSimpleAction *fs_action;
- GSimpleAction *gear_action;
GSimpleAction *import_action;
GSimpleAction *import_cancel_action;
GSimpleAction *insta_action;
GSimpleAction *load_next_action;
GSimpleAction *load_previous_action;
GSimpleAction *open_action;
+ GSimpleAction *preview_menu_action;
GSimpleAction *primary_menu_action;
GSimpleAction *print_action;
GSimpleAction *properties_action;
@@ -527,7 +527,7 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (self->load_previous_action, enable);
enable = (load_state == PHOTOS_LOAD_STATE_FINISHED && mode == PHOTOS_WINDOW_MODE_PREVIEW);
- g_simple_action_set_enabled (self->gear_action, enable);
+ g_simple_action_set_enabled (self->preview_menu_action, enable);
g_simple_action_set_enabled (self->set_bg_action, enable);
g_simple_action_set_enabled (self->set_ss_action, enable);
g_simple_action_set_enabled (self->zoom_begin_action, enable);
@@ -2728,8 +2728,8 @@ photos_application_startup (GApplication *application)
self);
state = g_variant_new ("b", FALSE);
- self->gear_action = g_simple_action_new_stateful ("gear-menu", NULL, state);
- g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->gear_action));
+ self->preview_menu_action = g_simple_action_new_stateful ("preview-menu", NULL, state);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->preview_menu_action));
self->import_action = g_simple_action_new ("import-current", NULL);
g_signal_connect_swapped (self->import_action, "activate", G_CALLBACK (photos_application_import), self);
@@ -2882,8 +2882,8 @@ photos_application_startup (GApplication *application)
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.delete", delete_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.edit-current", edit_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.fullscreen", fullscreen_accels);
- gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.gear-menu", menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.help", help_menu_accels);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.preview-menu", menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.primary-menu", menu_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.print-current", print_current_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.save-current", save_accels);
@@ -2969,13 +2969,13 @@ photos_application_dispose (GObject *object)
g_clear_object (&self->edit_done_action);
g_clear_object (&self->edit_revert_action);
g_clear_object (&self->fs_action);
- g_clear_object (&self->gear_action);
g_clear_object (&self->import_action);
g_clear_object (&self->import_cancel_action);
g_clear_object (&self->insta_action);
g_clear_object (&self->load_next_action);
g_clear_object (&self->load_previous_action);
g_clear_object (&self->open_action);
+ g_clear_object (&self->preview_menu_action);
g_clear_object (&self->primary_menu_action);
g_clear_object (&self->print_action);
g_clear_object (&self->properties_action);
diff --git a/src/photos-main-toolbar.c b/src/photos-main-toolbar.c
index d82796b9..3040e07c 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);
}
@@ -573,13 +570,11 @@ photos_main_toolbar_populate_for_preview (PhotosMainToolbar *self)
preview_menu = photos_main_toolbar_create_preview_menu (self);
image = gtk_image_new_from_icon_name ("view-more-symbolic", GTK_ICON_SIZE_BUTTON);
menu_button = gtk_menu_button_new ();
- gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_button), "app.gear-menu");
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (menu_button), "app.preview-menu");
gtk_button_set_image (GTK_BUTTON (menu_button), image);
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]