[gnome-photos/wip/rishi/zoom: 2/4] application: Add zoom-in/out actions
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/zoom: 2/4] application: Add zoom-in/out actions
- Date: Thu, 6 Apr 2017 12:26:44 +0000 (UTC)
commit 3cd81ffd0b9ddd61a3e7b770c63a64047b9e1010
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Mar 29 11:03:39 2017 +0200
application: Add zoom-in/out actions
src/photos-application.c | 24 ++++++++++++++++++++++++
src/photos-help-overlay.ui | 21 +++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 89b575d..04c12de 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -110,6 +110,9 @@ struct _PhotosApplication
GSimpleAction *set_ss_action;
GSimpleAction *share_action;
GSimpleAction *sharpen_action;
+ GSimpleAction *zoom_best_fit_action;
+ GSimpleAction *zoom_in_action;
+ GSimpleAction *zoom_out_action;
GtkWidget *main_window;
PhotosBaseManager *shr_pnt_mngr;
PhotosCameraCache *camera_cache;
@@ -363,6 +366,9 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (self->gear_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_best_fit_action, enable);
+ g_simple_action_set_enabled (self->zoom_in_action, enable);
+ g_simple_action_set_enabled (self->zoom_out_action, enable);
enable = ((load_state == PHOTOS_LOAD_STATE_FINISHED && mode == PHOTOS_WINDOW_MODE_PREVIEW)
|| (selection_mode && item != NULL));
@@ -1658,6 +1664,9 @@ photos_application_startup (GApplication *application)
const gchar *save_accels[2] = {"<Primary>x", NULL};
const gchar *search_accels[2] = {"<Primary>f", NULL};
const gchar *select_all_accels[2] = {"<Primary>a", NULL};
+ const gchar *zoom_best_fit_accels[3] = {"<Primary>0", NULL};
+ const gchar *zoom_in_accels[3] = {"<Primary>plus", "<Primary>equal", NULL};
+ const gchar *zoom_out_accels[2] = {"<Primary>minus", NULL};
G_APPLICATION_CLASS (photos_application_parent_class)->startup (application);
@@ -1866,6 +1875,15 @@ photos_application_startup (GApplication *application)
self->sharpen_action = g_simple_action_new ("sharpen-current", G_VARIANT_TYPE_DOUBLE);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->sharpen_action));
+ self->zoom_best_fit_action = g_simple_action_new ("zoom-best-fit", NULL);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->zoom_best_fit_action));
+
+ self->zoom_in_action = g_simple_action_new ("zoom-in", NULL);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->zoom_in_action));
+
+ self->zoom_out_action = g_simple_action_new ("zoom-out", NULL);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->zoom_out_action));
+
g_signal_connect_swapped (self->state->mode_cntrlr,
"window-mode-changed",
G_CALLBACK (photos_application_window_mode_changed),
@@ -1886,6 +1904,9 @@ photos_application_startup (GApplication *application)
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.save-current", save_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.search", search_accels);
gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.select-all", select_all_accels);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.zoom-best-fit", zoom_best_fit_accels);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.zoom-in", zoom_in_accels);
+ gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.zoom-out", zoom_out_accels);
g_signal_connect_swapped (self->state->item_mngr,
"load-finished",
@@ -1959,6 +1980,9 @@ photos_application_dispose (GObject *object)
g_clear_object (&self->set_ss_action);
g_clear_object (&self->share_action);
g_clear_object (&self->sharpen_action);
+ g_clear_object (&self->zoom_best_fit_action);
+ g_clear_object (&self->zoom_in_action);
+ g_clear_object (&self->zoom_out_action);
g_clear_object (&self->shr_pnt_mngr);
g_clear_object (&self->camera_cache);
g_clear_object (&self->sel_cntrlr);
diff --git a/src/photos-help-overlay.ui b/src/photos-help-overlay.ui
index 5f00de8..ff09da7 100644
--- a/src/photos-help-overlay.ui
+++ b/src/photos-help-overlay.ui
@@ -146,6 +146,27 @@
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
+ <property name="title" translatable="yes" context="shortcut window">Zoom in</property>
+ <property name="accelerator"><Primary>plus</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes" context="shortcut window">Zoom out</property>
+ <property name="accelerator"><Primary>minus</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes" context="shortcut window">Best fit</property>
+ <property name="accelerator"><Primary>0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">1</property>
<property name="title" translatable="yes" context="shortcut window">Delete</property>
<property name="accelerator">Delete</property>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]