[egg-list-box/row-widget: 1/7] Add (unused) EggListBoxRow type



commit 2d18fca1c8d1cdf4c879c7163d07b83eb7288381
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Jun 5 15:59:07 2013 +0200

    Add (unused) EggListBoxRow type

 egg-list-box.c |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 egg-list-box.h |   47 ++++++++++++++++++++++++++++++-
 2 files changed, 131 insertions(+), 2 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index 2f89592..bb4d294 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -93,6 +93,12 @@ struct _EggListBoxPrivate
   guint auto_scroll_timeout_id;
 };
 
+struct _EggListBoxRowPrivate
+{
+  int dummy;
+};
+
+
 struct _EggListBoxChildInfo
 {
   GSequenceIter *iter;
@@ -120,6 +126,7 @@ enum  {
 };
 
 G_DEFINE_TYPE (EggListBox, egg_list_box, GTK_TYPE_CONTAINER)
+G_DEFINE_TYPE (EggListBoxRow, egg_list_box_row, GTK_TYPE_BIN)
 
 static EggListBoxChildInfo *egg_list_box_find_child_at_y              (EggListBox          *list_box,
                                                                       gint                 y);
@@ -235,7 +242,7 @@ egg_list_box_child_info_free (EggListBoxChildInfo *info)
   g_free (info);
 }
 
-EggListBox*
+GtkWidget *
 egg_list_box_new (void)
 {
   return g_object_new (EGG_TYPE_LIST_BOX, NULL);
@@ -2103,3 +2110,80 @@ egg_list_box_real_move_cursor (EggListBox *list_box,
   if (!modify_selection_pressed)
     egg_list_box_update_selected (list_box, child);
 }
+
+
+GtkWidget *
+egg_list_box_row_new (void)
+{
+  return g_object_new (EGG_TYPE_LIST_BOX_ROW, NULL);
+}
+
+static void
+egg_list_box_row_init (EggListBoxRow *row)
+{
+  EggListBoxRowPrivate *priv;
+
+  row->priv = priv =
+    G_TYPE_INSTANCE_GET_PRIVATE (row, EGG_TYPE_LIST_BOX_ROW, EggListBoxRowPrivate);
+
+  gtk_widget_set_can_focus (GTK_WIDGET (row), TRUE);
+  gtk_widget_set_redraw_on_allocate (GTK_WIDGET (row), TRUE);
+}
+
+static void
+egg_list_box_row_get_property (GObject    *obj,
+                               guint       property_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
+{
+  EggListBoxRow *row = EGG_LIST_BOX_ROW (obj);
+
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
+      break;
+    }
+}
+
+static void
+egg_list_box_row_set_property (GObject      *obj,
+                           guint         property_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
+{
+  EggListBoxRow *row = EGG_LIST_BOX_ROW (obj);
+
+  switch (property_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
+      break;
+    }
+}
+
+static void
+egg_list_box_row_finalize (GObject *obj)
+{
+  EggListBoxRow *row = EGG_LIST_BOX_ROW (obj);
+  EggListBoxRowPrivate *priv = row->priv;
+
+  G_OBJECT_CLASS (egg_list_box_row_parent_class)->finalize (obj);
+}
+
+static void
+egg_list_box_row_class_init (EggListBoxRowClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+  GtkBindingSet *binding_set;
+
+  egg_list_box_row_parent_class = g_type_class_peek_parent (klass);
+
+  g_type_class_add_private (klass, sizeof (EggListBoxRowPrivate));
+
+  object_class->get_property = egg_list_box_row_get_property;
+  object_class->set_property = egg_list_box_row_set_property;
+  object_class->finalize = egg_list_box_row_finalize;
+}
diff --git a/egg-list-box.h b/egg-list-box.h
index a478aa8..fe27282 100644
--- a/egg-list-box.h
+++ b/egg-list-box.h
@@ -21,24 +21,69 @@ typedef struct _EggListBoxPrivate EggListBoxPrivate;
 struct _EggListBox
 {
   GtkContainer parent_instance;
+
   EggListBoxPrivate * priv;
 };
 
 struct _EggListBoxClass
 {
   GtkContainerClass parent_class;
+
   void (*child_selected) (EggListBox* self, GtkWidget* child);
   void (*child_activated) (EggListBox* self, GtkWidget* child);
   void (*activate_cursor_child) (EggListBox* self);
   void (*toggle_cursor_child) (EggListBox* self);
   void (*move_cursor) (EggListBox* self, GtkMovementStep step, gint count);
   void (*refilter) (EggListBox* self);
+
+  /* Padding for future expansion */
+  void (*_egg_reserved1) (void);
+  void (*_egg_reserved2) (void);
+  void (*_egg_reserved3) (void);
+  void (*_egg_reserved4) (void);
+  void (*_egg_reserved5) (void);
+  void (*_egg_reserved6) (void);
+};
+
+#define EGG_TYPE_LIST_BOX_ROW (egg_list_box_row_get_type ())
+#define EGG_LIST_BOX_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_LIST_BOX_ROW, EggListBoxRow))
+#define EGG_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_LIST_BOX_ROW, 
EggListBoxRowClass))
+#define EGG_IS_LIST_BOX_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_LIST_BOX_ROW))
+#define EGG_IS_LIST_BOX_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_LIST_BOX_ROW))
+#define EGG_LIST_BOX_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_LIST_BOX_ROW, 
EggListBoxRowClass))
+
+typedef struct _EggListBoxRow EggListBoxRow;
+typedef struct _EggListBoxRowClass EggListBoxRowClass;
+typedef struct _EggListBoxRowPrivate EggListBoxRowPrivate;
+
+struct _EggListBoxRow
+{
+  GtkBin parent_instance;
+
+  EggListBoxRowPrivate * priv;
+};
+
+struct _EggListBoxRowClass
+{
+  GtkBinClass parent_class;
+
+  /* Padding for future expansion */
+  void (*_egg_reserved1) (void);
+  void (*_egg_reserved2) (void);
+  void (*_egg_reserved3) (void);
+  void (*_egg_reserved4) (void);
+  void (*_egg_reserved5) (void);
+  void (*_egg_reserved6) (void);
 };
 
 typedef gboolean (*EggListBoxFilterFunc) (GtkWidget* child, void* user_data);
 typedef gint (*EggListBoxSortFunc) (GtkWidget* child1, GtkWidget* child2, void* user_data);
 typedef void (*EggListBoxUpdateSeparatorFunc) (GtkWidget** separator, GtkWidget* child, GtkWidget* before, 
void* user_data);
 
+GType egg_list_box_row_get_type (void) G_GNUC_CONST;
+GtkWidget* egg_list_box_row_new  (void);
+
+
 GType egg_list_box_get_type (void) G_GNUC_CONST;
 GtkWidget*  egg_list_box_get_selected_child           (EggListBox                    *self);
 GtkWidget*  egg_list_box_get_child_at_y               (EggListBox                    *self,
@@ -73,7 +118,7 @@ void        egg_list_box_set_activate_on_single_click (EggListBox
 void        egg_list_box_drag_unhighlight_widget      (EggListBox                    *self);
 void        egg_list_box_drag_highlight_widget        (EggListBox                    *self,
                                                       GtkWidget                     *widget);
-EggListBox* egg_list_box_new                          (void);
+GtkWidget*  egg_list_box_new                          (void);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]