[gpointing-device-settings] dry_run/finish_dry_run/apply interfaces.
- From: Hiroyuki Ikezoe <hiikezoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gpointing-device-settings] dry_run/finish_dry_run/apply interfaces.
- Date: Wed, 10 Mar 2010 11:54:15 +0000 (UTC)
commit 2451a448ff9963be2ab0c63f8bbb343c52ba4aca
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date: Wed Mar 10 19:44:10 2010 +0900
dry_run/finish_dry_run/apply interfaces.
src/gpds-ui.c | 34 ++++++++++++++++++++++++++++++++++
src/gpds-ui.h | 6 ++++++
src/gpds-xinput-ui.c | 42 +++++++++++++++++++++++++++++++++++++++---
3 files changed, 79 insertions(+), 3 deletions(-)
---
diff --git a/src/gpds-ui.c b/src/gpds-ui.c
index 772302f..d9c2029 100644
--- a/src/gpds-ui.c
+++ b/src/gpds-ui.c
@@ -221,6 +221,40 @@ gpds_ui_build (GpdsUI *ui, GError **error)
return (klass->build) ? klass->build(ui, error) : FALSE;
}
+gboolean
+gpds_ui_dry_run (GpdsUI *ui, GError **error)
+{
+ GpdsUIClass *klass;
+
+ g_return_val_if_fail(GPDS_IS_UI(ui), FALSE);
+
+ klass = GPDS_UI_GET_CLASS(ui);
+ return (klass->dry_run) ? klass->dry_run(ui, error) : FALSE;
+}
+
+void
+gpds_ui_finish_dry_run (GpdsUI *ui, GError **error)
+{
+ GpdsUIClass *klass;
+
+ g_return_if_fail(GPDS_IS_UI(ui));
+
+ klass = GPDS_UI_GET_CLASS(ui);
+ if (klass->finish_dry_run)
+ klass->finish_dry_run(ui, error);
+}
+
+gboolean
+gpds_ui_apply (GpdsUI *ui, GError **error)
+{
+ GpdsUIClass *klass;
+
+ g_return_val_if_fail(GPDS_IS_UI(ui), FALSE);
+
+ klass = GPDS_UI_GET_CLASS(ui);
+ return (klass->apply) ? klass->apply(ui, error) : FALSE;
+}
+
GtkWidget *
gpds_ui_get_content_widget (GpdsUI *ui, GError **error)
{
diff --git a/src/gpds-ui.h b/src/gpds-ui.h
index d575659..9011440 100644
--- a/src/gpds-ui.h
+++ b/src/gpds-ui.h
@@ -54,6 +54,9 @@ struct _GpdsUIClass
gboolean (*is_available) (GpdsUI *ui, GError **error);
gboolean (*build) (GpdsUI *ui, GError **error);
+ gboolean (*dry_run) (GpdsUI *ui, GError **error);
+ void (*finish_dry_run) (GpdsUI *ui, GError **error);
+ gboolean (*apply) (GpdsUI *ui, GError **error);
GtkWidget *(*get_content_widget) (GpdsUI *ui, GError **error);
GdkPixbuf *(*get_icon_pixbuf) (GpdsUI *ui, GError **error);
};
@@ -69,6 +72,9 @@ GpdsUI *gpds_ui_new (const gchar *type_name,
...);
gboolean gpds_ui_is_available (GpdsUI *ui, GError **error);
gboolean gpds_ui_build (GpdsUI *ui, GError **error);
+gboolean gpds_ui_dry_run (GpdsUI *ui, GError **error);
+void gpds_ui_finish_dry_run (GpdsUI *ui, GError **error);
+gboolean gpds_ui_apply (GpdsUI *ui, GError **error);
GtkWidget *gpds_ui_get_content_widget (GpdsUI *ui, GError **error);
GdkPixbuf *gpds_ui_get_icon_pixbuf (GpdsUI *ui, GError **error);
GtkBuilder *gpds_ui_get_builder (GpdsUI *ui);
diff --git a/src/gpds-xinput-ui.c b/src/gpds-xinput-ui.c
index 7abd86c..86709e4 100644
--- a/src/gpds-xinput-ui.c
+++ b/src/gpds-xinput-ui.c
@@ -38,8 +38,10 @@ struct _GpdsXInputUIPriv
G_DEFINE_ABSTRACT_TYPE(GpdsXInputUI, gpds_xinput_ui, GPDS_TYPE_UI)
-static void dispose (GObject *object);
-static gboolean is_available (GpdsUI *ui, GError **error);
+static void dispose (GObject *object);
+static gboolean is_available (GpdsUI *ui, GError **error);
+static gboolean dry_run (GpdsUI *ui, GError **error);
+static void finish_dry_run (GpdsUI *ui, GError **error);
static void
gpds_xinput_ui_class_init (GpdsXInputUIClass *klass)
@@ -49,7 +51,9 @@ gpds_xinput_ui_class_init (GpdsXInputUIClass *klass)
gobject_class->dispose = dispose;
- ui_class->is_available = is_available;
+ ui_class->is_available = is_available;
+ ui_class->dry_run = dry_run;
+ ui_class->finish_dry_run = finish_dry_run;
g_type_class_add_private(gobject_class, sizeof(GpdsXInputUIPriv));
}
@@ -96,6 +100,38 @@ is_available (GpdsUI *ui, GError **error)
return TRUE;
}
+static gboolean
+dry_run (GpdsUI *ui, GError **error)
+{
+ GpdsXInputUIPriv *priv;
+
+ priv = GPDS_XINPUT_UI_GET_PRIVATE(ui);
+ if (!priv->xinput)
+ return FALSE;
+
+ gpds_xinput_backup_all_properties(priv->xinput);
+
+ if (GPDS_UI_CLASS(gpds_xinput_ui_parent_class)->dry_run)
+ return GPDS_UI_CLASS(gpds_xinput_ui_parent_class)->dry_run(ui, error);
+
+ return TRUE;
+}
+
+static void
+finish_dry_run (GpdsUI *ui, GError **error)
+{
+ GpdsXInputUIPriv *priv;
+
+ priv = GPDS_XINPUT_UI_GET_PRIVATE(ui);
+ if (!priv->xinput)
+ return;
+
+ gpds_xinput_restore_all_properties(priv->xinput);
+
+ if (GPDS_UI_CLASS(gpds_xinput_ui_parent_class)->finish_dry_run)
+ GPDS_UI_CLASS(gpds_xinput_ui_parent_class)->finish_dry_run(ui, error);
+}
+
void
gpds_xinput_ui_set_xinput (GpdsXInputUI *ui, GpdsXInput *xinput)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]