Commit 6e7f4a99 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Arturo Espinosa

Moved the gtk_signal_connect of the specified callback into the big

1998-03-14  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
	gtk_signal_connect of the specified callback into the big switch()
	for buttons.  We don't want to connect to the "clicked" signal of
	a custom widget or a space element, because it may not have one.
	(gtk_toolbar_insert_element): Extra sanity check; if the type is
	GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
parent cfd3a513
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
1998-03-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtktoolbar.c (gtk_toolbar_insert_element): Moved the
gtk_signal_connect of the specified callback into the big switch()
for buttons. We don't want to connect to the "clicked" signal of
a custom widget or a space element, because it may not have one.
(gtk_toolbar_insert_element): Extra sanity check; if the type is
GTK_TOOLBAR_CHILD_WIDGET, then the specified widget must not be NULL.
Sat Mar 14 02:54:28 PST 1998 Manish Singh <yosh@gimp.org>
* gtk.m4: fixed a bashism in gtk tests
......
......@@ -455,6 +455,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
alloc.width = toolbar->button_maxw;
alloc.height = toolbar->button_maxh;
......@@ -475,6 +476,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
case GTK_TOOLBAR_CHILD_WIDGET:
if (!GTK_WIDGET_VISIBLE (child->widget))
break;
alloc.width = child->widget->requisition.width;
alloc.height = child->widget->requisition.height;
......@@ -691,7 +693,8 @@ gtk_toolbar_insert_widget (GtkToolbar *toolbar,
position);
}
GtkWidget *gtk_toolbar_append_element (GtkToolbar *toolbar,
GtkWidget *
gtk_toolbar_append_element (GtkToolbar *toolbar,
GtkToolbarChildType type,
GtkWidget *widget,
const char *text,
......@@ -701,13 +704,14 @@ GtkWidget *gtk_toolbar_append_element (GtkToolbar *toolbar,
GtkSignalFunc callback,
gpointer user_data)
{
return gtk_toolbar_insert_element(toolbar, type, widget, text,
return gtk_toolbar_insert_element (toolbar, type, widget, text,
tooltip_text, tooltip_private_text,
icon, callback, user_data,
toolbar->num_children);
}
GtkWidget *gtk_toolbar_prepend_element (GtkToolbar *toolbar,
GtkWidget *
gtk_toolbar_prepend_element (GtkToolbar *toolbar,
GtkToolbarChildType type,
GtkWidget *widget,
const char *text,
......@@ -717,12 +721,13 @@ GtkWidget *gtk_toolbar_prepend_element (GtkToolbar *toolbar,
GtkSignalFunc callback,
gpointer user_data)
{
return gtk_toolbar_insert_element(toolbar, type, widget, text,
return gtk_toolbar_insert_element (toolbar, type, widget, text,
tooltip_text, tooltip_private_text,
icon, callback, user_data, 0);
}
GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
GtkWidget *
gtk_toolbar_insert_element (GtkToolbar *toolbar,
GtkToolbarChildType type,
GtkWidget *widget,
const char *text,
......@@ -738,50 +743,60 @@ GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
g_return_val_if_fail (toolbar != NULL, NULL);
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
g_return_val_if_fail ((type != GTK_TOOLBAR_CHILD_WIDGET) || (widget != NULL), NULL);
child = g_new (GtkToolbarChild, 1);
child->type = type;
child->icon = NULL;
child->label = NULL;
switch (type) {
switch (type)
{
case GTK_TOOLBAR_CHILD_SPACE:
child->widget = NULL;
break;
case GTK_TOOLBAR_CHILD_WIDGET:
child->widget = widget;
break;
case GTK_TOOLBAR_CHILD_BUTTON:
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
if (type == GTK_TOOLBAR_CHILD_BUTTON) {
if (type == GTK_TOOLBAR_CHILD_BUTTON)
child->widget = gtk_button_new ();
} else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) {
else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
{
child->widget = gtk_toggle_button_new ();
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(child->widget),
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget),
FALSE);
} else {
child->widget =
gtk_radio_button_new(
widget
? gtk_radio_button_group(GTK_RADIO_BUTTON(widget))
}
else
{
child->widget = gtk_radio_button_new (widget
? gtk_radio_button_group (GTK_RADIO_BUTTON (widget))
: NULL);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(child->widget),
FALSE);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE);
}
if (callback)
gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
callback, user_data);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (child->widget), vbox);
gtk_widget_show (vbox);
if (icon) {
if (icon)
{
child->icon = GTK_WIDGET (icon);
gtk_box_pack_start (GTK_BOX (vbox), child->icon, FALSE, FALSE, 0);
if (toolbar->style != GTK_TOOLBAR_TEXT)
gtk_widget_show (child->icon);
}
if (text) {
if (text)
{
child->label = gtk_label_new (text);
gtk_box_pack_start (GTK_BOX (vbox), child->label, FALSE, FALSE, 0);
if (toolbar->style != GTK_TOOLBAR_ICONS)
......@@ -790,15 +805,12 @@ GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
gtk_widget_show (child->widget);
break;
default:
g_assert_not_reached ();
}
if (callback)
gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
callback, user_data);
if (tooltip_text)
if ((type != GTK_TOOLBAR_CHILD_SPACE) && tooltip_text)
gtk_tooltips_set_tip (toolbar->tooltips, child->widget,
tooltip_text, tooltip_private_text);
......@@ -808,7 +820,7 @@ GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
if (type != GTK_TOOLBAR_CHILD_SPACE)
gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar));
if (type != GTK_TOOLBAR_CHILD_SPACE && GTK_WIDGET_VISIBLE (toolbar))
if ((type != GTK_TOOLBAR_CHILD_SPACE) && GTK_WIDGET_VISIBLE (toolbar))
{
if (GTK_WIDGET_REALIZED (toolbar)
&& !GTK_WIDGET_REALIZED (child->widget))
......@@ -820,7 +832,7 @@ GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
}
if (GTK_WIDGET_VISIBLE (toolbar) &&
(type == GTK_TOOLBAR_CHILD_SPACE ||
((type == GTK_TOOLBAR_CHILD_SPACE) ||
GTK_WIDGET_VISIBLE (child->widget)))
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment