gtk+ r20700 - in trunk: . gtk
- From: hallski svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20700 - in trunk: . gtk
- Date: Sat, 28 Jun 2008 16:16:27 +0000 (UTC)
Author: hallski
Date: Sat Jun 28 16:16:26 2008
New Revision: 20700
URL: http://svn.gnome.org/viewvc/gtk+?rev=20700&view=rev
Log:
Factor out gtk_box_pack from gtk_box_pack_start and gtk_box_pack_end to reduce code duplication.
2008-06-27 Mikael Hallendal <micke imendio com>
* gtk/gtkbox.c (gtk_box_pack, gtk_box_pack_start, gtk_box_pack_end):
Factored out gtk_box_pack from gtk_box_pack_start and use it from both
pack_start and pack_end in order to reduce the code duplication.
Modified:
trunk/ChangeLog
trunk/gtk/gtkbox.c
Modified: trunk/gtk/gtkbox.c
==============================================================================
--- trunk/gtk/gtkbox.c (original)
+++ trunk/gtk/gtkbox.c Sat Jun 28 16:16:26 2008
@@ -329,6 +329,43 @@
}
}
+static void
+gtk_box_pack (GtkBox *box,
+ GtkWidget *child,
+ gboolean expand,
+ gboolean fill,
+ guint padding,
+ GtkPackType pack_type)
+{
+ GtkBoxChild *child_info;
+
+ g_return_if_fail (GTK_IS_BOX (box));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (child->parent == NULL);
+
+ child_info = g_new (GtkBoxChild, 1);
+ child_info->widget = child;
+ child_info->padding = padding;
+ child_info->expand = expand ? TRUE : FALSE;
+ child_info->fill = fill ? TRUE : FALSE;
+ child_info->pack = pack_type;
+ child_info->is_secondary = FALSE;
+
+ box->children = g_list_append (box->children, child_info);
+
+ gtk_widget_freeze_child_notify (child);
+
+ gtk_widget_set_parent (child, GTK_WIDGET (box));
+
+ gtk_widget_child_notify (child, "expand");
+ gtk_widget_child_notify (child, "fill");
+ gtk_widget_child_notify (child, "padding");
+ gtk_widget_child_notify (child, "pack-type");
+ gtk_widget_child_notify (child, "position");
+ gtk_widget_thaw_child_notify (child);
+
+}
+
/**
* gtk_box_pack_start:
* @box: a #GtkBox
@@ -358,32 +395,7 @@
gboolean fill,
guint padding)
{
- GtkBoxChild *child_info;
-
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
-
- child_info = g_new (GtkBoxChild, 1);
- child_info->widget = child;
- child_info->padding = padding;
- child_info->expand = expand ? TRUE : FALSE;
- child_info->fill = fill ? TRUE : FALSE;
- child_info->pack = GTK_PACK_START;
- child_info->is_secondary = FALSE;
-
- box->children = g_list_append (box->children, child_info);
-
- gtk_widget_freeze_child_notify (child);
-
- gtk_widget_set_parent (child, GTK_WIDGET (box));
-
- gtk_widget_child_notify (child, "expand");
- gtk_widget_child_notify (child, "fill");
- gtk_widget_child_notify (child, "padding");
- gtk_widget_child_notify (child, "pack-type");
- gtk_widget_child_notify (child, "position");
- gtk_widget_thaw_child_notify (child);
+ gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_START);
}
/**
@@ -415,32 +427,7 @@
gboolean fill,
guint padding)
{
- GtkBoxChild *child_info;
-
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (child->parent == NULL);
-
- child_info = g_new (GtkBoxChild, 1);
- child_info->widget = child;
- child_info->padding = padding;
- child_info->expand = expand ? TRUE : FALSE;
- child_info->fill = fill ? TRUE : FALSE;
- child_info->pack = GTK_PACK_END;
- child_info->is_secondary = FALSE;
-
- box->children = g_list_append (box->children, child_info);
-
- gtk_widget_freeze_child_notify (child);
-
- gtk_widget_set_parent (child, GTK_WIDGET (box));
-
- gtk_widget_child_notify (child, "expand");
- gtk_widget_child_notify (child, "fill");
- gtk_widget_child_notify (child, "padding");
- gtk_widget_child_notify (child, "pack-type");
- gtk_widget_child_notify (child, "position");
- gtk_widget_thaw_child_notify (child);
+ gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_END);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]