[Xfce4-commits] [xfce/xfce4-settings] 04/27: Add xfconf setting to enable find-cursor
noreply at xfce.org
noreply at xfce.org
Sun Feb 25 23:56:13 CET 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 2
in repository xfce/xfce4-settings.
commit be099e20b30246fe233d0d4a8e6f6656364a4f9b
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Tue Feb 20 20:40:34 2018 +0100
Add xfconf setting to enable find-cursor
Currently there is no keyboard shortcut bound, but the script
is only executed if the xfconf boolean setting is true.
---
dialogs/accessibility-settings/Makefile.am | 4 +++-
.../accessibility-dialog.glade | 17 +++++++++++++++++
dialogs/accessibility-settings/find-cursor.c | 22 ++++++++++++++++++++++
dialogs/accessibility-settings/main.c | 3 +++
4 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/dialogs/accessibility-settings/Makefile.am b/dialogs/accessibility-settings/Makefile.am
index 0f1ecce..33514e9 100644
--- a/dialogs/accessibility-settings/Makefile.am
+++ b/dialogs/accessibility-settings/Makefile.am
@@ -15,6 +15,7 @@ find_cursor_SOURCES = \
find_cursor_CFLAGS = \
$(GTK_CFLAGS) \
+ $(XFCONF_CFLAGS) \
$(PLATFORM_CFLAGS) \
-DGTK_DISABLE_SINGLE_INCLUDES \
-DGDK_DISABLE_DEPRECATED \
@@ -28,7 +29,8 @@ find_cursor_LDFLAGS = \
$(PLATFORM_LDFLAGS)
find_cursor_LDADD = \
- $(GTK_LIBS)
+ $(GTK_LIBS) \
+ $(XFCONF_LIBS)
xfce4_accessibility_settings_SOURCES = \
main.c \
diff --git a/dialogs/accessibility-settings/accessibility-dialog.glade b/dialogs/accessibility-settings/accessibility-dialog.glade
index bf097d1..e856672 100644
--- a/dialogs/accessibility-settings/accessibility-dialog.glade
+++ b/dialogs/accessibility-settings/accessibility-dialog.glade
@@ -894,6 +894,23 @@ next time you login</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="find-cursor">
+ <property name="label" translatable="yes">Show mouse pointer location</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Bind a keyboard shortcut to get visual feedback of the mouse pointer's current location</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/dialogs/accessibility-settings/find-cursor.c b/dialogs/accessibility-settings/find-cursor.c
index e1b3833..df2500d 100644
--- a/dialogs/accessibility-settings/find-cursor.c
+++ b/dialogs/accessibility-settings/find-cursor.c
@@ -31,6 +31,8 @@
#include <gdk/gdkx.h>
#include <math.h>
+#include <xfconf/xfconf.h>
+
/* global var to keep track of the circle size */
double px = 10;
@@ -115,6 +117,8 @@ find_cursor_window_draw (GtkWidget *window,
gint
main (gint argc, gchar **argv)
{
+ XfconfChannel *accessibility_channel = NULL;
+ GError *error = NULL;
GtkWidget *window;
GdkDisplay *display;
GdkSeat *seat;
@@ -122,6 +126,24 @@ main (gint argc, gchar **argv)
GdkScreen *screen;
gint x,y;
+ /* initialize xfconf */
+ if (!xfconf_init (&error))
+ {
+ /* print error and exit */
+ g_error ("Failed to connect to xfconf daemon: %s.", error->message);
+ g_error_free (error);
+
+ return EXIT_FAILURE;
+ }
+
+ /* open the channels */
+ accessibility_channel = xfconf_channel_new ("accessibility");
+
+ if (xfconf_channel_get_bool (accessibility_channel, "/FindCursor", TRUE))
+ g_warning ("continue");
+ else
+ return 0;
+
gtk_init (&argc, &argv);
/* just get the position of the mouse cursor */
diff --git a/dialogs/accessibility-settings/main.c b/dialogs/accessibility-settings/main.c
index 554975f..a92e3ad 100644
--- a/dialogs/accessibility-settings/main.c
+++ b/dialogs/accessibility-settings/main.c
@@ -155,6 +155,9 @@ accessibility_settings_dialog_configure_widgets (GtkBuilder *builder)
object = gtk_builder_get_object (builder, "mouse-emulation-curve");
xfconf_g_property_bind (accessibility_channel, "/MouseKeys/Curve", G_TYPE_INT, object, "value");
+
+ object = gtk_builder_get_object (builder, "find-cursor");
+ xfconf_g_property_bind (accessibility_channel, "/FindCursor", G_TYPE_BOOLEAN, object, "active");
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list