[gtk+] Make orientable base classes instantiable
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Make orientable base classes instantiable
- Date: Tue, 25 May 2010 23:06:37 +0000 (UTC)
commit b4e2ff3da32ad2b9670ecf33805eb9993824fe0b
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 25 18:55:15 2010 -0400
Make orientable base classes instantiable
This commit adds constructors for GtkPaned, GtkBox, GtkButtonBox,
GtkRuler, GtkScale, GtkScrollbar and GtkSeparator and makes these
types instantiable.
docs/reference/gtk/gtk3-sections.txt | 7 +++++++
gtk/gtk.symbols | 8 ++++++++
gtk/gtkbbox.c | 20 +++++++++++++++++++-
gtk/gtkbbox.h | 4 ++--
gtk/gtkbox.c | 18 +++++++++---------
gtk/gtkbox.h | 2 +-
gtk/gtkpaned.c | 10 ++++------
gtk/gtkpaned.h | 1 +
gtk/gtkruler.c | 4 +---
gtk/gtkruler.h | 1 +
gtk/gtkscale.c | 18 ++++++++----------
gtk/gtkscale.h | 6 ++++++
gtk/gtkscrollbar.c | 6 ++----
gtk/gtkscrollbar.h | 2 ++
gtk/gtkseparator.c | 10 ++++------
gtk/gtkseparator.h | 2 ++
16 files changed, 77 insertions(+), 42 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 40c8e39..398dc46 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -420,6 +420,7 @@ gtk_aspect_frame_get_type
<TITLE>GtkButtonBox</TITLE>
GtkButtonBox
GTK_BUTTONBOX_DEFAULT
+gtk_button_box_new
gtk_button_box_get_layout
gtk_button_box_get_child_secondary
gtk_button_box_set_layout
@@ -456,6 +457,7 @@ gtk_bin_get_type
<TITLE>GtkBox</TITLE>
GtkBox
GtkBoxChild
+gtk_box_new
gtk_box_pack_start
gtk_box_pack_end
gtk_box_get_homogeneous
@@ -2295,6 +2297,7 @@ gtk_offscreen_window_get_type
<FILE>gtkpaned</FILE>
<TITLE>GtkPaned</TITLE>
GtkPaned
+gtk_paned_new
gtk_paned_add1
gtk_paned_add2
gtk_paned_pack1
@@ -2753,6 +2756,8 @@ gtk_ruler_draw_pos
<FILE>gtkscale</FILE>
<TITLE>GtkScale</TITLE>
GtkScale
+gtk_scale_new
+gtk_scale_new_with_range
gtk_scale_set_digits
gtk_scale_set_draw_value
gtk_scale_set_value_pos
@@ -2803,6 +2808,7 @@ gtk_scale_button_get_type
<FILE>gtkscrollbar</FILE>
<TITLE>GtkScrollbar</TITLE>
GtkScrollbar
+gtk_scrollbar_new
<SUBSECTION Standard>
GTK_SCROLLBAR
GTK_IS_SCROLLBAR
@@ -2848,6 +2854,7 @@ gtk_scrolled_window_get_type
<FILE>gtkseparator</FILE>
<TITLE>GtkSeparator</TITLE>
GtkSeparator
+gtk_separator_new
<SUBSECTION Standard>
GTK_SEPARATOR
GTK_IS_SEPARATOR
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 8f33402..06ccf9c 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -434,6 +434,7 @@ gtk_bin_get_type G_GNUC_CONST
#if IN_HEADER(__GTK_BOX_H__)
#if IN_FILE(__GTK_BOX_C__)
+gtk_box_new
gtk_box_get_homogeneous
gtk_box_get_spacing
gtk_box_get_type G_GNUC_CONST
@@ -486,6 +487,7 @@ gtk_builder_value_from_string_type
#if IN_HEADER(__GTK_BUTTON_BOX_H__)
#if IN_FILE(__GTK_BUTTON_BOX_C__)
+gtk_button_box_new
gtk_button_box_get_child_secondary
gtk_button_box_get_layout
gtk_button_box_get_type G_GNUC_CONST
@@ -2207,6 +2209,7 @@ gtk_orientable_set_orientation
#if IN_HEADER(__GTK_PANED_H__)
#if IN_FILE(__GTK_PANED_C__)
+gtk_paned_new
gtk_paned_add1
gtk_paned_add2
gtk_paned_get_child1
@@ -3003,6 +3006,7 @@ gtk_text_buffer_unregister_serialize_format
#if IN_HEADER(__GTK_RULER_H__)
#if IN_FILE(__GTK_RULER_C__)
+gtk_ruler_new
gtk_ruler_draw_pos
gtk_ruler_draw_ticks
gtk_ruler_get_metric
@@ -3015,6 +3019,8 @@ gtk_ruler_set_range
#if IN_HEADER(__GTK_SCALE_H__)
#if IN_FILE(__GTK_SCALE_C__)
+gtk_scale_new
+gtk_scale_new_with_range
gtk_scale_get_digits
gtk_scale_get_draw_value
gtk_scale_get_layout
@@ -3047,6 +3053,7 @@ gtk_scale_button_get_popup
#if IN_HEADER(__GTK_SCROLLBAR_H__)
#if IN_FILE(__GTK_SCROLLBAR_C__)
gtk_scrollbar_get_type G_GNUC_CONST
+gtk_scrollbar_new
#endif
#endif
@@ -3126,6 +3133,7 @@ gtk_target_table_free
#if IN_HEADER(__GTK_SEPARATOR_H__)
#if IN_FILE(__GTK_SEPARATOR_C__)
gtk_separator_get_type G_GNUC_CONST
+gtk_separator_new
#endif
#endif
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index 5417be7..9182214 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -99,7 +99,7 @@ static void gtk_button_box_get_child_property (GtkContainer *container,
#define DEFAULT_CHILD_IPAD_X 4
#define DEFAULT_CHILD_IPAD_Y 0
-G_DEFINE_ABSTRACT_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
+G_DEFINE_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
static void
gtk_button_box_class_init (GtkButtonBoxClass *class)
@@ -813,5 +813,23 @@ gtk_button_box_size_allocate (GtkWidget *widget,
}
}
+/**
+ * gtk_button_box_new:
+ * @orientation: the box' orientation.
+ *
+ * Creates a new #GtkButtonBox.
+ *
+ * Return value: a new #GtkButtonBox.
+ *
+ * Since: 3.0
+ */
+GtkWidget *
+gtk_button_box_new (GtkOrientation orientation)
+{
+ return g_object_new (GTK_TYPE_BUTTON_BOX,
+ "orientation", orientation,
+ NULL);
+}
+
#define __GTK_BUTTON_BOX_C__
#include "gtkaliasdef.c"
diff --git a/gtk/gtkbbox.h b/gtk/gtkbbox.h
index 76ac7ba..72f8458 100644
--- a/gtk/gtkbbox.h
+++ b/gtk/gtkbbox.h
@@ -65,8 +65,8 @@ struct _GtkButtonBoxClass
};
-GType gtk_button_box_get_type (void) G_GNUC_CONST;
-
+GType gtk_button_box_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_button_box_new (GtkOrientation orientation);
GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget);
void gtk_button_box_set_layout (GtkButtonBox *widget,
GtkButtonBoxStyle layout_style);
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index b9f5321..0aeb82a 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -182,11 +182,11 @@ static void gtk_box_get_height_for_width (GtkExtendedLayout *layout,
static GtkExtendedLayoutIface *parent_extended_layout_iface;
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
- NULL)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
- gtk_box_extended_layout_init));
+G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
+ NULL)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_EXTENDED_LAYOUT,
+ gtk_box_extended_layout_init));
static void
gtk_box_class_init (GtkBoxClass *class)
@@ -1252,12 +1252,12 @@ gtk_box_get_height_for_width (GtkExtendedLayout *layout,
*
* Return value: a new #GtkHBox.
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget*
-_gtk_box_new (GtkOrientation orientation,
- gboolean homogeneous,
- gint spacing)
+gtk_box_new (GtkOrientation orientation,
+ gboolean homogeneous,
+ gint spacing)
{
return g_object_new (GTK_TYPE_BOX,
"orientation", orientation,
diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h
index 7e9a4cd..0d0cfb0 100644
--- a/gtk/gtkbox.h
+++ b/gtk/gtkbox.h
@@ -102,7 +102,7 @@ struct _GtkBoxChild
#endif
GType gtk_box_get_type (void) G_GNUC_CONST;
-GtkWidget* _gtk_box_new (GtkOrientation orientation,
+GtkWidget* gtk_box_new (GtkOrientation orientation,
gboolean homogeneous,
gint spacing);
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 69e766d..e17131f 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -154,9 +154,9 @@ struct _GtkPanedPrivate
};
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkPaned, gtk_paned, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
- NULL))
+G_DEFINE_TYPE_WITH_CODE (GtkPaned, gtk_paned, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
+ NULL))
static guint signals[LAST_SIGNAL] = { 0 };
@@ -1334,7 +1334,6 @@ gtk_paned_motion (GtkWidget *widget,
return FALSE;
}
-#if 0
/**
* gtk_paned_new:
* @orientation: the paned's orientation.
@@ -1343,7 +1342,7 @@ gtk_paned_motion (GtkWidget *widget,
*
* Return value: a new #GtkPaned.
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget *
gtk_paned_new (GtkOrientation orientation)
@@ -1352,7 +1351,6 @@ gtk_paned_new (GtkOrientation orientation)
"orientation", orientation,
NULL);
}
-#endif
void
gtk_paned_add1 (GtkPaned *paned,
diff --git a/gtk/gtkpaned.h b/gtk/gtkpaned.h
index 27e8201..1a28611 100644
--- a/gtk/gtkpaned.h
+++ b/gtk/gtkpaned.h
@@ -107,6 +107,7 @@ struct _GtkPanedClass
GType gtk_paned_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_paned_new (GtkOrientation orientation);
void gtk_paned_add1 (GtkPaned *paned,
GtkWidget *child);
void gtk_paned_add2 (GtkPaned *paned,
diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c
index 5e16daf..b6721db 100644
--- a/gtk/gtkruler.c
+++ b/gtk/gtkruler.c
@@ -278,7 +278,6 @@ gtk_ruler_get_property (GObject *object,
}
}
-#if 0
/**
* gtk_ruler_new:
* @orientation: the ruler's orientation.
@@ -287,7 +286,7 @@ gtk_ruler_get_property (GObject *object,
*
* Return value: a new #GtkRuler.
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget *
gtk_ruler_new (GtkOrientation orientation)
@@ -296,7 +295,6 @@ gtk_ruler_new (GtkOrientation orientation)
"orientation", orientation,
NULL);
}
-#endif
void
gtk_ruler_set_metric (GtkRuler *ruler,
diff --git a/gtk/gtkruler.h b/gtk/gtkruler.h
index 2702125..07203ea 100644
--- a/gtk/gtkruler.h
+++ b/gtk/gtkruler.h
@@ -110,6 +110,7 @@ struct _GtkRulerMetric
GType gtk_ruler_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_ruler_new (GtkOrientation orientation);
void gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric);
GtkMetricType gtk_ruler_get_metric (GtkRuler *ruler);
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 6b7da98..c2f0f35 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -126,9 +126,9 @@ static void gtk_scale_buildable_custom_finished (GtkBuildable *buildable,
gpointer user_data);
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkScale, gtk_scale, GTK_TYPE_RANGE,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_scale_buildable_interface_init))
+G_DEFINE_TYPE_WITH_CODE (GtkScale, gtk_scale, GTK_TYPE_RANGE,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_scale_buildable_interface_init))
static gboolean
@@ -463,7 +463,6 @@ gtk_scale_get_property (GObject *object,
}
}
-#if 0
/**
* gtk_scale_new:
* @orientation: the scale's orientation.
@@ -474,7 +473,7 @@ gtk_scale_get_property (GObject *object,
*
* Return value: a new #GtkScale
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget *
gtk_scale_new (GtkOrientation orientation,
@@ -508,8 +507,8 @@ gtk_scale_new (GtkOrientation orientation,
*
* Return value: a new #GtkScale
*
- * Since: 2.16
- **/
+ * Since: 3.0
+ */
GtkWidget *
gtk_scale_new_with_range (GtkOrientation orientation,
gdouble min,
@@ -541,14 +540,13 @@ gtk_scale_new_with_range (GtkOrientation orientation,
"digits", digits,
NULL);
}
-#endif
/**
* gtk_scale_set_digits:
* @scale: a #GtkScale
- * @digits: the number of decimal places to display,
+ * @digits: the number of decimal places to display,
* e.g. use 1 to display 1.0, 2 to display 1.00, etc
- *
+ *
* Sets the number of decimal places that are displayed in the value.
* Also causes the value of the adjustment to be rounded off to this
* number of digits, so the retrieved value matches the value the user saw.
diff --git a/gtk/gtkscale.h b/gtk/gtkscale.h
index 204aa79..c98b33a 100644
--- a/gtk/gtkscale.h
+++ b/gtk/gtkscale.h
@@ -77,6 +77,12 @@ struct _GtkScaleClass
};
GType gtk_scale_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_scale_new (GtkOrientation orientation,
+ GtkAdjustment *adjustment);
+GtkWidget * gtk_scale_new_with_range (GtkOrientation orientation,
+ gdouble min,
+ gdouble max,
+ gdouble step);
void gtk_scale_set_digits (GtkScale *scale,
gint digits);
gint gtk_scale_get_digits (GtkScale *scale);
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 634b337..6bd2f61 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -35,7 +35,7 @@
static void gtk_scrollbar_style_set (GtkWidget *widget,
GtkStyle *previous);
-G_DEFINE_ABSTRACT_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
+G_DEFINE_TYPE (GtkScrollbar, gtk_scrollbar, GTK_TYPE_RANGE)
static void
gtk_scrollbar_class_init (GtkScrollbarClass *class)
@@ -125,7 +125,6 @@ gtk_scrollbar_style_set (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_scrollbar_parent_class)->style_set (widget, previous);
}
-#if 0
/**
* gtk_scrollbar_new:
* @orientation: the scrollbar's orientation.
@@ -135,7 +134,7 @@ gtk_scrollbar_style_set (GtkWidget *widget,
*
* Return value: the new #GtkScrollbar.
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget *
gtk_scrollbar_new (GtkOrientation orientation,
@@ -149,7 +148,6 @@ gtk_scrollbar_new (GtkOrientation orientation,
"adjustment", adjustment,
NULL);
}
-#endif
#define __GTK_SCROLLBAR_C__
diff --git a/gtk/gtkscrollbar.h b/gtk/gtkscrollbar.h
index eab137e..992bb0d 100644
--- a/gtk/gtkscrollbar.h
+++ b/gtk/gtkscrollbar.h
@@ -66,6 +66,8 @@ struct _GtkScrollbarClass
GType gtk_scrollbar_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_scrollbar_new (GtkOrientation orientation,
+ GtkAdjustment *adjustment);
G_END_DECLS
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 74e0e24..a41dad5 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -74,9 +74,9 @@ static gboolean gtk_separator_expose (GtkWidget *widget,
GdkEventExpose *event);
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkSeparator, gtk_separator, GTK_TYPE_WIDGET,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
- NULL))
+G_DEFINE_TYPE_WITH_CODE (GtkSeparator, gtk_separator, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
+ NULL))
static void
@@ -247,7 +247,6 @@ gtk_separator_expose (GtkWidget *widget,
return FALSE;
}
-#if 0
/**
* gtk_separator_new:
* @orientation: the separator's orientation.
@@ -256,7 +255,7 @@ gtk_separator_expose (GtkWidget *widget,
*
* Return value: a new #GtkSeparator.
*
- * Since: 2.16
+ * Since: 3.0
**/
GtkWidget *
gtk_separator_new (GtkOrientation orientation)
@@ -265,7 +264,6 @@ gtk_separator_new (GtkOrientation orientation)
"orientation", orientation,
NULL);
}
-#endif
#define __GTK_SEPARATOR_C__
diff --git a/gtk/gtkseparator.h b/gtk/gtkseparator.h
index b2ae0fb..6b3e519 100644
--- a/gtk/gtkseparator.h
+++ b/gtk/gtkseparator.h
@@ -60,6 +60,8 @@ struct _GtkSeparatorClass
GType gtk_separator_get_type (void) G_GNUC_CONST;
+GtkWidget * gtk_separator_new (GtkOrientation orientation);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]