[gnome-control-center] keyboard: Implement "editing-canceled" property
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Implement "editing-canceled" property
- Date: Thu, 24 Feb 2011 05:37:46 +0000 (UTC)
commit d65ee3490d2fffa585876a539cb8aa1e55b802cf
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 24 05:35:46 2011 +0000
keyboard: Implement "editing-canceled" property
Through sheer "pointless" cut'n'paste.
https://bugzilla.gnome.org/show_bug.cgi?id=642695
panels/keyboard/eggcellrendererkeys.c | 104 +++++++++++++++++++++++----------
1 files changed, 72 insertions(+), 32 deletions(-)
---
diff --git a/panels/keyboard/eggcellrendererkeys.c b/panels/keyboard/eggcellrendererkeys.c
index 65096b3..2c57fae 100644
--- a/panels/keyboard/eggcellrendererkeys.c
+++ b/panels/keyboard/eggcellrendererkeys.c
@@ -500,52 +500,92 @@ ungrab_stuff (GtkWidget *widget, gpointer data)
G_CALLBACK (grab_key_callback), data);
}
+typedef struct
+{
+ GtkEventBox box;
+ gboolean editing_canceled;
+} PointlessEventBox;
+
+typedef GtkEventBoxClass PointlessEventBoxClass;
+static GType pointless_event_box_get_type (void);
+static void pointless_event_box_cell_editable_init (GtkCellEditableIface *iface);
+
static void
-pointless_eventbox_start_editing (GtkCellEditable *cell_editable,
- GdkEvent *event)
+pointless_event_box_init (PointlessEventBox *box)
{
- /* do nothing, because we are pointless */
}
+G_DEFINE_TYPE_WITH_CODE (PointlessEventBox, pointless_event_box, GTK_TYPE_EVENT_BOX, { \
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, pointless_event_box_cell_editable_init) \
+ })
+
+enum {
+ PROP_ZERO,
+ PROP_EDITING_CANCELED
+};
+
static void
-pointless_eventbox_cell_editable_init (GtkCellEditableIface *iface)
+pointless_event_box_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- iface->start_editing = pointless_eventbox_start_editing;
+ PointlessEventBox *box = (PointlessEventBox*)object;
+
+ switch (prop_id)
+ {
+ case PROP_EDITING_CANCELED:
+ box->editing_canceled = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
-static GType
-pointless_eventbox_subclass_get_type (void)
+static void
+pointless_event_box_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- static GType eventbox_type = 0;
+ PointlessEventBox *box = (PointlessEventBox*)object;
- if (!eventbox_type)
+ switch (prop_id)
{
- static const GTypeInfo eventbox_info =
- {
- sizeof (GtkEventBoxClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- NULL,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkEventBox),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL
- };
+ case PROP_EDITING_CANCELED:
+ g_value_set_boolean (value, box->editing_canceled);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
- static const GInterfaceInfo cell_editable_info = {
- (GInterfaceInitFunc) pointless_eventbox_cell_editable_init,
- NULL, NULL };
+static void
+pointless_event_box_class_init (PointlessEventBoxClass *class)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- eventbox_type = g_type_register_static (GTK_TYPE_EVENT_BOX, "EggCellEditableEventBox", &eventbox_info, 0);
+ gobject_class->set_property = pointless_event_box_set_property;
+ gobject_class->get_property = pointless_event_box_get_property;
- g_type_add_interface_static (eventbox_type,
- GTK_TYPE_CELL_EDITABLE,
- &cell_editable_info);
- }
+ g_object_class_override_property (gobject_class,
+ PROP_EDITING_CANCELED,
+ "editing-canceled");
+}
- return eventbox_type;
+static void
+pointless_event_box_start_editing (GtkCellEditable *cell_editable,
+ GdkEvent *event)
+{
+ /* do nothing, because we are pointless */
+}
+
+static void
+pointless_event_box_cell_editable_init (GtkCellEditableIface *iface)
+{
+ iface->start_editing = pointless_event_box_start_editing;
}
static GtkCellEditable *
@@ -592,7 +632,7 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
G_CALLBACK (grab_key_callback),
keys);
- eventbox = g_object_new (pointless_eventbox_subclass_get_type (),
+ eventbox = g_object_new (pointless_event_box_get_type (),
NULL);
keys->edit_widget = eventbox;
g_object_add_weak_pointer (G_OBJECT (keys->edit_widget),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]