gtk+ r20680 - in trunk: . docs/reference/gtk/tmpl gtk



Author: carlosg
Date: Tue Jun 24 10:22:40 2008
New Revision: 20680
URL: http://svn.gnome.org/viewvc/gtk+?rev=20680&view=rev

Log:
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.


Modified:
   trunk/ChangeLog
   trunk/docs/reference/gtk/tmpl/gtkdialog.sgml
   trunk/gtk/gtk.symbols
   trunk/gtk/gtkdialog.c
   trunk/gtk/gtkdialog.h

Modified: trunk/docs/reference/gtk/tmpl/gtkdialog.sgml
==============================================================================
--- trunk/docs/reference/gtk/tmpl/gtkdialog.sgml	(original)
+++ trunk/docs/reference/gtk/tmpl/gtkdialog.sgml	Tue Jun 24 10:22:40 2008
@@ -30,9 +30,8 @@
 
 <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>
@@ -74,7 +73,7 @@
 
 void quick_message (gchar *message) {
 
-   GtkWidget *dialog, *label;
+   GtkWidget *dialog, *label, *content_area;
    
    /* Create the widgets */
    
@@ -84,6 +83,7 @@
                                          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. */
@@ -95,8 +95,7 @@
 
    /* 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);
 }
 

Modified: trunk/gtk/gtk.symbols
==============================================================================
--- trunk/gtk/gtk.symbols	(original)
+++ trunk/gtk/gtk.symbols	Tue Jun 24 10:22:40 2008
@@ -1045,13 +1045,12 @@
 gtk_dialog_add_button
 gtk_dialog_add_buttons G_GNUC_NULL_TERMINATED
 gtk_dialog_get_action_area
+gtk_dialog_get_content_area
 gtk_dialog_get_has_separator
 gtk_dialog_get_response_for_widget
 gtk_dialog_get_type G_GNUC_CONST
 gtk_dialog_new
 gtk_dialog_new_with_buttons
-gtk_dialog_pack_end
-gtk_dialog_pack_start
 gtk_dialog_response
 gtk_dialog_run
 gtk_alternative_dialog_button_order

Modified: trunk/gtk/gtkdialog.c
==============================================================================
--- trunk/gtk/gtkdialog.c	(original)
+++ trunk/gtk/gtkdialog.c	Tue Jun 24 10:22:40 2008
@@ -77,11 +77,6 @@
 
 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);
@@ -123,18 +118,13 @@
 {
   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;
@@ -362,28 +352,6 @@
     }
 }
 
-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,
@@ -1498,57 +1466,21 @@
 }
 
 /**
- * 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__

Modified: trunk/gtk/gtkdialog.h
==============================================================================
--- trunk/gtk/gtkdialog.h	(original)
+++ trunk/gtk/gtkdialog.h	Tue Jun 24 10:22:40 2008
@@ -171,17 +171,8 @@
 /* Returns response_id */
 gint gtk_dialog_run                (GtkDialog *dialog);
 
-GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog);
-void        gtk_dialog_pack_start      (GtkDialog *dialog,
-                                        GtkWidget *widget,
-                                        gboolean   expand,
-                                        gboolean   fill,
-                                        guint      padding);
-void        gtk_dialog_pack_end        (GtkDialog *dialog,
-                                        GtkWidget *widget,
-                                        gboolean   expand,
-                                        gboolean   fill,
-                                        guint      padding);
+GtkWidget * gtk_dialog_get_action_area  (GtkDialog *dialog);
+GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
 
 /* For private use only */
 void _gtk_dialog_set_ignore_separator (GtkDialog *dialog,



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