Commit 159a2bab authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

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
parent a0d1b58e
......@@ -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;
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment