summaryrefslogtreecommitdiff
path: root/src/glade-window.c
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2018-08-04 17:46:44 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2018-08-11 18:51:24 -0300
commit159a2bab02fc7cf24ef84497051cae7463f16ef8 (patch)
tree923b4ebd7ede59747f9058e8012da20073e59a62 /src/glade-window.c
parenta0d1b58eeeac87088e0505235c772d9b8fd97959 (diff)
downloadglade-159a2bab02fc7cf24ef84497051cae7463f16ef8.tar.gz
GladeWindow: simplify pointer mode actions
Replace all pointer mode actions (select, drag, margin and align) with a new action "pointer-mode" with a mode parameter
Diffstat (limited to 'src/glade-window.c')
-rw-r--r--src/glade-window.c34
1 files changed, 10 insertions, 24 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;