diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-08-04 17:46:44 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-08-04 20:30:28 -0300 |
commit | 4c3c8bd34bcc897c3730fc978c8828cb45ef6b77 (patch) | |
tree | a1d9449c4aa24ba2b981bf135b1a5c8fc592224e | |
parent | a8416ac61d6b9280eb24a727a4513434daa37689 (diff) | |
download | glade-wip/xjuan/action-cleanup.tar.gz |
GladeWindow: simplify pointer mode actionswip/xjuan/action-cleanup
Replace all pointer mode actions (select, drag, margin and align)
with a new action "pointer-mode" with a mode parameter
-rw-r--r-- | src/glade-window.c | 34 | ||||
-rw-r--r-- | src/glade.glade | 16 |
2 files changed, 20 insertions, 30 deletions
diff --git a/src/glade-window.c b/src/glade-window.c index c581d983..c290a399 100644 --- a/src/glade-window.c +++ b/src/glade-window.c @@ -36,6 +36,7 @@ #include <gladeui/glade-popup.h> #include <gladeui/glade-inspector.h> #include <gladeui/glade-adaptor-chooser.h> +#include <gladeui/gladeui-enum-types.h> #include <gladeui/glade-project.h> @@ -2088,27 +2089,16 @@ on_quit_action_activate (GSimpleAction *action, } static void -on_pointer_select_action_activate (GSimpleAction *action, GVariant *p, gpointer data) -{ - glade_project_set_pointer_mode (get_active_project (data), GLADE_POINTER_SELECT); -} - -static void -on_pointer_align_edit_action_activate (GSimpleAction *action, GVariant *p, gpointer data) -{ - glade_project_set_pointer_mode (get_active_project (data), GLADE_POINTER_ALIGN_EDIT); -} - -static void -on_pointer_drag_resize_action_activate (GSimpleAction *action, GVariant *p, gpointer data) +on_pointer_mode_action_activate (GSimpleAction *simple, + GVariant *parameter, + gpointer data) { - glade_project_set_pointer_mode (get_active_project (data), GLADE_POINTER_DRAG_RESIZE); -} + GladePointerMode mode; -static void -on_pointer_margin_edit_action_activate (GSimpleAction *action, GVariant *p, gpointer data) -{ - glade_project_set_pointer_mode (get_active_project (data), GLADE_POINTER_MARGIN_EDIT); + mode = glade_utils_enum_value_from_string (GLADE_TYPE_POINTER_MODE, + g_variant_get_string (parameter, + NULL)); + glade_project_set_pointer_mode (get_active_project (data), mode); } static void @@ -2376,11 +2366,7 @@ on_application_notify (GObject *gobject, GParamSpec *pspec) { "delete", on_delete_action_activate, NULL, NULL, NULL }, { "previous", on_previous_action_activate, NULL, NULL, NULL }, { "next", on_next_action_activate, NULL, NULL, NULL }, - /* Pointer mode actions */ - { "select", on_pointer_select_action_activate, NULL, NULL, NULL }, - { "drag_resize", on_pointer_drag_resize_action_activate, NULL, NULL, NULL }, - { "margin_edit", on_pointer_margin_edit_action_activate, NULL, NULL, NULL }, - { "align_edit", on_pointer_align_edit_action_activate, NULL, NULL, NULL }, + { "pointer-mode", on_pointer_mode_action_activate, "s", NULL, NULL }, }; GladeWindowPrivate * priv = GLADE_WINDOW (gobject)->priv; diff --git a/src/glade.glade b/src/glade.glade index 0a15e6f4..3badb77b 100644 --- a/src/glade.glade +++ b/src/glade.glade @@ -27,7 +27,7 @@ Author: Juan Pablo Ugarte <!-- interface-license-type lgplv2 --> <!-- interface-name Glade --> <!-- interface-description A user interface designer for GTK+ and GNOME. --> - <!-- interface-copyright 2012-2017 Juan Pablo Ugarte --> + <!-- interface-copyright 2012-2018 Juan Pablo Ugarte --> <!-- interface-authors Juan Pablo Ugarte --> <object class="GtkPopoverMenu" id="main_menu"> <property name="can_focus">False</property> @@ -273,7 +273,8 @@ Author: Juan Pablo Ugarte <object class="GtkToolButton" id="selector_button"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">app.select</property> + <property name="action_name">app.pointer-mode</property> + <property name="action_target">'select'</property> <property name="use_underline">True</property> <property name="icon_name">glade-selector</property> </object> @@ -286,7 +287,8 @@ Author: Juan Pablo Ugarte <object class="GtkToolButton" id="drag_resize_button"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">app.drag_resize</property> + <property name="action_name">app.pointer-mode</property> + <property name="action_target">'drag-resize'</property> <property name="use_underline">True</property> <property name="icon_name">glade-drag-resize</property> </object> @@ -299,7 +301,8 @@ Author: Juan Pablo Ugarte <object class="GtkToolButton" id="margin_edit_button"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">app.margin_edit</property> + <property name="action_name">app.pointer-mode</property> + <property name="action_target">'margin-edit'</property> <property name="use_underline">True</property> <property name="icon_name">glade-margin-edit</property> </object> @@ -312,7 +315,8 @@ Author: Juan Pablo Ugarte <object class="GtkToolButton" id="align_edit_button"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="action_name">app.align_edit</property> + <property name="action_name">app.pointer-mode</property> + <property name="action_target">'align-edit'</property> <property name="use_underline">True</property> <property name="icon_name">glade-align-edit</property> </object> @@ -722,7 +726,7 @@ Author: Juan Pablo Ugarte <property name="transient_for">GladeWindow</property> <property name="copyright" translatable="yes">Copyright © 2001-2006 Ximian, Inc. Copyright © 2001-2006 Joaquin Cuenca Abela, Paolo Borelli, et al. -Copyright © 2004-2017 Tristan Van Berkom, Juan Pablo Ugarte, et al.</property> +Copyright © 2004-2018 Tristan Van Berkom, Juan Pablo Ugarte, et al.</property> <property name="comments" translatable="yes">A user interface designer for GTK+ and GNOME.</property> <property name="website">http://glade.gnome.org</property> <property name="website_label" translatable="yes">Visit Glade web site</property> |