gpointing-device-settings r138 - trunk/src
- From: hiikezoe svn gnome org
- To: svn-commits-list gnome org
- Subject: gpointing-device-settings r138 - trunk/src
- Date: Fri, 6 Mar 2009 14:48:22 +0000 (UTC)
Author: hiikezoe
Date: Fri Mar 6 14:48:22 2009
New Revision: 138
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=138&view=rev
Log:
GpdsUI has device-name property and add gpds_ui_get_device_name.
Modified:
trunk/src/gpds-ui.c
trunk/src/gpds-ui.h
Modified: trunk/src/gpds-ui.c
==============================================================================
--- trunk/src/gpds-ui.c (original)
+++ trunk/src/gpds-ui.c Fri Mar 6 14:48:22 2009
@@ -57,6 +57,13 @@
{
GtkBuilder *builder;
GpdsXInput *xinput;
+ gchar *device_name;
+};
+
+enum
+{
+ PROP_0,
+ PROP_DEVICE_NAME
};
#define GPDS_UI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GPDS_TYPE_UI, GpdsUIPriv))
@@ -64,6 +71,14 @@
G_DEFINE_ABSTRACT_TYPE(GpdsUI, gpds_ui, G_TYPE_OBJECT)
static void dispose (GObject *object);
+static void set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void
gpds_ui_class_init (GpdsUIClass *klass)
@@ -71,6 +86,17 @@
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
gobject_class->dispose = dispose;
+ gobject_class->set_property = set_property;
+ gobject_class->get_property = get_property;
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_DEVICE_NAME,
+ g_param_spec_string("device-name",
+ "Device Name",
+ "The device name",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private(gobject_class, sizeof(GpdsUIPriv));
}
@@ -80,6 +106,7 @@
{
GpdsUIPriv *priv = GPDS_UI_GET_PRIVATE(ui);
+ priv->device_name = NULL;
priv->xinput = NULL;
priv->builder = gtk_builder_new();
}
@@ -89,6 +116,8 @@
{
GpdsUIPriv *priv = GPDS_UI_GET_PRIVATE(object);
+ g_free(priv->device_name);
+
if (priv->builder) {
g_object_unref(priv->builder);
priv->builder = NULL;
@@ -103,6 +132,43 @@
G_OBJECT_CLASS(gpds_ui_parent_class)->dispose(object);
}
+static void
+set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GpdsUIPriv *priv = GPDS_UI_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_DEVICE_NAME:
+ g_free(priv->device_name);
+ priv->device_name = g_value_dup_string(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GpdsUIPriv *priv = GPDS_UI_GET_PRIVATE(object);
+
+ switch (prop_id) {
+ case PROP_DEVICE_NAME:
+ g_value_set_string(value, priv->device_name);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
GQuark
gpds_ui_error_quark (void)
{
@@ -179,9 +245,19 @@
GtkBuilder *
gpds_ui_get_builder (GpdsUI *ui)
{
+ g_return_val_if_fail(GPDS_IS_UI(ui), NULL);
+
return GPDS_UI_GET_PRIVATE(ui)->builder;
}
+const gchar *
+gpds_ui_get_device_name (GpdsUI *ui)
+{
+ g_return_val_if_fail(GPDS_IS_UI(ui), NULL);
+
+ return GPDS_UI_GET_PRIVATE(ui)->device_name;
+}
+
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
Modified: trunk/src/gpds-ui.h
==============================================================================
--- trunk/src/gpds-ui.h (original)
+++ trunk/src/gpds-ui.h Fri Mar 6 14:48:22 2009
@@ -58,20 +58,21 @@
GtkWidget *(*get_label_widget) (GpdsUI *ui, GError **error);
};
-gboolean gpds_uis_load (void);
-gboolean gpds_uis_unload (void);
-GList *gpds_uis_get_names (void);
+gboolean gpds_uis_load (void);
+gboolean gpds_uis_unload (void);
+GList *gpds_uis_get_names (void);
-GQuark gpds_ui_error_quark (void);
-GType gpds_ui_get_type (void) G_GNUC_CONST;
-GpdsUI *gpds_ui_new (const gchar *type_name,
- const gchar *first_property,
- ...);
-gboolean gpds_ui_is_available (GpdsUI *ui, GError **error);
-gboolean gpds_ui_build (GpdsUI *ui, GError **error);
-GtkWidget *gpds_ui_get_content_widget (GpdsUI *ui, GError **error);
-GtkWidget *gpds_ui_get_label_widget (GpdsUI *ui, GError **error);
-GtkBuilder *gpds_ui_get_builder (GpdsUI *ui);
+GQuark gpds_ui_error_quark (void);
+GType gpds_ui_get_type (void) G_GNUC_CONST;
+GpdsUI *gpds_ui_new (const gchar *type_name,
+ const gchar *first_property,
+ ...);
+gboolean gpds_ui_is_available (GpdsUI *ui, GError **error);
+gboolean gpds_ui_build (GpdsUI *ui, GError **error);
+GtkWidget *gpds_ui_get_content_widget (GpdsUI *ui, GError **error);
+GtkWidget *gpds_ui_get_label_widget (GpdsUI *ui, GError **error);
+GtkBuilder *gpds_ui_get_builder (GpdsUI *ui);
+const gchar *gpds_ui_get_device_name (GpdsUI *ui);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]