[mousetweaks] Sync with GSettings changes in gnome-settings-daemon
- From: Gerd Kohlberger <gerdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetweaks] Sync with GSettings changes in gnome-settings-daemon
- Date: Thu, 14 Oct 2010 13:28:16 +0000 (UTC)
commit 9b3a1af19989862cb1212db46fe1b973ad40bd70
Author: Gerd Kohlberger <gerdk src gnome org>
Date: Thu Oct 14 15:23:54 2010 +0200
Sync with GSettings changes in gnome-settings-daemon
- New dependency: gnome-settings-daemon >= 2.91.0
- GSettings keys used by the g-s-d mouse plugin have moved to
org.gnome.settings-daemon.peripherals.mouse
configure.ac | 2 +
data/org.gnome.mousetweaks.gschema.xml.in | 10 -------
src/Makefile.am | 2 -
src/dwell-click-applet.c | 33 ++++++++++++----------
src/mt-common.h | 9 ++++--
src/mt-main.c | 4 +-
src/mt-settings.c | 43 +++++++++++++++++-----------
src/mt-settings.h | 3 +-
8 files changed, 56 insertions(+), 50 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8146d80..ac44a9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,12 +47,14 @@ GLIB_REQUIRED=2.25.3
GIO_REQUIRED=2.25.9
GTK_REQUIRED=2.91.0
GCONF_REQUIRED=2.31.1
+GSD_REQUIRED=2.91.0
PKG_CHECK_MODULES(DEPENDENCIES,
glib-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GIO_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
gconf-2.0 >= $GCONF_REQUIRED
+ gnome-settings-daemon >= $GSD_REQUIRED
x11
xcursor
xfixes
diff --git a/data/org.gnome.mousetweaks.gschema.xml.in b/data/org.gnome.mousetweaks.gschema.xml.in
index 2c1f8d0..b7ac349 100644
--- a/data/org.gnome.mousetweaks.gschema.xml.in
+++ b/data/org.gnome.mousetweaks.gschema.xml.in
@@ -1,10 +1,5 @@
<schemalist>
<schema id="org.gnome.mousetweaks" path="/desktop/gnome/accessibility/mouse/" gettext-domain="mousetweaks">
- <key name="dwell-enabled" type="b">
- <default>false</default>
- <_summary>Enable dwell click</_summary>
- <_description>Enable dwell click.</_description>
- </key>
<key name="dwell-time" type="d">
<default>1.20</default>
<_summary>Dwell click time</_summary>
@@ -50,11 +45,6 @@
<_summary>Click type window style</_summary>
<_description>Button style in the click type window. ("0" = Text, "1" = Icon, "2" = Both)</_description>
</key>
- <key name="ssc-enabled" type="b">
- <default>false</default>
- <_summary>Enable secondary click</_summary>
- <_description>Enable simulated secondary click.</_description>
- </key>
<key name="ssc-time" type="d">
<default>1.20</default>
<_summary>Secondary click time</_summary>
diff --git a/src/Makefile.am b/src/Makefile.am
index e210033..f0c1c38 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,8 +46,6 @@ mousetweaks_LDADD = \
dwell_click_applet_SOURCES = \
dwell-click-applet.c \
- mt-timer.c \
- mt-timer.h \
mt-common.c \
mt-common.h
diff --git a/src/dwell-click-applet.c b/src/dwell-click-applet.c
index ea31540..9d06d82 100644
--- a/src/dwell-click-applet.c
+++ b/src/dwell-click-applet.c
@@ -28,7 +28,8 @@
typedef struct _DwellData DwellData;
struct _DwellData
{
- GSettings *settings;
+ GSettings *mt_settings;
+ GSettings *gsd_settings;
GDBusProxy *proxy;
GtkBuilder *ui;
GtkWidget *box;
@@ -89,7 +90,7 @@ update_sensitivity (DwellData *dd)
gint mode;
dwell = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dd->enable));
- mode = g_settings_get_int (dd->settings, KEY_DWELL_MODE);
+ mode = g_settings_get_int (dd->mt_settings, KEY_DWELL_MODE);
sensitive = dd->active && dwell && mode == DWELL_MODE_CTW;
gtk_widget_set_sensitive (dd->ct_box, sensitive);
}
@@ -217,7 +218,7 @@ do_not_eat (GtkWidget *widget, GdkEventButton *bev, gpointer user)
static void
enable_dwell_changed (GtkToggleButton *button, DwellData *dd)
{
- g_settings_set_boolean (dd->settings,
+ g_settings_set_boolean (dd->gsd_settings,
KEY_DWELL_ENABLED,
gtk_toggle_button_get_active (button));
}
@@ -417,7 +418,7 @@ applet_orient_changed (PanelApplet *applet,
g_object_unref (dd->box);
}
- dwell = g_settings_get_boolean (dd->settings, KEY_DWELL_ENABLED);
+ dwell = g_settings_get_boolean (dd->gsd_settings, KEY_DWELL_ENABLED);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dd->enable), dwell);
update_sensitivity (dd);
}
@@ -432,7 +433,8 @@ applet_unrealized (GtkWidget *widget, DwellData *dd)
g_object_unref (dd->click[i]);
g_object_unref (dd->ui);
- g_object_unref (dd->settings);
+ g_object_unref (dd->mt_settings);
+ g_object_unref (dd->gsd_settings);
g_object_unref (dd->proxy);
g_timer_destroy (dd->timer);
@@ -582,7 +584,6 @@ fill_applet (PanelApplet *applet)
GError *error = NULL;
GtkWidget *about;
PanelAppletOrient orient;
- gboolean dwell;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -622,14 +623,16 @@ fill_applet (PanelApplet *applet)
G_CALLBACK (about_response), dd);
/* gsettings */
- dd->settings = g_settings_new (MT_SCHEMA_ID);
- g_signal_connect (dd->settings, "value::" KEY_DWELL_ENABLED,
- G_CALLBACK (dwell_enabled_changed), dd);
- g_signal_connect (dd->settings, "value::" KEY_DWELL_MODE,
+ dd->mt_settings = g_settings_new (MT_SCHEMA_ID);
+ g_signal_connect (dd->mt_settings, "value::" KEY_DWELL_MODE,
G_CALLBACK (dwell_mode_changed), dd);
- g_signal_connect (dd->settings, "value::" KEY_DWELL_TIME,
+ g_signal_connect (dd->mt_settings, "value::" KEY_DWELL_TIME,
G_CALLBACK (dwell_time_changed), dd);
+ dd->gsd_settings = g_settings_new (GSD_MOUSE_SCHEMA_ID);
+ g_signal_connect (dd->gsd_settings, "value::" KEY_DWELL_ENABLED,
+ G_CALLBACK (dwell_enabled_changed), dd);
+
/* icons */
dd->click[DWELL_CLICK_TYPE_SINGLE] =
gdk_pixbuf_new_from_file (DATADIR "/single-click.png", NULL);
@@ -672,10 +675,10 @@ fill_applet (PanelApplet *applet)
dd->button = WID ("single_click_v");
}
- dd->delay = g_settings_get_double (dd->settings, KEY_DWELL_TIME);
-
- dwell = g_settings_get_boolean (dd->settings, KEY_DWELL_ENABLED);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dd->enable), dwell);
+ dd->delay = g_settings_get_double (dd->mt_settings, KEY_DWELL_TIME);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dd->enable),
+ g_settings_get_boolean (dd->gsd_settings,
+ KEY_DWELL_ENABLED));
setup_box (dd);
gtk_widget_reparent (dd->box, GTK_WIDGET (applet));
diff --git a/src/mt-common.h b/src/mt-common.h
index 6b9525e..9f2f6b7 100644
--- a/src/mt-common.h
+++ b/src/mt-common.h
@@ -37,9 +37,8 @@ G_BEGIN_DECLS
#define MOUSETWEAKS_DBUS_PATH "/org/gnome/Mousetweaks"
/* GSettings */
-#define MT_SCHEMA_ID "org.gnome.mousetweaks"
+#define MT_SCHEMA_ID "org.gnome.mousetweaks"
-#define KEY_DWELL_ENABLED "dwell-enabled"
#define KEY_DWELL_TIME "dwell-time"
#define KEY_DWELL_THRESHOLD "dwell-threshold"
#define KEY_DWELL_MODE "dwell-mode"
@@ -47,12 +46,16 @@ G_BEGIN_DECLS
#define KEY_DWELL_GESTURE_DOUBLE "dwell-gesture-double"
#define KEY_DWELL_GESTURE_DRAG "dwell-gesture-drag"
#define KEY_DWELL_GESTURE_SECONDARY "dwell-gesture-secondary"
-#define KEY_SSC_ENABLED "ssc-enabled"
#define KEY_SSC_TIME "ssc-time"
#define KEY_CTW_VISIBLE "ctw-visible"
#define KEY_CTW_STYLE "ctw-style"
#define KEY_ANIMATE_CURSOR "animate-cursor"
+#define GSD_MOUSE_SCHEMA_ID "org.gnome.settings-daemon.peripherals.mouse"
+
+#define KEY_DWELL_ENABLED "dwell-click-enabled"
+#define KEY_SSC_ENABLED "secondary-click-enabled"
+
enum
{
DWELL_MODE_CTW = 0,
diff --git a/src/mt-main.c b/src/mt-main.c
index c533865..179e6fd 100644
--- a/src/mt-main.c
+++ b/src/mt-main.c
@@ -680,11 +680,11 @@ mt_main (int argc, char **argv, MtCliArgs cli_args)
ms = mt_settings_get_default ();
/* bind timers */
- g_settings_bind (ms->settings, KEY_SSC_TIME,
+ g_settings_bind (ms->mt_settings, KEY_SSC_TIME,
mt->ssc_timer, "target-time",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
- g_settings_bind (ms->settings, KEY_DWELL_TIME,
+ g_settings_bind (ms->mt_settings, KEY_DWELL_TIME,
mt->dwell_timer, "target-time",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
diff --git a/src/mt-settings.c b/src/mt-settings.c
index 823a0b7..d404fbe 100644
--- a/src/mt-settings.c
+++ b/src/mt-settings.c
@@ -22,8 +22,8 @@
#define PFLAGS (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
-#define BIND_PROP(p,k) (g_settings_bind (ms->settings, (k), ms, (p), \
- G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY))
+#define BIND_PROP(s,p,k) (g_settings_bind ((s), (k), ms, (p), \
+ G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY))
enum
{
@@ -46,19 +46,22 @@ G_DEFINE_TYPE (MtSettings, mt_settings, G_TYPE_OBJECT)
static void
mt_settings_init (MtSettings *ms)
{
- ms->settings = g_settings_new (MT_SCHEMA_ID);
+ ms->mt_settings = g_settings_new (MT_SCHEMA_ID);
- BIND_PROP ("dwell-enabled", KEY_DWELL_ENABLED);
- BIND_PROP ("dwell-threshold", KEY_DWELL_THRESHOLD);
- BIND_PROP ("dwell-mode", KEY_DWELL_MODE);
- BIND_PROP ("dwell-gesture-single", KEY_DWELL_GESTURE_SINGLE);
- BIND_PROP ("dwell-gesture-double", KEY_DWELL_GESTURE_DOUBLE);
- BIND_PROP ("dwell-gesture-drag", KEY_DWELL_GESTURE_DRAG);
- BIND_PROP ("dwell-gesture-secondary", KEY_DWELL_GESTURE_SECONDARY);
- BIND_PROP ("ssc-enabled", KEY_SSC_ENABLED);
- BIND_PROP ("ctw-visible", KEY_CTW_VISIBLE);
- BIND_PROP ("ctw-style", KEY_CTW_STYLE);
- BIND_PROP ("animate-cursor", KEY_ANIMATE_CURSOR);
+ BIND_PROP (ms->mt_settings, "dwell-threshold", KEY_DWELL_THRESHOLD);
+ BIND_PROP (ms->mt_settings, "dwell-mode", KEY_DWELL_MODE);
+ BIND_PROP (ms->mt_settings, "dwell-gesture-single", KEY_DWELL_GESTURE_SINGLE);
+ BIND_PROP (ms->mt_settings, "dwell-gesture-double", KEY_DWELL_GESTURE_DOUBLE);
+ BIND_PROP (ms->mt_settings, "dwell-gesture-drag", KEY_DWELL_GESTURE_DRAG);
+ BIND_PROP (ms->mt_settings, "dwell-gesture-secondary", KEY_DWELL_GESTURE_SECONDARY);
+ BIND_PROP (ms->mt_settings, "ctw-visible", KEY_CTW_VISIBLE);
+ BIND_PROP (ms->mt_settings, "ctw-style", KEY_CTW_STYLE);
+ BIND_PROP (ms->mt_settings, "animate-cursor", KEY_ANIMATE_CURSOR);
+
+ ms->gsd_settings = g_settings_new (GSD_MOUSE_SCHEMA_ID);
+
+ BIND_PROP (ms->gsd_settings, "dwell-enabled", KEY_DWELL_ENABLED);
+ BIND_PROP (ms->gsd_settings, "ssc-enabled", KEY_SSC_ENABLED);
}
static void
@@ -66,10 +69,16 @@ mt_settings_dispose (GObject *object)
{
MtSettings *ms = MT_SETTINGS (object);
- if (ms->settings)
+ if (ms->mt_settings)
+ {
+ g_object_unref (ms->mt_settings);
+ ms->mt_settings = NULL;
+ }
+
+ if (ms->gsd_settings)
{
- g_object_unref (ms->settings);
- ms->settings = NULL;
+ g_object_unref (ms->gsd_settings);
+ ms->gsd_settings = NULL;
}
G_OBJECT_CLASS (mt_settings_parent_class)->dispose (object);
diff --git a/src/mt-settings.h b/src/mt-settings.h
index 3cf7378..5b485bb 100644
--- a/src/mt-settings.h
+++ b/src/mt-settings.h
@@ -35,7 +35,8 @@ struct _MtSettings
{
GObject parent;
- GSettings *settings;
+ GSettings *mt_settings;
+ GSettings *gsd_settings;
gint dwell_threshold;
gint dwell_mode;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]