]> Pileus Git - ~andy/gtk/commitdiff
Remove reallocate-redraws property. This is something that only a widget
authorOwen Taylor <otaylor@redhat.com>
Fri, 18 May 2001 18:30:59 +0000 (18:30 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 18 May 2001 18:30:59 +0000 (18:30 +0000)
Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkcontainer.c: Remove reallocate-redraws property.
This is something that only a widget writer would ever want
to change.

* gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
gtk_signal_emit_by_name().

* gtk/gtkviewport.c: Fix some warnings.

* gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
allowing the requisitions of multiple widgets to be grouped
together.

* tests/testgtk.c: Add GtkSizeGroup test

* demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.

* demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
warnings.

* configure.in: Switch to using AM_GLIB_GNU_GETTEXT.

26 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
autogen.sh
configure.in
demos/gtk-demo/Makefile.am
demos/gtk-demo/main.c
demos/gtk-demo/pixbufs.c
demos/gtk-demo/sizegroup.c [new file with mode: 0644]
gtk/Makefile.am
gtk/gtk.h
gtk/gtkcontainer.c
gtk/gtksignal.c
gtk/gtksizegroup.c [new file with mode: 0644]
gtk/gtksizegroup.h [new file with mode: 0644]
gtk/gtkviewport.c
gtk/gtkwidget.c
po/.cvsignore
po/ChangeLog
po/Makefile.in.in [new file with mode: 0644]
po/po2tbl.sed.in [new file with mode: 0644]
tests/testgtk.c

index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index d53125090018e3dc8f3766a6a8c3860bbe34b078..1d3431be519f392540d6f0aedeec34018d59e4b6 100644 (file)
@@ -1,3 +1,27 @@
+Fri May 18 14:25:20 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkcontainer.c: Remove reallocate-redraws property.
+       This is something that only a widget writer would ever want
+       to change.
+
+       * gtk/gtksignal.c: Handle G_SIGNAL_TYPE_STATIC_SCOPE for
+       gtk_signal_emit_by_name().
+
+       * gtk/gtkviewport.c: Fix some warnings.
+
+       * gtk/gtkwidget.c gtk/gtksizegroup.c: Add "size group" facility
+       allowing the requisitions of multiple widgets to be grouped
+       together.
+
+       * tests/testgtk.c: Add GtkSizeGroup test
+
+       * demos/gtk-demo/sizegroup.c: Add GtkSizeGroup demo.
+
+       * demos/gtk-demo/main.c demos/gtk-demo/pixbufs.c: Fix some
+       warnings.
+
+       * configure.in: Switch to using AM_GLIB_GNU_GETTEXT.
+
 2001-04-28  Martin Baulig  <baulig@suse.de>
 
        * gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
index cfddfde67cd98030c1a5f438116f8139a1415d1c..3fe38312a89061dca1f8344bafb1b49146bbea08 100755 (executable)
@@ -77,7 +77,7 @@ esac
 if test -z "$ACLOCAL_FLAGS"; then
 
        acdir=`aclocal --print-ac-dir`
-        m4list="glib-2.0.m4 gettext.m4"
+        m4list="glib-2.0.m4 glib-gettext.m4"
 
        for file in $m4list
        do
@@ -93,18 +93,6 @@ if test -z "$ACLOCAL_FLAGS"; then
        done
 fi
 
-echo "Running gettextize...  Ignore non-fatal messages."
-# Hmm, we specify --force here, since otherwise things dont'
-# get added reliably, but we don't want to overwrite intl
-# while making dist.
-echo "no" | gettextize --copy --force
-
-#
-# Really bad hack
-echo "Munging po/Makefile.in.in"
-sed s%@PACKAGE@%@GETTEXT_PACKAGE@% < po/Makefile.in.in > po/Makefile.in.in.new
-mv po/Makefile.in.in.new po/Makefile.in.in
-
 aclocal $ACLOCAL_FLAGS
 
 # optionally feature autoheader
index 590460ff1f4a65d3201755589f1809aeb8f5b744..82f62be04efd429cccbaea0f896ed5aa38152308 100644 (file)
@@ -226,10 +226,10 @@ AC_SUBST(STRIP_END)
 
 # i18n stuff
 ALL_LINGUAS="az ca cs da de el en_GB en@IPA es et eu fa fi fr ga gl he hr hu ia it ja ko lt nl nn no pl pt pt_BR ro ru sk sl sp sr sv tr uk vi wa zh_TW zh_CN"
-AM_GTK_GNU_GETTEXT
+AM_GLIB_GNU_GETTEXT
 LIBS="$LIBS $INTLLIBS"
 
-# AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
+# AM_GLIB_GNU_GETTEXT above substs $DATADIRNAME
 # this is the directory where the *.{mo,gmo} files are installed
 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
 AC_SUBST(gtklocaledir)
index 7d199e09c50957b972fca9579f2c3c010e3a1831..228296aec07c126480fb34c78257d09be2505d06 100644 (file)
@@ -14,6 +14,7 @@ demos = @STRIP_BEGIN@ \
        menus.c         \
        panes.c         \
        pixbufs.c       \
+       sizegroup.c     \
        textview.c      \
 @STRIP_END@
 
index 1eed349769e0c0cbcdadb86ec458e407d477d512..69710e3ada7130fa3f6fe3a546e7bdd765fef138 100644 (file)
@@ -1,5 +1,6 @@
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -546,7 +547,7 @@ button_press_event_cb (GtkTreeView    *tree_view,
 
              gtk_signal_connect (GTK_OBJECT (window),
                                   "destroy",
-                                  window_closed_cb,
+                                  GTK_SIGNAL_FUNC (window_closed_cb),
                                   cbdata);
            }
          else
@@ -598,7 +599,7 @@ row_activated_cb (GtkTreeView       *tree_view,
       
       gtk_signal_connect (GTK_OBJECT (window),
                          "destroy",
-                         window_closed_cb,
+                         GTK_SIGNAL_FUNC (window_closed_cb),
                          cbdata);
     }
 }
@@ -714,7 +715,7 @@ create_tree (void)
   gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
                               GTK_TREE_VIEW_COLUMN (column));
 
-  gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
+  gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", GTK_SIGNAL_FUNC (selection_cb), model);
   gtk_signal_connect (GTK_OBJECT (tree_view), "row_activated", GTK_SIGNAL_FUNC (row_activated_cb), model);
 
   return tree_view;
index 6af7ea676c3e8ccd2b834888d1afecc0939b7cab..5ad2774d69c6eb2eddc715e54f3ca505d41ad999 100644 (file)
@@ -47,7 +47,7 @@ static const char *installed_image_names[] = {
 #define N_IMAGES G_N_ELEMENTS (relative_image_names)
 
 /* demo window */
-static GtkWindow *window = NULL;
+static GtkWidget *window = NULL;
 
 /* Current frame */
 static GdkPixbuf *frame;
diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c
new file mode 100644 (file)
index 0000000..362ffcb
--- /dev/null
@@ -0,0 +1,172 @@
+/* Size Groups
+ *
+ * GtkSizeGroup provides a mechanism for grouping a number of
+ * widgets together so they all request the same amount of space.
+ * This is typically useful when you want a column of widgets to 
+ * have the same size, but you can't use a GtkTable widget.
+ * 
+ * Note that size groups only affect the amount of space requested,
+ * not the size that the widgets finally receive. If you want the
+ * widgets in a GtkSizeGroup to actually be the same size, you need
+ * to pack them in such a way that they get the size they request
+ * and not more. For example, if you are packing your widgets
+ * into a table, you would not include the GTK_FILL flag.
+ */
+
+#include <gtk/gtk.h>
+
+static GtkWidget *window = NULL;
+
+/* Convenience function to create an option menu holding a number of strings
+ */
+GtkWidget *
+create_option_menu (const char **strings)
+{
+  GtkWidget *menu;
+  GtkWidget *option_menu;
+  const char **str;
+
+  menu = gtk_menu_new ();
+  
+  for (str = strings; *str; str++)
+    {
+      GtkWidget *menu_item = gtk_menu_item_new_with_label (*str);
+      gtk_widget_show (menu_item);
+
+      gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+    }
+
+  option_menu = gtk_option_menu_new ();
+  gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
+
+  return option_menu;
+}
+
+static void
+add_row (GtkTable     *table,
+        int           row,
+        GtkSizeGroup *size_group,
+        const char   *label_text,
+        const char  **options)
+{
+  GtkWidget *option_menu;
+  GtkWidget *label;
+
+  label = gtk_label_new (label_text);
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
+  gtk_table_attach (GTK_TABLE (table), label,
+                   0, 1,                  row, row + 1,
+                   GTK_EXPAND | GTK_FILL, 0,
+                   0,                     0);
+  
+  option_menu = create_option_menu (options);
+  gtk_size_group_add_widget (size_group, option_menu);
+  gtk_table_attach (GTK_TABLE (table), option_menu,
+                   1, 2,                  row, row + 1,
+                   0,                     0,
+                   0,                     0);
+}
+
+static void
+toggle_grouping (GtkToggleButton *check_button,
+                GtkSizeGroup    *size_group)
+{
+  GtkSizeGroupMode new_mode;
+
+  /* GTK_SIZE_GROUP_NONE is not generally useful, but is useful
+   * here to show the effect of GTK_SIZE_GROUP_HORIZONTAL by
+   * contrast.
+   */
+  if (gtk_toggle_button_get_active (check_button))
+    new_mode = GTK_SIZE_GROUP_HORIZONTAL;
+  else
+    new_mode = GTK_SIZE_GROUP_NONE;
+  
+  gtk_size_group_set_mode (size_group, new_mode);
+}
+
+GtkWidget *
+do_sizegroup (void)
+{
+  GtkWidget *table;
+  GtkWidget *frame;
+  GtkWidget *vbox;
+  GtkWidget *check_button;
+  GtkSizeGroup *size_group;
+
+  static const char *color_options[] = {
+    "Red", "Green", "Blue", NULL
+  };
+  
+  static const char *dash_options[] = {
+    "Solid", "Dashed", "Dotted", NULL
+  };
+  
+  static const char *end_options[] = {
+    "Square", "Round", "Arrow", NULL
+  };
+  
+  if (!window)
+    {
+      window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
+                                           NULL, 0,
+                                           GTK_STOCK_BUTTON_CLOSE,
+                                           GTK_RESPONSE_NONE,
+                                           NULL);
+      gtk_window_set_resizeable (GTK_WINDOW (window), FALSE);
+      
+      gtk_signal_connect (GTK_OBJECT (window), "response",
+                         GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
+      gtk_signal_connect (GTK_OBJECT (window), "destroy",
+                         GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
+
+      vbox = gtk_vbox_new (FALSE, 5);
+      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
+      gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+      size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+      
+      /* Create one frame holding color options
+       */
+      frame = gtk_frame_new ("Color Options");
+      gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
+
+      table = gtk_table_new (2, 2, FALSE);
+      gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+      gtk_table_set_row_spacings (GTK_TABLE (table), 5);
+      gtk_table_set_col_spacings (GTK_TABLE (table), 10);
+      gtk_container_add (GTK_CONTAINER (frame), table);
+
+      add_row (GTK_TABLE (table), 0, size_group, "Foreground", color_options);
+      add_row (GTK_TABLE (table), 1, size_group, "Background", color_options);
+
+      /* And another frame holding line style options
+       */
+      frame = gtk_frame_new ("Line Options");
+      gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
+
+      table = gtk_table_new (2, 2, FALSE);
+      gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+      gtk_table_set_row_spacings (GTK_TABLE (table), 5);
+      gtk_table_set_col_spacings (GTK_TABLE (table), 10);
+      gtk_container_add (GTK_CONTAINER (frame), table);
+
+      add_row (GTK_TABLE (table), 0, size_group, "Dashing", dash_options);
+      add_row (GTK_TABLE (table), 1, size_group, "Line ends", end_options);
+
+      /* And a check button to turn grouping on and off */
+      check_button = gtk_check_button_new_with_label ("Enable grouping");
+      gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0);
+      
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
+      gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
+                         GTK_SIGNAL_FUNC (toggle_grouping), size_group);
+    }
+
+  if (!GTK_WIDGET_VISIBLE (window))
+    gtk_widget_show_all (window);
+  else
+    gtk_widget_destroy (window);
+
+  return window;
+}
index 1eaa30036961791ad9da0521fb3d48c87fba1747..50d2261f31ba333f86db166e2cc5c308402f0278 100644 (file)
@@ -142,6 +142,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
        gtkseparator.h          \
        gtksettings.h           \
        gtksignal.h             \
+       gtksizegroup.h          \
        gtksocket.h             \
        gtkspinbutton.h         \
        gtkstyle.h              \
@@ -301,6 +302,7 @@ gtk_c_sources = @STRIP_BEGIN@   \
        gtkseparator.c          \
        gtksettings.c           \
        gtksignal.c             \
+       gtksizegroup.c          \
        gtkspinbutton.c         \
        gtkstock.c              \
        gtkstyle.c              \
index 5c50ce22cc8cf9ca349b9dbb4b11cc5baf29cdc0..534d61d60694b9dff45040411ee1496f395e26dd 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
 #include <gtk/gtkseparatormenuitem.h>
 #include <gtk/gtksettings.h>
 #include <gtk/gtksignal.h>
+#include <gtk/gtksizegroup.h>
 #include <gtk/gtksocket.h>
 #include <gtk/gtkspinbutton.h>
 #include <gtk/gtkstock.h>
index 3c80e9a695e40749bfc6ad2a3d4b446bc9c1d6d7..2029e7f1653e954689bb4c824d96414f46ed84cb 100644 (file)
@@ -49,7 +49,6 @@ enum {
   PROP_BORDER_WIDTH,
   PROP_RESIZE_MODE,
   PROP_CHILD,
-  PROP_REALLOCATE_REDRAWS
 };
 
 typedef struct _GtkChildArgInfo        GtkChildArgInfo;
@@ -200,13 +199,7 @@ gtk_container_class_init (GtkContainerClass *class)
                                                       _("Can be used to add a new child to the container."),
                                                       GTK_TYPE_WIDGET,
                                                      G_PARAM_WRITABLE));
-  g_object_class_install_property (gobject_class,
-                                   PROP_REALLOCATE_REDRAWS,
-                                   g_param_spec_boolean ("reallocate_redraws",
-                                                        _("Reallocate redraws"),
-                                                        _("Whether redraws should be reallocated"),
-                                                        FALSE,
-                                                        G_PARAM_READWRITE));
+
   object_class->destroy = gtk_container_destroy;
 
   widget_class->show_all = gtk_container_show_all;
@@ -689,10 +682,6 @@ gtk_container_set_property (GObject         *object,
     case PROP_RESIZE_MODE:
       gtk_container_set_resize_mode (container, g_value_get_enum (value));
       break;
-    case PROP_REALLOCATE_REDRAWS:
-      gtk_container_set_reallocate_redraws (container, 
-                                           g_value_get_boolean (value));
-      break;
     case PROP_CHILD:
       gtk_container_add (container, GTK_WIDGET (g_value_get_object (value)));
       break;
@@ -720,9 +709,6 @@ gtk_container_get_property (GObject         *object,
     case PROP_RESIZE_MODE:
       g_value_set_enum (value, container->resize_mode);
       break;
-    case PROP_REALLOCATE_REDRAWS:
-      g_value_set_boolean (value, container->reallocate_redraws);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -889,15 +875,7 @@ gtk_container_set_reallocate_redraws (GtkContainer *container,
 {
   g_return_if_fail (GTK_IS_CONTAINER (container));
 
-  needs_redraws = needs_redraws ? TRUE : FALSE;
-  if (needs_redraws != container->reallocate_redraws)
-    {
-      container->reallocate_redraws = needs_redraws;
-      g_object_notify (G_OBJECT (container), "reallocate_redraws");
-      
-      if (container->reallocate_redraws)
-       gtk_widget_queue_draw (GTK_WIDGET (container));
-    }
+  container->reallocate_redraws = needs_redraws ? TRUE : FALSE;
 }
 
 static GtkContainer*
@@ -1092,7 +1070,7 @@ gtk_container_resize_children (GtkContainer *container)
 
   /* we first check out if we actually need to perform a resize,
    * which is not the case if we got another container queued for
-   * a resize in our anchestry. also we can skip the whole
+   * a resize in our ancestry. also we can skip the whole
    * resize_widgets checks if we are a toplevel and NEED_RESIZE.
    * this code assumes that our allocation is sufficient for our
    * requisition, since otherwise we would NEED_RESIZE.
@@ -1119,7 +1097,7 @@ gtk_container_resize_children (GtkContainer *container)
 
   resize_container = GTK_WIDGET (container);
 
-  /* we now walk the anchestry for all resize widgets as long
+  /* we now walk the ancestry for all resize widgets as long
    * as they are our children and as long as their allocation
    * is insufficient, since we don't need to reallocate below that.
    */
@@ -1141,9 +1119,9 @@ gtk_container_resize_children (GtkContainer *container)
     }
 
   /* for the newly setup resize_widgets list, we now walk each widget's
-   * anchestry to sort those widgets out that have RESIZE_NEEDED parents.
+   * ancestry to sort those widgets out that have RESIZE_NEEDED parents.
    * we can safely stop the walk if we are the parent, since we checked
-   * our own anchestry already.
+   * our own ancestry already.
    */
   resize_containers = NULL;
   for (node = resize_widgets; node; node = node->next)
index 54a6c14f350e783dc4399c85b20f0bf86d95571c..b7ed0fb1fc24970964e1bd5cd5aeae1c6cc7540d 100644 (file)
@@ -321,11 +321,12 @@ gtk_signal_emitv (GtkObject *object,
       GValue *value = params + 1 + i;
       GtkArg *arg = args + i;
       
-      g_value_init (value, arg->type);
+      g_value_init (value, arg->type & ~G_SIGNAL_TYPE_STATIC_SCOPE);
       if (!gtk_arg_static_to_value (arg, value))
        {
          g_warning ("%s: failed to convert arg type `%s' to value type `%s'",
-                    G_STRLOC, g_type_name (arg->type), g_type_name (G_VALUE_TYPE (value)));
+                    G_STRLOC, g_type_name (arg->type & ~G_SIGNAL_TYPE_STATIC_SCOPE),
+                    g_type_name (G_VALUE_TYPE (value)));
          return;
        }
     }
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
new file mode 100644 (file)
index 0000000..ccd7100
--- /dev/null
@@ -0,0 +1,679 @@
+/* GTK - The GIMP Toolkit
+ * gtksizegroup.c: 
+ * Copyright (C) 2001 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gtkcontainer.h"
+#include "gtkintl.h"
+#include "gtksignal.h"
+#include "gtksizegroup.h"
+
+enum {
+  PROP_0,
+  PROP_MODE
+};
+
+static void gtk_size_group_set_property (GObject      *object,
+                                        guint         prop_id,
+                                        const GValue *value,
+                                        GParamSpec   *pspec);
+static void gtk_size_group_get_property (GObject      *object,
+                                        guint         prop_id,
+                                        GValue       *value,
+                                        GParamSpec   *pspec);
+
+static void add_group_to_closure  (GtkSizeGroup      *group,
+                                  GtkSizeGroupMode   mode,
+                                  GSList           **groups,
+                                  GSList           **widgets);
+static void add_widget_to_closure (GtkWidget         *widget,
+                                  GtkSizeGroupMode   mode,
+                                  GSList           **groups,
+                                  GSList           **widgets);
+
+static GQuark size_groups_quark;
+static const gchar *size_groups_tag = "gtk-size-groups";
+
+static GSList *
+get_size_groups (GtkWidget *widget)
+{
+  if (!size_groups_quark)
+    size_groups_quark = g_quark_from_string (size_groups_tag);
+  
+  return g_object_get_qdata (G_OBJECT (widget), size_groups_quark);
+}
+
+static void
+set_size_groups (GtkWidget *widget,
+                GSList    *groups)
+{
+  if (!size_groups_quark)
+    size_groups_quark = g_quark_from_string (size_groups_tag);
+
+  g_object_set_qdata (G_OBJECT (widget), size_groups_quark, groups);
+}
+
+static void
+add_group_to_closure (GtkSizeGroup    *group,
+                     GtkSizeGroupMode mode,
+                     GSList         **groups,
+                     GSList         **widgets)
+{
+  GSList *tmp_widgets;
+  
+  *groups = g_slist_prepend (*groups, group);
+
+  tmp_widgets = group->widgets;
+  while (tmp_widgets)
+    {
+      GtkWidget *tmp_widget = tmp_widgets->data;
+      
+      if (!g_slist_find (*widgets, tmp_widget))
+       add_widget_to_closure (tmp_widget, mode, groups, widgets);
+      
+      tmp_widgets = tmp_widgets->next;
+    }
+}
+
+static void
+add_widget_to_closure (GtkWidget       *widget,
+                      GtkSizeGroupMode mode,
+                      GSList         **groups,
+                      GSList         **widgets)
+{
+  GSList *tmp_groups;
+
+  *widgets = g_slist_prepend (*widgets, widget);
+
+  tmp_groups = get_size_groups (widget);
+  while (tmp_groups)
+    {
+      GtkSizeGroup *tmp_group = tmp_groups->data;
+      
+      if ((tmp_group->mode == GTK_SIZE_GROUP_BOTH || tmp_group->mode == mode) &&
+         !g_slist_find (*groups, tmp_group))
+       add_group_to_closure (tmp_group, mode, groups, widgets);
+
+      tmp_groups = tmp_groups->next;
+    }
+}
+
+static void
+real_queue_resize (GtkWidget *widget)
+{
+  if (GTK_IS_RESIZE_CONTAINER (widget))
+    gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
+  
+  if (widget->parent)
+    gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
+  else if (GTK_WIDGET_TOPLEVEL (widget) && GTK_IS_CONTAINER (widget))
+    gtk_container_queue_resize (GTK_CONTAINER (widget));
+}
+
+static void
+reset_group_sizes (GSList *groups)
+{
+  GSList *tmp_list = groups;
+  while (tmp_list)
+    {
+      GtkSizeGroup *tmp_group = tmp_list->data;
+
+      tmp_group->have_width = FALSE;
+      tmp_group->have_height = FALSE;
+      
+      tmp_list = tmp_list->next;
+    }
+}
+
+static void
+queue_resize_on_widget (GtkWidget *widget,
+                       gboolean   check_siblings)
+{
+  GtkWidget *parent = widget;
+  GSList *tmp_list;
+
+  while (parent)
+    {
+      GSList *widget_groups;
+      GSList *groups;
+      GSList *widgets;
+      
+      if (widget == parent && !check_siblings)
+       {
+         real_queue_resize (widget);
+         parent = parent->parent;
+         continue;
+       }
+      
+      widget_groups = get_size_groups (parent);
+      if (!widget_groups)
+       {
+         if (widget == parent)
+           real_queue_resize (widget);
+
+         parent = parent->parent;
+         continue;
+       }
+
+      groups = NULL;
+      widgets = NULL;
+         
+      add_widget_to_closure (parent, GTK_SIZE_GROUP_HORIZONTAL, &groups, &widgets);
+      reset_group_sizes (groups);
+             
+      tmp_list = widgets;
+      while (tmp_list)
+       {
+         if (tmp_list->data == parent)
+           {
+             if (widget == parent)
+               real_queue_resize (parent);
+           }
+         else
+           queue_resize_on_widget (tmp_list->data, FALSE);
+
+         tmp_list = tmp_list->next;
+       }
+      
+      g_slist_free (widgets);
+      g_slist_free (groups);
+             
+      groups = NULL;
+      widgets = NULL;
+             
+      add_widget_to_closure (parent, GTK_SIZE_GROUP_VERTICAL, &groups, &widgets);
+      reset_group_sizes (groups);
+             
+      tmp_list = widgets;
+      while (tmp_list)
+       {
+         if (tmp_list->data == parent)
+           {
+             if (widget == parent)
+               real_queue_resize (parent);
+           }
+         else
+           queue_resize_on_widget (tmp_list->data, FALSE);
+
+         tmp_list = tmp_list->next;
+       }
+      
+      g_slist_free (widgets);
+      g_slist_free (groups);
+      
+      parent = parent->parent;
+    }
+}
+
+static void
+queue_resize_on_group (GtkSizeGroup *size_group)
+{
+  if (size_group->widgets)
+    queue_resize_on_widget (size_group->widgets->data, TRUE);
+}
+
+static void
+gtk_size_group_class_init (GtkSizeGroupClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->set_property = gtk_size_group_set_property;
+  gobject_class->get_property = gtk_size_group_get_property;
+  
+  g_object_class_install_property (gobject_class,
+                                  PROP_MODE,
+                                  g_param_spec_enum ("mode",
+                                                     _("Mode"),
+                                                     _("The the directions in which the size group effects the requested sizes"
+                                                       " of its component widgets."),
+                                                     GTK_TYPE_SIZE_GROUP_MODE,
+                                                     GTK_SIZE_GROUP_HORIZONTAL,
+                                                     G_PARAM_READWRITE));
+}
+
+static void
+gtk_size_group_init (GtkSizeGroup *size_group)
+{
+  size_group->widgets = NULL;
+  size_group->mode = GTK_SIZE_GROUP_HORIZONTAL;
+  size_group->have_width = 0;
+  size_group->have_height = 0;
+}
+
+GtkType
+gtk_size_group_get_type (void)
+{
+  static GtkType size_group_type = 0;
+
+  if (!size_group_type)
+    {
+      static const GTypeInfo size_group_info =
+      {
+       sizeof (GtkSizeGroupClass),
+       NULL,           /* base_init */
+       NULL,           /* base_finalize */
+       (GClassInitFunc) gtk_size_group_class_init,
+       NULL,           /* class_finalize */
+       NULL,           /* class_data */
+       sizeof (GtkSizeGroup),
+       16,             /* n_preallocs */
+       (GInstanceInitFunc) gtk_size_group_init,
+      };
+
+      size_group_type = g_type_register_static (G_TYPE_OBJECT, "GtkSizeGroup", &size_group_info, 0);
+    }
+
+  return size_group_type;
+}
+
+static void
+gtk_size_group_set_property (GObject      *object,
+                            guint         prop_id,
+                            const GValue *value,
+                            GParamSpec   *pspec)
+{
+  GtkSizeGroup *size_group = GTK_SIZE_GROUP (object);
+
+  switch (prop_id)
+    {
+    case PROP_MODE:
+      gtk_size_group_set_mode (size_group, g_value_get_enum (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_size_group_get_property (GObject      *object,
+                            guint         prop_id,
+                            GValue       *value,
+                            GParamSpec   *pspec)
+{
+  GtkSizeGroup *size_group = GTK_SIZE_GROUP (object);
+
+  switch (prop_id)
+    {
+    case PROP_MODE:
+      g_value_set_enum (value, size_group->mode);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+/**
+ * gtk_size_group_new:
+ * @mode: the mode for the new size group.
+ * 
+ * Create a new #GtkSizeGroup.
+ * Return value: a newly created #GtkSizeGroup
+ **/
+GtkSizeGroup *
+gtk_size_group_new (GtkSizeGroupMode  mode)
+{
+  GtkSizeGroup *size_group = g_object_new (GTK_TYPE_SIZE_GROUP, NULL);
+
+  size_group->mode = mode;
+
+  return size_group;
+}
+
+/**
+ * gtk_size_group_set_mode:
+ * @size_group: a #GtkSizeGroup
+ * @mode: the mode to set for the size group.
+ * 
+ * Sets the #GtkSizeGroupMode of the size group. The mode of the size
+ * group determines whether the widgets in the size group should
+ * all have the same horizontal requisition (%GTK_SIZE_GROUP_MODE_HORIZONTAL)
+ * all have the same vertical requisition (%GTK_SIZE_GROUP_MODE_VERTICAL),
+ * or should all have the same requisition in both directions.
+ * (%GTK_SIZE_GROUP_MODE_BOTH).
+ **/
+void
+gtk_size_group_set_mode (GtkSizeGroup     *size_group,
+                        GtkSizeGroupMode  mode)
+{
+  g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
+
+  if (size_group->mode != mode)
+    {
+      size_group->mode = mode;
+      queue_resize_on_group (size_group);
+    }
+}
+
+/**
+ * gtk_size_group_get_mode:
+ * @size_group: a #GtkSizeGroup
+ * 
+ * Gets the current mode of the size group. See gtk_size_group_set_mode().
+ * 
+ * Return value: the current mode of the size group.
+ **/
+GtkSizeGroupMode
+gtk_size_group_get_mode (GtkSizeGroup *size_group)
+{
+  g_return_val_if_fail (GTK_IS_SIZE_GROUP (size_group), GTK_SIZE_GROUP_BOTH);
+
+  return size_group->mode;
+}
+
+static void
+gtk_size_group_widget_destroyed (GtkWidget    *widget,
+                                GtkSizeGroup *size_group)
+{
+  gtk_size_group_remove_widget (size_group, widget);
+}
+
+/**
+ * gtk_size_group_add_widget:
+ * @size_group: a #GtkSizeGroup
+ * @widget: the #GtkWidget to add
+ * 
+ * Adds a widget to a #GtkSizeGroup. In the future, the requisition
+ * of the widget will be determined as the maximum of its requisition
+ * and the requisition of the other widgets in the size group.
+ * Whether this applies horizontally, vertically, or in both directions
+ * depends on the mode of the size group. See gtk_size_group_set_mode().
+ **/
+void
+gtk_size_group_add_widget (GtkSizeGroup     *size_group,
+                          GtkWidget        *widget)
+{
+  GSList *groups;
+  
+  g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  
+  groups = get_size_groups (widget);
+
+  if (!g_slist_find (groups, widget))
+    {
+      groups = g_slist_prepend (groups, size_group);
+      set_size_groups (widget, groups);
+
+      size_group->widgets = g_slist_prepend (size_group->widgets, widget);
+
+      gtk_signal_connect (GTK_OBJECT (widget), "destroy",
+                         GTK_SIGNAL_FUNC (gtk_size_group_widget_destroyed), size_group);
+
+      g_object_ref (G_OBJECT (size_group));
+    }
+  
+  queue_resize_on_group (size_group);
+}
+
+/**
+ * gtk_size_group_remove_widget:
+ * @size_group: a #GtkSizeGrup
+ * @widget: the #GtkWidget to remove
+ * 
+ * Removes a widget from a #GtkSizeGroup.
+ **/
+void
+gtk_size_group_remove_widget (GtkSizeGroup     *size_group,
+                             GtkWidget        *widget)
+{
+  GSList *groups;
+  
+  g_return_if_fail (GTK_IS_SIZE_GROUP (size_group));
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (g_slist_find (size_group->widgets, widget));
+
+  gtk_signal_disconnect_by_func (GTK_OBJECT (widget), 
+                                GTK_SIGNAL_FUNC (gtk_size_group_widget_destroyed), size_group);
+  
+  groups = get_size_groups (widget);
+  groups = g_slist_remove (groups, size_group);
+  set_size_groups (widget, groups);
+
+  size_group->widgets = g_slist_remove (size_group->widgets, widget);
+  queue_resize_on_group (size_group);
+  gtk_widget_queue_resize (widget);
+
+  g_object_unref (G_OBJECT (size_group));
+}
+
+static gint
+get_base_dimension (GtkWidget        *widget,
+                   GtkSizeGroupMode  mode)
+{
+  GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
+
+  if (mode == GTK_SIZE_GROUP_HORIZONTAL)
+    {
+      if (aux_info && aux_info->width > 0)
+       return aux_info->width;
+      else
+       return widget->requisition.width;
+    }
+  else
+    {
+      if (aux_info && aux_info->height > 0)
+       return aux_info->height;
+      else
+       return widget->requisition.height;
+    }
+}
+
+static gint
+compute_base_dimension (GtkWidget        *widget,
+                       GtkSizeGroupMode  mode)
+{
+  gtk_widget_ensure_style (widget);
+  gtk_signal_emit_by_name (GTK_OBJECT (widget), "size_request", &widget->requisition);
+
+  return get_base_dimension (widget, mode);
+}
+
+static gint
+compute_dimension (GtkWidget        *widget,
+                  GtkSizeGroupMode  mode)
+{
+  GSList *widgets = NULL;
+  GSList *groups = NULL;
+  GSList *tmp_list;
+  gint result = 0;
+
+  add_widget_to_closure (widget, mode, &groups, &widgets);
+
+  g_slist_foreach (widgets, (GFunc)g_object_ref, NULL);
+  
+  if (!groups)
+    {
+      result = compute_base_dimension (widget, mode);
+    }
+  else
+    {
+      GtkSizeGroup *group = groups->data;
+
+      if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
+       result = group->requisition.width;
+      else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
+       result = group->requisition.height;
+      else
+       {
+         tmp_list = widgets;
+         while (tmp_list)
+           {
+             GtkWidget *tmp_widget = tmp_list->data;
+
+             gint dimension = compute_base_dimension (tmp_widget, mode);
+
+             if (dimension > result)
+               result = dimension;
+             
+             tmp_list = tmp_list->next;
+           }
+
+         tmp_list = groups;
+         while (tmp_list)
+           {
+             GtkSizeGroup *tmp_group = tmp_list->data;
+
+             if (mode == GTK_SIZE_GROUP_HORIZONTAL)
+               {
+                 tmp_group->have_width = TRUE;
+                 tmp_group->requisition.width = result;
+               }
+             else
+               {
+                 tmp_group->have_height = TRUE;
+                 tmp_group->requisition.height = result;
+               }
+             
+             tmp_list = tmp_list->next;
+           }
+       }
+    }
+
+  g_slist_foreach (widgets, (GFunc)g_object_unref, NULL);
+  
+  g_slist_free (widgets);
+  g_slist_free (groups);
+
+  return result;
+}
+
+static gint
+get_dimension (GtkWidget        *widget,
+              GtkSizeGroupMode  mode)
+{
+  GSList *widgets = NULL;
+  GSList *groups = NULL;
+  gint result = 0;
+
+  add_widget_to_closure (widget, mode, &groups, &widgets);
+
+  if (!groups)
+    {
+      result = get_base_dimension (widget, mode);
+    }
+  else
+    {
+      GtkSizeGroup *group = groups->data;
+
+      if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
+       result = group->requisition.width;
+      else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
+       result = group->requisition.height;
+    }
+
+  g_slist_free (widgets);
+  g_slist_free (groups);
+
+  return result;
+}
+
+static void
+get_fast_child_requisition (GtkWidget      *widget,
+                           GtkRequisition *requisition)
+{
+  GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
+  
+  *requisition = widget->requisition;
+  
+  if (aux_info)
+    {
+      if (aux_info->width > 0)
+       requisition->width = aux_info->width;
+      if (aux_info && aux_info->height > 0)
+       requisition->height = aux_info->height;
+    }
+}
+
+/**
+ * _gtk_size_group_get_child_requisition:
+ * @widget: a #GtkWidget
+ * @requisition: location to store computed requisition.
+ * 
+ * Retrieve the "child requisition" of the widget, taking account grouping
+ * of the widget's requisition with other widgets.
+ **/
+void
+_gtk_size_group_get_child_requisition (GtkWidget      *widget,
+                                      GtkRequisition *requisition)
+{
+  if (requisition)
+    {
+      if (get_size_groups (widget))
+       {
+         requisition->width = get_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL);
+         requisition->height = get_dimension (widget, GTK_SIZE_GROUP_VERTICAL);
+
+         /* Only do the full computation if we actually have size groups */
+       }
+      else
+       get_fast_child_requisition (widget, requisition);
+    }
+}
+
+/**
+ * _gtk_size_group_compute_requisition:
+ * @widget: a #GtkWidget
+ * @requisition: location to store computed requisition.
+ * 
+ * Compute the requisition of a widget taking into account grouping of
+ * the widget's requisition with other widgets.
+ **/
+void
+_gtk_size_group_compute_requisition (GtkWidget      *widget,
+                                    GtkRequisition *requisition)
+{
+  gint width;
+  gint height;
+
+  if (get_size_groups (widget))
+    {
+      /* Only do the full computation if we actually have size groups */
+      
+      width = compute_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL);
+      height = compute_dimension (widget, GTK_SIZE_GROUP_VERTICAL);
+
+      if (requisition)
+       {
+         requisition->width = width;
+         requisition->height = height;
+       }
+    }
+  else
+    {
+      gtk_widget_ensure_style (widget);
+      gtk_signal_emit_by_name (GTK_OBJECT (widget), "size_request", &widget->requisition);
+
+      if (requisition)
+       get_fast_child_requisition (widget, requisition);
+    }
+}
+
+/**
+ * _gtk_size_group_queue_resize:
+ * @widget: a #GtkWidget
+ * 
+ * Queue a resize on a widget, and on all other widgets grouped with this widget.
+ **/
+void
+_gtk_size_group_queue_resize (GtkWidget *widget)
+{
+  queue_resize_on_widget (widget, TRUE);
+}
diff --git a/gtk/gtksizegroup.h b/gtk/gtksizegroup.h
new file mode 100644 (file)
index 0000000..32d3ec2
--- /dev/null
@@ -0,0 +1,100 @@
+/* GTK - The GIMP Toolkit
+ * gtksizegroup.h: 
+ * Copyright (C) 2000 Red Hat Software
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_SIZE_GROUP_H__
+#define __GTK_SIZE_GROUP_H__
+
+#include <gtk/gtkwidget.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GTK_TYPE_SIZE_GROUP            (gtk_size_group_get_type ())
+#define GTK_SIZE_GROUP(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_SIZE_GROUP, GtkSizeGroup))
+#define GTK_SIZE_GROUP_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_SIZE_GROUP, GtkSizeGroupClass))
+#define GTK_IS_SIZE_GROUP(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_SIZE_GROUP))
+#define GTK_IS_SIZE_GROUP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SIZE_GROUP))
+#define GTK_SIZE_GROUP_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_SIZE_GROUP, GtkSizeGroupClass))
+
+
+typedef struct _GtkSizeGroup       GtkSizeGroup;
+typedef struct _GtkSizeGroupClass  GtkSizeGroupClass;
+
+struct _GtkSizeGroup
+{
+  GObject parent_instance;
+
+  GSList *widgets;
+
+  guint8 mode;
+  
+  guint have_width : 1;
+  guint have_height : 1;
+
+  GtkRequisition requisition;
+};
+
+struct _GtkSizeGroupClass
+{
+  GObjectClass parent_class;
+};
+
+/**
+ * GtkSizeGroupMode:
+ * @GTK_SIZE_GROUP_NONE: group has no effect  
+ * @GTK_SIZE_GROUP_HORIZONTAL: group effects horizontal requisition
+ * @GTK_SIZE_GROUP_VERTICAL: group effects vertical requisition
+ * @GTK_SIZE_GROUP_BOTH: group effects both horizontal and vertical requisition
+ * 
+ * The mode of the size group determines the directions in which the size
+ * group effects the requested sizes of its component widgets.
+ **/
+typedef enum {
+  GTK_SIZE_GROUP_NONE,
+  GTK_SIZE_GROUP_HORIZONTAL,
+  GTK_SIZE_GROUP_VERTICAL,
+  GTK_SIZE_GROUP_BOTH
+} GtkSizeGroupMode;
+
+GType            gtk_size_group_get_type      (void) G_GNUC_CONST;;
+
+GtkSizeGroup *   gtk_size_group_new           (GtkSizeGroupMode  mode);
+void             gtk_size_group_set_mode      (GtkSizeGroup     *size_group,
+                                              GtkSizeGroupMode  type);
+GtkSizeGroupMode gtk_size_group_get_mode      (GtkSizeGroup     *size_group);
+void             gtk_size_group_add_widget    (GtkSizeGroup     *size_group,
+                                              GtkWidget        *widget);
+void             gtk_size_group_remove_widget (GtkSizeGroup     *size_group,
+                                              GtkWidget        *widget);
+
+
+void _gtk_size_group_get_child_requisition (GtkWidget      *widget,
+                                           GtkRequisition *requisition);
+void _gtk_size_group_compute_requisition   (GtkWidget      *widget,
+                                           GtkRequisition *requisition);
+void _gtk_size_group_queue_resize          (GtkWidget      *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GTK_SIZE_GROUP_H__ */
index c370e9d2b646f6efe4d3e893a62cd00343346a6b..34dd90c807ff8ac4ac1e107b1f1fd7ad77469e4e 100644 (file)
@@ -203,10 +203,10 @@ gtk_viewport_get_property (GObject         *object,
   switch (prop_id)
     {
     case PROP_HADJUSTMENT:
-      g_value_set_object (value, viewport->hadjustment);
+      g_value_set_object (value, G_OBJECT (viewport->hadjustment));
       break;
     case PROP_VADJUSTMENT:
-      g_value_set_object (value, viewport->vadjustment);
+      g_value_set_object (value, G_OBJECT (viewport->vadjustment));
       break;
     case PROP_SHADOW_TYPE:
       g_value_set_enum (value, viewport->shadow_type);
index 345b430db7a1ce82ad8fe486d5be1e7b772b10a4..dd09db96c664311eacacda3580b5ffce5f36b130 100644 (file)
@@ -34,6 +34,7 @@
 #include "gtkrc.h"
 #include "gtkselection.h"
 #include "gtksettings.h"
+#include "gtksizegroup.h"
 #include "gtksignal.h"
 #include "gtkwidget.h"
 #include "gtkwindow.h"
@@ -2081,15 +2082,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (GTK_IS_RESIZE_CONTAINER (widget))
-    gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
-
   gtk_widget_queue_clear (widget);
 
-  if (widget->parent)
-    gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
-  else if (GTK_WIDGET_TOPLEVEL (widget) && GTK_IS_CONTAINER (widget))
-    gtk_container_queue_resize (GTK_CONTAINER (widget));
+  _gtk_size_group_queue_resize (widget);
 }
 
 /**
@@ -2149,15 +2144,14 @@ gtk_widget_size_request (GtkWidget      *widget,
     g_warning ("gtk_widget_size_request() called on child widget with request equal\n to widget->requisition. gtk_widget_set_usize() may not work properly.");
 #endif /* G_ENABLE_DEBUG */
 
-  gtk_widget_ref (widget);
-  gtk_widget_ensure_style (widget);
-  gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_REQUEST],
-                  &widget->requisition);
+  _gtk_size_group_compute_requisition (widget, requisition);
 
+#if 0  
   if (requisition)
     gtk_widget_get_child_requisition (widget, requisition);
 
   gtk_widget_unref (widget);
+#endif  
 }
 
 /**
@@ -2174,21 +2168,7 @@ void
 gtk_widget_get_child_requisition (GtkWidget     *widget,
                                  GtkRequisition *requisition)
 {
-  GtkWidgetAuxInfo *aux_info;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (widget));
-
-  *requisition = widget->requisition;
-  
-  aux_info =_gtk_widget_get_aux_info (widget, FALSE);
-  if (aux_info)
-    {
-      if (aux_info->width > 0)
-       requisition->width = aux_info->width;
-      if (aux_info->height > 0)
-       requisition->height = aux_info->height;
-    }
+  _gtk_size_group_get_child_requisition (widget, requisition);
 }
 
 /**
index af486e005bcf46ffcc494cc2f5375f4079c1ca72..7373cb237daca59feae07319bae6f9a23b1e5aaf 100644 (file)
@@ -8,3 +8,4 @@ cat-id-tbl.c
 gtk20.pot
 messages
 stamp-cat-id
+po2tbl.sed
\ No newline at end of file
index fa421479f8c95e0c1b0fc6d71d41789735e22cae..c99e032fdfcd632c566cb82030d281061ce3347d 100644 (file)
@@ -1,3 +1,8 @@
+Fri May 18 11:22:04 2001  Owen Taylor  <otaylor@redhat.com>
+
+       * Move to glib-gettext.m4, to avoid including, buildding
+       intl/.
+
 2001-05-15  Matthias Warkus  <mawarkus@gnome.org>
 
        * de.po: Brought this up to date.
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
new file mode 100644 (file)
index 0000000..e6a1a75
--- /dev/null
@@ -0,0 +1,252 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
+#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = $(prefix)/share/gettext/po
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
+
+CC = @CC@
+GENCAT = @GENCAT@
+GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
+MSGMERGE = PATH=../src:$$PATH msgmerge
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = cat-id-tbl.c
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+       $(COMPILE) $<
+
+.po.pox:
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
+
+.po.mo:
+       $(MSGFMT) -o $@ $<
+
+.po.gmo:
+       file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+         && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+.po.cat:
+       sed -f ../intl/po2msg.sed < $< > $*.msg \
+         && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: all-@USE_NLS@
+
+all-yes: cat-id-tbl.c $(CATALOGS)
+all-no:
+
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
+         --add-comments --keyword=_ --keyword=N_ \
+         --files-from=$(srcdir)/POTFILES.in \
+       && test ! -f $(GETTEXT_PACKAGE).po \
+          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+
+$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
+$(srcdir)/stamp-cat-id: $(GETTEXT_PACKAGE).pot
+       rm -f cat-id-tbl.tmp
+       sed -f ./po2tbl.sed $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               | sed -e "s/@GETTEXT_PACKAGE NAME@/$(GETTEXT_PACKAGE)/" > cat-id-tbl.tmp
+       if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
+         rm cat-id-tbl.tmp; \
+       else \
+         echo cat-id-tbl.c changed; \
+         rm -f $(srcdir)/cat-id-tbl.c; \
+         mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
+       fi
+       cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+install-data-no: all
+install-data-yes: all
+       if test -r "$(MKINSTALLDIRS)"; then \
+         $(MKINSTALLDIRS) $(datadir); \
+       else \
+         $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
+       fi
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         case "$$cat" in \
+           *.gmo) destdir=$(gnulocaledir);; \
+           *)     destdir=$(localedir);; \
+         esac; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         dir=$$destdir/$$lang/LC_MESSAGES; \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $$dir; \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
+         fi; \
+         if test -r $$cat; then \
+           $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         else \
+           $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $(srcdir)/$$cat as" \
+                "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         fi; \
+         if test -r $$cat.m; then \
+           $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+           echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+         else \
+           if test -r $(srcdir)/$$cat.m ; then \
+             $(INSTALL_DATA) $(srcdir)/$$cat.m \
+               $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+             echo "installing $(srcdir)/$$cat as" \
+                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+           else \
+             true; \
+           fi; \
+         fi; \
+       done
+       if test "$(GETTEXT_PACKAGE)" = "gettext"; then \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $(gettextsrcdir); \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+         fi; \
+         $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+                         $(gettextsrcdir)/Makefile.in.in; \
+       else \
+         : ; \
+       fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         rm -f $(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+       done
+       rm -f $(gettextsrcdir)/po-Makefile.in.in
+
+check: all
+
+cat-id-tbl.o: ../intl/libgettext.h
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+       rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f $(GMOFILES)
+
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       for file in $$dists; do \
+         ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+           || cp -p $(srcdir)/$$file $(distdir); \
+       done
+
+update-po: Makefile
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       PATH=`pwd`/../src:$$PATH; \
+       cd $(srcdir); \
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         mv $$lang.po $$lang.old.po; \
+         echo "$$lang:"; \
+         if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
+           rm -f $$lang.old.po; \
+         else \
+           echo "msgmerge for $$cat failed!"; \
+           rm -f $$lang.po; \
+           mv $$lang.old.po $$lang.po; \
+         fi; \
+       done
+
+POTFILES: POTFILES.in
+       ( if test 'x$(srcdir)' != 'x.'; then \
+           posrcprefix='$(top_srcdir)/'; \
+         else \
+           posrcprefix="../"; \
+         fi; \
+         rm -f $@-t $@ \
+           && (sed -e '/^#/d' -e '/^[  ]*$$/d' \
+                   -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+               | sed -e '$$s/\\$$//') > $@-t \
+           && chmod a-w $@-t \
+           && mv $@-t $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+       cd .. \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/po2tbl.sed.in b/po/po2tbl.sed.in
new file mode 100644 (file)
index 0000000..b3bcca4
--- /dev/null
@@ -0,0 +1,102 @@
+# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+1 {
+  i\
+/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot.  */\
+\
+#if HAVE_CONFIG_H\
+# include <config.h>\
+#endif\
+\
+#include "libgettext.h"\
+\
+const struct _msg_ent _msg_tbl[] = {
+  h
+  s/.*/0/
+  x
+}
+#
+# Write msgid entries in C array form.
+#
+/^msgid/ {
+  s/msgid[     ]*\(".*"\)/  {\1/
+  tb
+# Append the next line
+  :b
+  N
+# Look whether second part is continuation line.
+  s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
+# Yes, then branch.
+  ta
+# Because we assume that the input file correctly formed the line
+# just read cannot be again be a msgid line.  So it's safe to ignore
+# it.
+  s/\(.*\)\n.*/\1/
+  bc
+# We found a continuation line.  But before printing insert '\'.
+  :a
+  s/\(.*\)\(\n.*\)/\1\\\2/
+  P
+# We cannot use D here.
+  s/.*\n\(.*\)/\1/
+# Some buggy seds do not clear the `successful substitution since last ``t'''
+# flag on `N', so we do a `t' here to clear it.
+  tb
+# Not reached
+  :c
+  x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+  td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+  :d
+  s/9\(_*\)$/_\1/
+  td
+# Assure at least one digit is available.
+  s/^\(_*\)$/0\1/
+# Increment the last digit.
+  s/8\(_*\)$/9\1/
+  s/7\(_*\)$/8\1/
+  s/6\(_*\)$/7\1/
+  s/5\(_*\)$/6\1/
+  s/4\(_*\)$/5\1/
+  s/3\(_*\)$/4\1/
+  s/2\(_*\)$/3\1/
+  s/1\(_*\)$/2\1/
+  s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+  s/_/0/g
+  x
+  G
+  s/\(.*\)\n\([0-9]*\)/\1, \2},/
+  s/\(.*\)"$/\1/
+  p
+}
+#
+# Last line.
+#
+$ {
+  i\
+};\
+
+  g
+  s/0*\(.*\)/int _msg_tbl_length = \1;/p
+}
+d
index 656114e2d1328bf3f5a9465659558612a2964e3d..a6502591826f1ea4ba26386d8fdd6d5b3e68c084 100644 (file)
@@ -3637,6 +3637,169 @@ create_entry (void)
     gtk_widget_destroy (window);
 }
 
+/*
+ * GtkSizeGroup
+ */
+
+#define SIZE_GROUP_INITIAL_SIZE 50
+
+static void
+size_group_hsize_changed (GtkSpinButton *spin_button,
+                         GtkWidget     *button)
+{
+  gtk_widget_set_usize (GTK_BIN (button)->child,
+                       gtk_spin_button_get_value_as_int (spin_button),
+                       -2);
+}
+
+static void
+size_group_vsize_changed (GtkSpinButton *spin_button,
+                         GtkWidget     *button)
+{
+  gtk_widget_set_usize (GTK_BIN (button)->child,
+                       -2,
+                       gtk_spin_button_get_value_as_int (spin_button));
+}
+
+static GtkWidget *
+create_size_group_window (GtkSizeGroup *master_size_group)
+{
+  GtkWidget *window;
+  GtkWidget *table;
+  GtkWidget *main_button;
+  GtkWidget *button;
+  GtkWidget *spin_button;
+  GtkWidget *hbox;
+  GtkSizeGroup *hgroup1;
+  GtkSizeGroup *hgroup2;
+  GtkSizeGroup *vgroup1;
+  GtkSizeGroup *vgroup2;
+
+  window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
+                                       NULL, 0,
+                                       GTK_STOCK_BUTTON_CLOSE,
+                                       GTK_RESPONSE_NONE,
+                                       NULL);
+
+  gtk_window_set_resizeable (GTK_WINDOW (window), FALSE);
+
+  gtk_signal_connect (GTK_OBJECT (window), "response",
+                     GTK_SIGNAL_FUNC (gtk_widget_destroy),
+                     NULL);
+
+  table = gtk_table_new (2, 2, FALSE);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), table, TRUE, TRUE, 0);
+
+  gtk_table_set_row_spacings (GTK_TABLE (table), 5);
+  gtk_table_set_col_spacings (GTK_TABLE (table), 5);
+  gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+  gtk_widget_set_usize (table, 250, 250);
+
+  hgroup1 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  hgroup2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  vgroup1 = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+  vgroup2 = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+
+  main_button = gtk_button_new_with_label ("X");
+  
+  gtk_table_attach (GTK_TABLE (table), main_button,
+                   0, 1,       0, 1,
+                   GTK_EXPAND, GTK_EXPAND,
+                   0,          0);
+  gtk_size_group_add_widget (master_size_group, main_button);
+  gtk_size_group_add_widget (hgroup1, main_button);
+  gtk_size_group_add_widget (vgroup1, main_button);
+  gtk_widget_set_usize (GTK_BIN (main_button)->child, SIZE_GROUP_INITIAL_SIZE, SIZE_GROUP_INITIAL_SIZE);
+
+  button = gtk_button_new ();
+  gtk_table_attach (GTK_TABLE (table), button,
+                   1, 2,       0, 1,
+                   GTK_EXPAND, GTK_EXPAND,
+                   0,          0);
+  gtk_size_group_add_widget (vgroup1, button);
+  gtk_size_group_add_widget (vgroup2, button);
+
+  button = gtk_button_new ();
+  gtk_table_attach (GTK_TABLE (table), button,
+                   0, 1,       1, 2,
+                   GTK_EXPAND, GTK_EXPAND,
+                   0,          0);
+  gtk_size_group_add_widget (hgroup1, button);
+  gtk_size_group_add_widget (hgroup2, button);
+
+  button = gtk_button_new ();
+  gtk_table_attach (GTK_TABLE (table), button,
+                   1, 2,       1, 2,
+                   GTK_EXPAND, GTK_EXPAND,
+                   0,          0);
+  gtk_size_group_add_widget (hgroup2, button);
+  gtk_size_group_add_widget (vgroup2, button);
+
+  g_object_unref (G_OBJECT (hgroup1));
+  g_object_unref (G_OBJECT (hgroup2));
+  g_object_unref (G_OBJECT (vgroup1));
+  g_object_unref (G_OBJECT (vgroup2));
+  
+  hbox = gtk_hbox_new (FALSE, 5);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox, FALSE, FALSE, 0);
+  
+  spin_button = gtk_spin_button_new_with_range (1, 100, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
+  gtk_box_pack_start (GTK_BOX (hbox), spin_button, TRUE, TRUE, 0);
+  gtk_signal_connect (GTK_OBJECT (spin_button), "value_changed",
+                     GTK_SIGNAL_FUNC (size_group_hsize_changed), main_button);
+
+  spin_button = gtk_spin_button_new_with_range (1, 100, 1);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), SIZE_GROUP_INITIAL_SIZE);
+  gtk_box_pack_start (GTK_BOX (hbox), spin_button, TRUE, TRUE, 0);
+  gtk_signal_connect (GTK_OBJECT (spin_button), "value_changed",
+                     GTK_SIGNAL_FUNC (size_group_vsize_changed), main_button);
+
+  return window;
+}
+
+static void
+create_size_groups (void)
+{
+  static GtkWidget *window1 = NULL;
+  static GtkWidget *window2 = NULL;
+  static GtkSizeGroup *master_size_group;
+
+  if (!master_size_group)
+    master_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+  
+  if (!window1)
+    {
+      window1 = create_size_group_window (master_size_group);
+
+      gtk_signal_connect (GTK_OBJECT (window1), "destroy",
+                         GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+                         &window1);
+    }
+
+  if (!window2)
+    {
+      window2 = create_size_group_window (master_size_group);
+
+      gtk_signal_connect (GTK_OBJECT (window2), "destroy",
+                         GTK_SIGNAL_FUNC (gtk_widget_destroyed),
+                         &window2);
+    }
+
+  if (GTK_WIDGET_VISIBLE (window1) && GTK_WIDGET_VISIBLE (window2))
+    {
+      gtk_widget_destroy (window1);
+      gtk_widget_destroy (window2);
+    }
+  else
+    {
+      if (!GTK_WIDGET_VISIBLE (window1))
+       gtk_widget_show_all (window1);
+      if (!GTK_WIDGET_VISIBLE (window2))
+       gtk_widget_show_all (window2);
+    }
+}
+
 /*
  * GtkSpinButton
  */
@@ -10433,6 +10596,7 @@ create_main_window (void)
       { "saved position", create_saved_position },
       { "scrolled windows", create_scrolled_windows },
       { "shapes", create_shapes },
+      { "size groups", create_size_groups },
       { "spinbutton", create_spins },
       { "statusbar", create_statusbar },
       { "styles", create_styles },