+2008-06-24 Carlos Garnacho <carlos@imendio.com>
+
+ * gtk/gtkdialog.[ch]: Remove container implementation, which isn't
+ thought for handling non-direct children. Fixes #539732.
+ (gtk_dialog_pack_start) (gtk_dialog_pack_end): Removed as well, it
+ doesn't provide enough control to API users (removing, reordering...),
+ this is better handled through:
+ (gtk_dialog_get_content_area): New function which just returns
+ dialog->vbox.
+ * gtk/gtk.symbols: Modify accordingly.
+ * docs/reference/gtk/tmpl/gtkdialog.sgml: Update docs to recommend
+ using gtk_dialog_get_[action|content]_area() instead of accessing
+ dialog struct members directly.
+
2008-06-24 Michael Natterer <mitch@imendio.com>
* gtk/gtkassistant.h
<para>
If 'dialog' is a newly created dialog, the two primary areas of the window
-can be accessed as <literal>GTK_DIALOG(dialog)->vbox</literal> and
-<literal>GTK_DIALOG(dialog)->action_area</literal>,
-as can be seen from the example, below.
+can be accessed through gtk_dialog_get_content_area() and
+gtk_dialog_get_action_area(), as can be seen from the example, below.
</para>
<para>
void quick_message (gchar *message) {
- GtkWidget *dialog, *label;
+ GtkWidget *dialog, *label, *content_area;
/* Create the widgets */
GTK_STOCK_OK,
GTK_RESPONSE_NONE,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
label = gtk_label_new (message);
/* Ensure that the dialog box is destroyed when the user responds. */
/* Add the label, and show everything we've added to the dialog. */
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
- label);
+ gtk_container_add (GTK_CONTAINER (content_area), label);
gtk_widget_show_all (dialog);
}
static void gtk_dialog_close (GtkDialog *dialog);
-static void gtk_dialog_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_dialog_remove (GtkContainer *container,
- GtkWidget *widget);
-
static ResponseData* get_response_data (GtkWidget *widget,
gboolean create);
static void gtk_dialog_buildable_interface_init (GtkBuildableIface *iface);
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
GtkBindingSet *binding_set;
gobject_class = G_OBJECT_CLASS (class);
widget_class = GTK_WIDGET_CLASS (class);
- container_class = GTK_CONTAINER_CLASS (class);
gobject_class->set_property = gtk_dialog_set_property;
gobject_class->get_property = gtk_dialog_get_property;
-
- container_class->add = gtk_dialog_add;
- container_class->remove = gtk_dialog_remove;
widget_class->map = gtk_dialog_map;
widget_class->style_set = gtk_dialog_style_set;
}
}
-static void
-gtk_dialog_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkDialog *dialog;
-
- dialog = GTK_DIALOG (container);
-
- gtk_box_pack_start (GTK_BOX (dialog->vbox), widget, FALSE, FALSE, 0);
-}
-
-static void
-gtk_dialog_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkDialog *dialog;
-
- dialog = GTK_DIALOG (container);
-
- gtk_container_remove (GTK_CONTAINER (dialog->vbox), widget);
-}
-
static gint
gtk_dialog_delete_event_handler (GtkWidget *widget,
GdkEventAny *event,
}
/**
- * gtk_dialog_pack_start:
+ * gtk_dialog_get_content_area:
* @dialog: a #GtkDialog
- * @widget: #GtkWidget to be added to @dialog.
- * @expand: %TRUE if @widget should take all extra space.
- * @fill: %TRUE if all space given should be used by @widget
- * @padding: extra pixels to put between @widget and its neighbors
*
- * This function similar to gtk_box_pack_start() packs @widget
- * with reference to the start of @dialog.
+ * Returns the content area of @dialog.
*
- * Since: 2.14
- **/
-void
-gtk_dialog_pack_start (GtkDialog *dialog,
- GtkWidget *widget,
- gboolean expand,
- gboolean fill,
- guint padding)
-{
- g_return_if_fail (GTK_IS_DIALOG (dialog));
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- gtk_box_pack_start (GTK_BOX (dialog->vbox),
- widget, expand, fill, padding);
-}
-
-/**
- * gtk_dialog_pack_end:
- * @dialog: a #GtkDialog
- * @widget: #GtkWidget to be added to @dialog.
- * @expand: %TRUE if @widget should take all extra space.
- * @fill: %TRUE if all space given should be used by @widget
- * @padding: extra pixels to put between @widget and its neighbors
- *
- * This function similar to gtk_box_pack_end() packs @widget
- * with reference to the end of @dialog.
+ * Returns: the content area #GtkVBox.
*
* Since: 2.14
**/
-void
-gtk_dialog_pack_end (GtkDialog *dialog,
- GtkWidget *widget,
- gboolean expand,
- gboolean fill,
- guint padding)
+GtkWidget *
+gtk_dialog_get_content_area (GtkDialog *dialog)
{
- g_return_if_fail (GTK_IS_DIALOG (dialog));
- g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
- gtk_box_pack_end (GTK_BOX (dialog->vbox),
- widget, expand, fill, padding);
+ return dialog->vbox;
}
#define __GTK_DIALOG_C__