[eog-plugins] fit-to-width: Only enable plugin action if zoom is enabled
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog-plugins] fit-to-width: Only enable plugin action if zoom is enabled
- Date: Tue, 29 Sep 2015 14:17:29 +0000 (UTC)
commit bb2f47cb8f8e41e566c349a1fd896f663541c50f
Author: Felix Riemann <friemann gnome org>
Date: Tue Sep 29 13:42:47 2015 +0200
fit-to-width: Only enable plugin action if zoom is enabled
If the default zoom actions are not enabled it is unlikely
the fit-to-width zoom should be enabled as well.
Also fixes a critical warning if eog is started without an image.
https://bugzilla.gnome.org/show_bug.cgi?id=755244
plugins/fit-to-width/eog-fit-to-width-plugin.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/plugins/fit-to-width/eog-fit-to-width-plugin.c b/plugins/fit-to-width/eog-fit-to-width-plugin.c
index a4d4437..52330fe 100644
--- a/plugins/fit-to-width/eog-fit-to-width-plugin.c
+++ b/plugins/fit-to-width/eog-fit-to-width-plugin.c
@@ -100,6 +100,7 @@ impl_activate (EogWindowActivatable *activatable)
GMenu *model, *menu;
GMenuItem *item;
GSimpleAction *action;
+ GAction *ref_action;
model= eog_window_get_gear_menu_section (plugin->window,
"plugins-section");
@@ -112,6 +113,15 @@ impl_activate (EogWindowActivatable *activatable)
G_CALLBACK (fit_to_width_cb), plugin->window);
g_action_map_add_action (G_ACTION_MAP (plugin->window),
G_ACTION (action));
+
+ /* Bind to the zoom-normal action's enabled property to only enable
+ * fit-to-width zooming if zooming is generally enabled */
+ ref_action = g_action_map_lookup_action (G_ACTION_MAP (plugin->window),
+ "zoom-normal");
+ if (ref_action)
+ g_object_bind_property (ref_action, "enabled",
+ action, "enabled",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_unref (action);
/* Append entry to the window's gear menu */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]