summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@src.gnome.org>1998-02-28 19:09:20 +0000
committerTim Janik <timj@src.gnome.org>1998-02-28 19:09:20 +0000
commit6d3ef70d1eacd0d7d6b167d4b869ed71b92a88b6 (patch)
tree4f7871053520cc71ec0956dac3feafd094a24e26
parentfa26673f493b01ac1d137d2efd0eae5a7329a245 (diff)
downloadgtk+-6d3ef70d1eacd0d7d6b167d4b869ed71b92a88b6.tar.gz
handle box signals. fixups for 99.4 -timj
handle box signals. fixups for 99.4 -timj
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.pre-2-011
-rw-r--r--ChangeLog.pre-2-1011
-rw-r--r--ChangeLog.pre-2-211
-rw-r--r--ChangeLog.pre-2-411
-rw-r--r--ChangeLog.pre-2-611
-rw-r--r--ChangeLog.pre-2-811
-rw-r--r--NEWS1
-rw-r--r--gtk/gtkclist.c15
-rw-r--r--gtk/gtkcombo.c4
-rw-r--r--gtk/gtkhandlebox.c47
-rw-r--r--gtk/gtkwidget.c20
-rw-r--r--gtk/testgtk.c21
-rw-r--r--tests/testgtk.c21
14 files changed, 178 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 0c47a61033..45c6e743a1 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,14 @@
+Sat Feb 28 19:29:09 1998 Tim Janik <timj@gimp.org>
+
+ * gtk/gtkclist.c (gtk_clist_new_with_titles): retrive the clist widget
+ from gtk_type_new (gtk_clist_get_type ()), not gtk_clist_new(),
+ otherwise gtk_clist_construct() gets called twice.
+
+ * gtk/gtkhandlebox.h:
+ * gtk/gtkhandlebox.c: emit signals when the child is attached/detached.
+
Sat Feb 28 15:18:36 1998 Tim Janik <timj@gimp.org>
-
+
* gtk/gtkpreview.c: fix behavior of gtk_preview_put() with
srcx/srcy != 0, gtk-shige-980127-0.patch.gz by
AOSASA Shigeru <aozasa@sakuranet.or.jp>.
diff --git a/NEWS b/NEWS
index 7d15299af7..81962b9ac0 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ Forthcoming Changes for GTK+ 0.99.4:
g_string_hash() -> g_str_hash()
g_string_equal() -> g_str_equal()
gtk_tooltips_set_tips() -> gtk_tooltips_set_tip()
+* Motif window mangaer hints support.
* Clean ups and many many bug fixes by a lot of people all over the place.
* New, long and descriptive ChangeLog entries for bored readers ;)
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 435704210a..ab29f65401 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -467,19 +467,14 @@ GtkWidget *
gtk_clist_new_with_titles (gint columns,
gchar * titles[])
{
- GtkCList *clist;
GtkWidget *widget;
- if (titles == NULL)
- return NULL;
-
- widget = gtk_clist_new (columns);
- if (!widget)
- return NULL;
- else
- clist = GTK_CLIST (widget);
+ g_return_val_if_fail (titles != NULL, NULL);
+
+ widget = gtk_type_new (gtk_clist_get_type ());
+
+ gtk_clist_construct (GTK_CLIST (widget), columns, titles);
- gtk_clist_construct (clist, columns, titles);
return widget;
}
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index 9bc3826046..fb86774d1b 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -255,8 +255,8 @@ gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
gtk_widget_set_uposition (combo->popwin, x, y);
gtk_widget_set_usize (combo->popwin, width, height);
gtk_widget_realize (combo->popwin);
- gdk_window_set_cursor (combo->popwin->window,
- gdk_cursor_new (GDK_TOP_LEFT_ARROW));
+ /* gdk_window_set_cursor (combo->popwin->window, gdk_cursor_new (GDK_TOP_LEFT_ARROW));
+ */
gdk_window_resize (combo->popwin->window, width, height);
gtk_widget_show (combo->popwin);
gtk_widget_grab_focus (combo->popwin);
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index fd08f39b86..fe3ddd25b0 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -71,6 +71,7 @@ static gint gtk_handle_box_delete_float (GtkWidget *widget,
static GtkBinClass *parent_class;
+static gint handle_box_signals[SIGNAL_LAST] = { 0 };
guint
@@ -98,6 +99,19 @@ gtk_handle_box_get_type (void)
}
static void
+gtk_handle_box_marshal_child_attached (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
+{
+ SignalChildAttached sfunc = (SignalChildAttached) func;
+
+ (* sfunc) (object,
+ (GtkWidget*) GTK_VALUE_OBJECT (args[0]),
+ func_data);
+}
+
+static void
gtk_handle_box_class_init (GtkHandleBoxClass *class)
{
GtkWidgetClass *widget_class;
@@ -108,6 +122,24 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class)
parent_class = gtk_type_class (gtk_bin_get_type ());
+ handle_box_signals[SIGNAL_CHILD_ATTACHED] =
+ gtk_signal_new ("child_attached",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached),
+ gtk_handle_box_marshal_child_attached,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
+ handle_box_signals[SIGNAL_CHILD_DETACHED] =
+ gtk_signal_new ("child_detached",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached),
+ gtk_handle_box_marshal_child_attached,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_WIDGET);
+ gtk_object_class_add_signals (object_class, handle_box_signals, SIGNAL_LAST);
+
object_class->destroy = gtk_handle_box_destroy;
widget_class->map = gtk_handle_box_map;
@@ -602,6 +634,10 @@ gtk_handle_box_motion (GtkWidget *widget,
gtk_widget_hide (hb->float_window);
+ gtk_signal_emit (GTK_OBJECT (hb),
+ handle_box_signals[SIGNAL_CHILD_ATTACHED],
+ GTK_BIN (hb)->child);
+
while (gdk_pointer_grab (widget->window,
FALSE,
(GDK_BUTTON1_MOTION_MASK
@@ -610,7 +646,7 @@ gtk_handle_box_motion (GtkWidget *widget,
NULL,
hb->fleur_cursor,
GDK_CURRENT_TIME) != 0); /* wait for success */
-
+
gtk_widget_queue_resize (widget);
}
}
@@ -634,6 +670,10 @@ gtk_handle_box_motion (GtkWidget *widget,
gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
gtk_widget_show (hb->float_window);
+ gtk_signal_emit (GTK_OBJECT (hb),
+ handle_box_signals[SIGNAL_CHILD_DETACHED],
+ GTK_BIN (hb)->child);
+
while (gdk_pointer_grab (widget->window,
FALSE,
(GDK_BUTTON1_MOTION_MASK
@@ -669,6 +709,11 @@ gtk_handle_box_delete_float (GtkWidget *widget,
gdk_window_reparent (GTK_WIDGET (hb)->window, hb->steady_window, 0, 0);
gtk_widget_hide (hb->float_window);
+
+ gtk_signal_emit (GTK_OBJECT (hb),
+ handle_box_signals[SIGNAL_CHILD_ATTACHED],
+ GTK_BIN (hb)->child);
+
gtk_widget_queue_resize (GTK_WIDGET (hb));
return FALSE;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c25775fc00..1a0e4660c8 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -235,7 +235,7 @@ static const gchar *event_key = "gtk-event-mask";
static const gchar *extension_event_key = "gtk-extension-event-mode";
static const gchar *parent_window_key = "gtk-parent-window";
static const gchar *shape_info_key = "gtk-shape-info";
-static const gchar *saved_default_style = "gtk-saved-default-style";
+static const gchar *saved_default_style_key = "gtk-saved-default-style";
@@ -2349,11 +2349,11 @@ gtk_widget_set_style (GtkWidget *widget,
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
- default_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style);
+ default_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
if (!default_style)
{
gtk_style_ref (widget->style);
- gtk_object_set_data (GTK_OBJECT (widget), saved_default_style, widget->style);
+ gtk_object_set_data (GTK_OBJECT (widget), saved_default_style_key, widget->style);
}
gtk_widget_set_style_internal (widget, style, initial_emission);
@@ -2381,14 +2381,14 @@ gtk_widget_set_rc_style (GtkWidget *widget)
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
- saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style);
+ saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
new_style = gtk_rc_get_style (widget);
if (new_style)
{
if (!saved_style)
{
gtk_style_ref (widget->style);
- gtk_object_set_data (GTK_OBJECT (widget), saved_default_style, widget->style);
+ gtk_object_set_data (GTK_OBJECT (widget), saved_default_style_key, widget->style);
}
gtk_widget_set_style_internal (widget, new_style, initial_emission);
}
@@ -2398,7 +2398,7 @@ gtk_widget_set_rc_style (GtkWidget *widget)
{
g_assert (initial_emission == FALSE); /* FIXME: remove this line */
- gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style);
+ gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style_key);
gtk_widget_set_style_internal (widget, saved_style, initial_emission);
gtk_style_unref (saved_style);
}
@@ -3297,6 +3297,7 @@ static void
gtk_widget_real_destroy (GtkObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
+ GtkStyle *saved_style;
gtk_widget_ref (widget);
@@ -3321,6 +3322,13 @@ gtk_widget_real_destroy (GtkObject *object)
if (widget->parent)
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
+ saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
+ if (saved_style)
+ {
+ gtk_style_unref (saved_style);
+ gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style_key);
+ }
+
gtk_style_unref (widget->style);
widget->style = NULL;
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 868f0b0812..fb1bc91ae1 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -939,6 +939,17 @@ create_statusbar ()
}
static void
+handle_box_child_signal (GtkHandleBox *hb,
+ GtkWidget *child,
+ const gchar *action)
+{
+ printf ("%s: child <%s> %sed\n",
+ gtk_type_name (GTK_OBJECT_TYPE (hb)),
+ gtk_type_name (GTK_OBJECT_TYPE (child)),
+ action);
+}
+
+static void
create_handle_box ()
{
static GtkWidget* window = NULL;
@@ -960,6 +971,14 @@ create_handle_box ()
hbox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (window), hbox);
+ gtk_signal_connect (GTK_OBJECT (hbox),
+ "child_attached",
+ GTK_SIGNAL_FUNC (handle_box_child_signal),
+ "attached");
+ gtk_signal_connect (GTK_OBJECT (hbox),
+ "child_detached",
+ GTK_SIGNAL_FUNC (handle_box_child_signal),
+ "detached");
gtk_widget_show (hbox);
toolbar = make_toolbar (window);
@@ -1056,7 +1075,7 @@ create_reparent ()
gtk_box_pack_start (GTK_BOX (box3), label, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (label),
- "set_parent",
+ "parent_set",
GTK_SIGNAL_FUNC (set_parent_signal),
(GtkObject*) 42);
gtk_widget_show (label);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 868f0b0812..fb1bc91ae1 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -939,6 +939,17 @@ create_statusbar ()
}
static void
+handle_box_child_signal (GtkHandleBox *hb,
+ GtkWidget *child,
+ const gchar *action)
+{
+ printf ("%s: child <%s> %sed\n",
+ gtk_type_name (GTK_OBJECT_TYPE (hb)),
+ gtk_type_name (GTK_OBJECT_TYPE (child)),
+ action);
+}
+
+static void
create_handle_box ()
{
static GtkWidget* window = NULL;
@@ -960,6 +971,14 @@ create_handle_box ()
hbox = gtk_handle_box_new ();
gtk_container_add (GTK_CONTAINER (window), hbox);
+ gtk_signal_connect (GTK_OBJECT (hbox),
+ "child_attached",
+ GTK_SIGNAL_FUNC (handle_box_child_signal),
+ "attached");
+ gtk_signal_connect (GTK_OBJECT (hbox),
+ "child_detached",
+ GTK_SIGNAL_FUNC (handle_box_child_signal),
+ "detached");
gtk_widget_show (hbox);
toolbar = make_toolbar (window);
@@ -1056,7 +1075,7 @@ create_reparent ()
gtk_box_pack_start (GTK_BOX (box3), label, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (label),
- "set_parent",
+ "parent_set",
GTK_SIGNAL_FUNC (set_parent_signal),
(GtkObject*) 42);
gtk_widget_show (label);