[xfce4-settings 1/5] mouse settings dialog: add hide-cursor option
Andreas Müller
schnitzeltony at googlemail.com
Mon Nov 5 01:27:04 CET 2012
Signed-off-by: Andreas Müller <schnitzeltony at googlemail.com>
---
dialogs/mouse-settings/main.c | 56 +++++++++++++++++++++++++++++
dialogs/mouse-settings/mouse-dialog.glade | 28 ++++++++++++++-
2 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/dialogs/mouse-settings/main.c b/dialogs/mouse-settings/main.c
index f4b475b..c72940c 100644
--- a/dialogs/mouse-settings/main.c
+++ b/dialogs/mouse-settings/main.c
@@ -956,6 +956,50 @@ mouse_settings_device_set_enabled (GtkToggleButton *button,
+#ifdef HAVE_XCURSOR
+static void
+mouse_settings_on_hide_cursor (GtkToggleButton *button,
+ GtkBuilder *builder)
+{
+ gchar *name = NULL;
+ gchar *prop;
+ gboolean enabled;
+
+ if (locked > 0)
+ return;
+
+ if (mouse_settings_device_get_selected (builder, NULL, &name))
+ {
+ enabled = gtk_toggle_button_get_active (button);
+ prop = g_strconcat ("/", name, "/Hide_Cursor", NULL);
+ xfconf_channel_set_bool (pointers_channel, prop, enabled);
+ g_free (prop);
+ }
+ g_free (name);
+}
+
+static void
+mouse_settings_set_hide_cursor (GtkBuilder *builder)
+{
+ gchar *name = NULL;
+ gchar *prop;
+ gboolean enabled;
+ GtkToggleButton *button;
+
+ if (mouse_settings_device_get_selected (builder, NULL, &name))
+ {
+ button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "hide-cursor"));
+ prop = g_strconcat ("/", name, "/Hide_Cursor", NULL);
+ enabled = xfconf_channel_get_bool (pointers_channel, prop, FALSE);
+ gtk_toggle_button_set_active (button, enabled);
+ g_free (prop);
+ }
+ g_free (name);
+}
+#endif
+
+
+
static void
mouse_settings_device_selection_changed (GtkBuilder *builder)
{
@@ -1007,6 +1051,9 @@ mouse_settings_device_selection_changed (GtkBuilder *builder)
/* get the selected item */
if (mouse_settings_device_get_selected (builder, &device, NULL))
{
+#ifdef HAVE_XCURSOR
+ mouse_settings_set_hide_cursor (builder);
+#endif
gdk_error_trap_push ();
device_info = XListInputDevices (xdisplay, &ndevices);
if (gdk_error_trap_pop () == 0 && device_info != NULL)
@@ -1735,11 +1782,20 @@ main (gint argc, gchar **argv)
/* populate the themes treeview */
mouse_settings_themes_populate_store (builder);
+ /* connect & fill hide-cursor */
+ object = gtk_builder_get_object (builder, "hide-cursor");
+ g_signal_connect (G_OBJECT (object), "toggled",
+ G_CALLBACK (mouse_settings_on_hide_cursor), builder);
+ mouse_settings_set_hide_cursor (builder);
+
/* connect the cursor size in the cursor tab */
object = gtk_builder_get_object (builder, "theme-cursor-size");
xfconf_g_property_bind (xsettings_channel, "/Gtk/CursorThemeSize",
G_TYPE_INT, G_OBJECT (object), "value");
#else
+ /* hide hide-cursor */
+ object = gtk_builder_get_object (builder, "hide-cursor");
+ gtk_widget_hide (GTK_WIDGET (object));
/* hide the themes tab */
object = gtk_builder_get_object (builder, "themes-hbox");
gtk_widget_hide (GTK_WIDGET (object));
diff --git a/dialogs/mouse-settings/mouse-dialog.glade b/dialogs/mouse-settings/mouse-dialog.glade
index c92f3ca..37ad0fb 100644
--- a/dialogs/mouse-settings/mouse-dialog.glade
+++ b/dialogs/mouse-settings/mouse-dialog.glade
@@ -290,7 +290,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
@@ -382,6 +382,32 @@
<property name="bottom_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkAlignment" id="alignment8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkCheckButton" id="hide-cursor">
+ <property name="label" translatable="yes">_Hide pointer</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">When selected, no mouse pointer is displayed for this device</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
</object>
</child>
</object>
--
1.7.4.4
More information about the Xfce4-dev
mailing list