[gpointing-device-settings] Should connect to widget signals in normal mode.
- From: Hiroyuki Ikezoe <hiikezoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gpointing-device-settings] Should connect to widget signals in normal mode.
- Date: Mon, 15 Mar 2010 11:09:04 +0000 (UTC)
commit 4e459c2d6d0e85be2dc2ee01532d8ab531be6d03
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date: Mon Mar 15 20:08:42 2010 +0900
Should connect to widget signals in normal mode.
to handle widgets' sensitivity.
modules/gpds-mouse-ui.c | 15 ++++++++-------
modules/gpds-pointingstick-ui.c | 7 ++++---
modules/gpds-touchpad-ui.c | 16 +++++++++++-----
src/gpds-ui.c | 14 ++++++++++++++
src/gpds-ui.h | 1 +
src/gpds-xinput-ui.h | 18 ++++++++++--------
6 files changed, 48 insertions(+), 23 deletions(-)
---
diff --git a/modules/gpds-mouse-ui.c b/modules/gpds-mouse-ui.c
index de0df1e..6757335 100644
--- a/modules/gpds-mouse-ui.c
+++ b/modules/gpds-mouse-ui.c
@@ -62,6 +62,7 @@ static void finish_dry_run (GpdsUI *ui, GError **error);
static gboolean apply (GpdsUI *ui, GError **error);
static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
static GdkPixbuf *get_icon_pixbuf (GpdsUI *ui, GError **error);
+static void disconnect_signals (GpdsUI *ui);
G_DEFINE_DYNAMIC_TYPE(GpdsMouseUI, gpds_mouse_ui, GPDS_TYPE_XINPUT_UI)
@@ -118,6 +119,7 @@ dispose (GObject *object)
GpdsMouseUI *ui = GPDS_MOUSE_UI(object);
g_free(ui->ui_file_path);
+ disconnect_signals(GPDS_UI(ui));
if (G_OBJECT_CLASS(gpds_mouse_ui_parent_class)->dispose)
G_OBJECT_CLASS(gpds_mouse_ui_parent_class)->dispose(object);
@@ -221,7 +223,8 @@ set_wheel_emulation_button_to_gconf (GpdsMouseUI *ui)
static void
cb_wheel_emulation_button_changed (GtkComboBox *combo, gpointer user_data)
{
- set_wheel_emulation_button_to_xinput(GPDS_MOUSE_UI(user_data));
+ if (gpds_ui_is_dry_run_mode(GPDS_UI(user_data)))
+ set_wheel_emulation_button_to_xinput(GPDS_MOUSE_UI(user_data));
}
static void
@@ -276,10 +279,9 @@ static void
cb_ ## name ## _toggled (GtkToggleButton *button, \
gpointer user_data) \
{ \
- gboolean enable; \
GpdsMouseUI *ui = GPDS_MOUSE_UI(user_data); \
- set_scroll_axes_property(ui); \
- enable = gtk_toggle_button_get_active(button); \
+ if (gpds_ui_is_dry_run_mode(GPDS_UI(user_data))) \
+ set_scroll_axes_property(ui); \
}
DEFINE_WHEEL_EMULATION_SCROLL_BUTTON_TOGGLED_CALLBACK(wheel_emulation_vertical, WHEEL_EMULATION_Y_AXIS)
@@ -540,6 +542,8 @@ build (GpdsUI *ui, GError **error)
gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "mouse");
set_gconf_values_to_widget(ui);
+ connect_signals(ui);
+
return TRUE;
}
@@ -613,8 +617,6 @@ dry_run (GpdsUI *ui, GError **error)
if (GPDS_UI_CLASS(gpds_mouse_ui_parent_class)->dry_run)
ret = GPDS_UI_CLASS(gpds_mouse_ui_parent_class)->dry_run(ui, error);
- connect_signals(ui);
-
set_widget_values_to_xinput(ui);
return TRUE;
@@ -623,7 +625,6 @@ dry_run (GpdsUI *ui, GError **error)
static void
finish_dry_run(GpdsUI *ui, GError **error)
{
- disconnect_signals(ui);
set_gconf_values_to_widget(ui);
if (GPDS_UI_CLASS(gpds_mouse_ui_parent_class)->finish_dry_run)
diff --git a/modules/gpds-pointingstick-ui.c b/modules/gpds-pointingstick-ui.c
index cbd9a18..38e8df7 100644
--- a/modules/gpds-pointingstick-ui.c
+++ b/modules/gpds-pointingstick-ui.c
@@ -62,6 +62,7 @@ static void finish_dry_run (GpdsUI *ui, GError **error);
static gboolean apply (GpdsUI *ui, GError **error);
static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
static GdkPixbuf *get_icon_pixbuf (GpdsUI *ui, GError **error);
+static void disconnect_signals (GpdsUI *ui);
G_DEFINE_DYNAMIC_TYPE(GpdsPointingStickUI, gpds_pointingstick_ui, GPDS_TYPE_XINPUT_UI)
@@ -118,6 +119,7 @@ dispose (GObject *object)
GpdsPointingStickUI *ui = GPDS_POINTINGSTICK_UI(object);
g_free(ui->ui_file_path);
+ disconnect_signals(GPDS_UI(ui));
if (G_OBJECT_CLASS(gpds_pointingstick_ui_parent_class)->dispose)
G_OBJECT_CLASS(gpds_pointingstick_ui_parent_class)->dispose(object);
@@ -265,6 +267,8 @@ build (GpdsUI *ui, GError **error)
gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "pointingstick");
set_gconf_values_to_widget(ui);
+ connect_signals(ui);
+
return TRUE;
}
@@ -338,8 +342,6 @@ dry_run (GpdsUI *ui, GError **error)
if (GPDS_UI_CLASS(gpds_pointingstick_ui_parent_class)->dry_run)
ret = GPDS_UI_CLASS(gpds_pointingstick_ui_parent_class)->dry_run(ui, error);
- connect_signals(ui);
-
set_widget_values_to_xinput(ui);
return TRUE;
@@ -348,7 +350,6 @@ dry_run (GpdsUI *ui, GError **error)
static void
finish_dry_run(GpdsUI *ui, GError **error)
{
- disconnect_signals(ui);
set_gconf_values_to_widget(ui);
if (GPDS_UI_CLASS(gpds_pointingstick_ui_parent_class)->finish_dry_run)
diff --git a/modules/gpds-touchpad-ui.c b/modules/gpds-touchpad-ui.c
index 6c12aed..3bbcda6 100644
--- a/modules/gpds-touchpad-ui.c
+++ b/modules/gpds-touchpad-ui.c
@@ -61,6 +61,7 @@ static void finish_dry_run (GpdsUI *ui, GError **error);
static gboolean apply (GpdsUI *ui, GError **error);
static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
static GdkPixbuf *get_icon_pixbuf (GpdsUI *ui, GError **error);
+static void disconnect_signals (GpdsUI *ui);
G_DEFINE_DYNAMIC_TYPE(GpdsTouchpadUI, gpds_touchpad_ui, GPDS_TYPE_XINPUT_UI)
@@ -116,6 +117,7 @@ dispose (GObject *object)
GpdsTouchpadUI *ui = GPDS_TOUCHPAD_UI(object);
g_free(ui->ui_file_path);
+ disconnect_signals(GPDS_UI(ui));
if (G_OBJECT_CLASS(gpds_touchpad_ui_parent_class)->dispose)
G_OBJECT_CLASS(gpds_touchpad_ui_parent_class)->dispose(object);
@@ -574,7 +576,8 @@ cb_touchpad_use_type_toggled (GtkToggleButton *button, gpointer user_data)
use_type = get_touchpad_use_type(ui);
set_sensitivity_depends_on_use_type(ui, use_type);
- set_touchpad_use_type_property(ui, use_type);
+ if (gpds_ui_is_dry_run_mode(ui))
+ set_touchpad_use_type_property(ui, use_type);
}
static void
@@ -643,7 +646,8 @@ cb_disable_tapping_toggled (GtkToggleButton *button, gpointer user_data)
disable_tapping = gtk_toggle_button_get_active(button);
- set_tap_time_property(ui);
+ if (gpds_ui_is_dry_run_mode(ui))
+ set_tap_time_property(ui);
builder = gpds_ui_get_builder(ui);
set_widget_sensitivity(builder, "tapping_frame", !disable_tapping);
@@ -683,6 +687,9 @@ cb_move_speed_scale_value_changed (GtkRange *range, gpointer user_data)
GtkBuilder *builder;
GpdsXInput *xinput;
+ if (!gpds_ui_is_dry_run_mode(GPDS_UI(user_data)))
+ return;
+
xinput = gpds_xinput_ui_get_xinput(GPDS_XINPUT_UI(user_data));
if (!xinput)
return;
@@ -1156,6 +1163,8 @@ build (GpdsUI *ui, GError **error)
gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "touchpad");
set_gconf_values_to_widget(ui);
+ connect_signals(ui);
+
return TRUE;
}
@@ -1259,8 +1268,6 @@ dry_run (GpdsUI *ui, GError **error)
if (GPDS_UI_CLASS(gpds_touchpad_ui_parent_class)->dry_run)
ret = GPDS_UI_CLASS(gpds_touchpad_ui_parent_class)->dry_run(ui, error);
- connect_signals(ui);
-
set_widget_values_to_xinput(ui);
return TRUE;
@@ -1269,7 +1276,6 @@ dry_run (GpdsUI *ui, GError **error)
static void
finish_dry_run(GpdsUI *ui, GError **error)
{
- disconnect_signals(ui);
set_gconf_values_to_widget(ui);
if (GPDS_UI_CLASS(gpds_touchpad_ui_parent_class)->finish_dry_run)
diff --git a/src/gpds-ui.c b/src/gpds-ui.c
index d9c2029..d697615 100644
--- a/src/gpds-ui.c
+++ b/src/gpds-ui.c
@@ -59,6 +59,7 @@ struct _GpdsUIPriv
GtkBuilder *builder;
gchar *device_name;
GConfClient *gconf;
+ gboolean is_dry_run_mode;
};
enum
@@ -110,6 +111,7 @@ gpds_ui_init (GpdsUI *ui)
priv->device_name = NULL;
priv->builder = gtk_builder_new();
priv->gconf = gconf_client_get_default();
+ priv->is_dry_run_mode = FALSE;
}
static void
@@ -228,6 +230,8 @@ gpds_ui_dry_run (GpdsUI *ui, GError **error)
g_return_val_if_fail(GPDS_IS_UI(ui), FALSE);
+ GPDS_UI_GET_PRIVATE(ui)->is_dry_run_mode = TRUE;
+
klass = GPDS_UI_GET_CLASS(ui);
return (klass->dry_run) ? klass->dry_run(ui, error) : FALSE;
}
@@ -239,6 +243,8 @@ gpds_ui_finish_dry_run (GpdsUI *ui, GError **error)
g_return_if_fail(GPDS_IS_UI(ui));
+ GPDS_UI_GET_PRIVATE(ui)->is_dry_run_mode = FALSE;
+
klass = GPDS_UI_GET_CLASS(ui);
if (klass->finish_dry_run)
klass->finish_dry_run(ui, error);
@@ -447,6 +453,14 @@ gpds_ui_get_gconf_string (GpdsUI *ui, const gchar *key, gchar **value)
return exist_value;
}
+gboolean
+gpds_ui_is_dry_run_mode (GpdsUI *ui)
+{
+ g_return_val_if_fail(GPDS_IS_UI(ui), FALSE);
+
+ return GPDS_UI_GET_PRIVATE(ui)->is_dry_run_mode;
+}
+
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
diff --git a/src/gpds-ui.h b/src/gpds-ui.h
index 9011440..c936cfd 100644
--- a/src/gpds-ui.h
+++ b/src/gpds-ui.h
@@ -104,6 +104,7 @@ void gpds_ui_set_gconf_string (GpdsUI *ui,
gboolean gpds_ui_get_gconf_string (GpdsUI *ui,
const gchar *key,
gchar **value);
+gboolean gpds_ui_is_dry_run_mode (GpdsUI *ui);
G_END_DECLS
diff --git a/src/gpds-xinput-ui.h b/src/gpds-xinput-ui.h
index 0dcb6ad..9ce318c 100644
--- a/src/gpds-xinput-ui.h
+++ b/src/gpds-xinput-ui.h
@@ -92,9 +92,11 @@ cb_ ## function_name ## _toggled (GtkToggleButton *button,
GtkBuilder *builder; \
GObject *depend_widget = NULL; \
gboolean enable; \
- gpds_xinput_ui_set_xinput_property_from_toggle_button_state(GPDS_XINPUT_UI(user_data), \
- PROPERTY_NAME, \
- button); \
+ if (gpds_ui_is_dry_run_mode(GPDS_UI(user_data))) { \
+ gpds_xinput_ui_set_xinput_property_from_toggle_button_state(GPDS_XINPUT_UI(user_data), \
+ PROPERTY_NAME, \
+ button); \
+ } \
enable = gtk_toggle_button_get_active(button); \
builder = gpds_ui_get_builder(GPDS_UI(user_data)); \
if (!depend_widget_name) \
@@ -109,11 +111,11 @@ cb_ ## function_name ## _toggled (GtkToggleButton *button,
static void \
cb_ ## function_name ## _value_changed (GtkRange *range, gpointer user_data) \
{ \
- gdouble value; \
- gpds_xinput_ui_set_xinput_property_from_range_value(GPDS_XINPUT_UI(user_data), \
- PROPERTY_NAME, \
- range); \
- value = gtk_range_get_value(range); \
+ if (gpds_ui_is_dry_run_mode(GPDS_UI(user_data))) { \
+ gpds_xinput_ui_set_xinput_property_from_range_value(GPDS_XINPUT_UI(user_data), \
+ PROPERTY_NAME, \
+ range); \
+ } \
}
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]