mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
fix finding of child's page, since we have to validly deal with labels and
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org> * gtk/gtknotebook.c (gtk_notebook_get_child_property): (gtk_notebook_set_child_property): fix finding of child's page, since we have to validly deal with labels and menus here as well. (gtk_notebook_get_child_property): fix warning. (gtk_notebook_class_init): property tab_pack is of type GTK_TYPE_PACK_TYPE (enum) not boolean. (gtk_notebook_find_child): don't always warn, we might be looking for a label or menu child. (gtk_notebook_map): fix mapping of panel. * gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain widget's mapped state, regardless of the value being set equals old settings, since things like REALIZED(parent) or MAPPED(parent) may have changed since the old value was set. make it an error to invoke this function on a toplevel widget.
This commit is contained in:
parent
6fe3d87b10
commit
8dfce4590b
19
ChangeLog
19
ChangeLog
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
Tue Jul 31 22:59:33 2001 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtknotebook.c (gtk_notebook_get_child_property):
|
||||
(gtk_notebook_set_child_property): fix finding of child's page,
|
||||
since we have to validly deal with labels and menus here as well.
|
||||
(gtk_notebook_get_child_property): fix warning.
|
||||
(gtk_notebook_class_init): property tab_pack is of type
|
||||
GTK_TYPE_PACK_TYPE (enum) not boolean.
|
||||
(gtk_notebook_find_child): don't always warn, we might be looking
|
||||
for a label or menu child.
|
||||
(gtk_notebook_map): fix mapping of panel.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_set_child_visible): always constrain
|
||||
widget's mapped state, regardless of the value being set equals
|
||||
old settings, since things like REALIZED(parent) or MAPPED(parent)
|
||||
may have changed since the old value was set. make it an error to
|
||||
invoke this function on a toplevel widget.
|
||||
|
||||
2001-07-31 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* gdk/gdkprivate.h:
|
||||
@ -19,6 +37,7 @@ Tue Jul 31 15:34:57 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
* tests/testgtk.c: gtk_accel_group_attach() takes a GObject.
|
||||
|
||||
Mon Jul 30 10:49:16 PDT 2001 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
|
||||
|
||||
* gtk/gtksignal.h (gtk_signal_handler_pending): corrected the wrong
|
||||
argument order for g_signal_has_handler_pending.
|
||||
|
||||
|
@ -103,11 +103,10 @@ struct _GtkNotebookPage
|
||||
|
||||
#ifdef G_DISABLE_CHECKS
|
||||
#define CHECK_FIND_CHILD(notebook, child) \
|
||||
gtk_notebook_find_child(notebook, child, \
|
||||
G_GNUC_PRETTY_FUNCTION)
|
||||
gtk_notebook_find_child (notebook, child, G_STRLOC)
|
||||
#else
|
||||
#define CHECK_FIND_CHILD(notebook, child) \
|
||||
gtk_notebook_find_child(notebook, child, NULL)
|
||||
gtk_notebook_find_child (notebook, child, NULL)
|
||||
#endif
|
||||
|
||||
/*** GtkNotebook Methods ***/
|
||||
@ -192,7 +191,7 @@ static void gtk_notebook_update_labels (GtkNotebook *notebook);
|
||||
static gint gtk_notebook_timer (GtkNotebook *notebook);
|
||||
static gint gtk_notebook_page_compare (gconstpointer a,
|
||||
gconstpointer b);
|
||||
static GList *gtk_notebook_find_child (GtkNotebook *notebook,
|
||||
static GList* gtk_notebook_find_child (GtkNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
const gchar *function);
|
||||
static gint gtk_notebook_real_page_position (GtkNotebook *notebook,
|
||||
@ -426,9 +425,9 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
G_PARAM_READWRITE));
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_TAB_PACK,
|
||||
g_param_spec_boolean ("tab_pack", NULL, NULL,
|
||||
TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_param_spec_enum ("tab_pack", NULL, NULL,
|
||||
GTK_TYPE_PACK_TYPE, GTK_PACK_START,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
notebook_signals[SWITCH_PAGE] =
|
||||
gtk_signal_new ("switch_page",
|
||||
@ -733,6 +732,9 @@ gtk_notebook_map (GtkWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
if (notebook->scrollable)
|
||||
gdk_window_show (notebook->panel);
|
||||
|
||||
gdk_window_show (widget->window);
|
||||
}
|
||||
|
||||
@ -1464,6 +1466,10 @@ gtk_notebook_set_child_property (GtkContainer *container,
|
||||
gboolean fill;
|
||||
GtkPackType pack_type;
|
||||
|
||||
/* not finding child's page is valid for menus or labels */
|
||||
if (!gtk_notebook_find_child (GTK_NOTEBOOK (container), child, NULL))
|
||||
return;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case CHILD_PROP_TAB_LABEL:
|
||||
@ -1525,10 +1531,12 @@ gtk_notebook_get_child_property (GtkContainer *container,
|
||||
|
||||
notebook = GTK_NOTEBOOK (container);
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
/* not finding child's page is valid for menus or labels */
|
||||
list = gtk_notebook_find_child (notebook, child, NULL);
|
||||
if (!list)
|
||||
{
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
||||
/* nothing to set on labels or menus */
|
||||
g_param_value_set_default (pspec, value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2028,18 +2036,18 @@ gtk_notebook_page_compare (gconstpointer a,
|
||||
return (((GtkNotebookPage *) a)->child != b);
|
||||
}
|
||||
|
||||
static GList *
|
||||
gtk_notebook_find_child (GtkNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
const gchar *function)
|
||||
static GList*
|
||||
gtk_notebook_find_child (GtkNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
const gchar *function)
|
||||
{
|
||||
GList *list = g_list_find_custom (notebook->children, child,
|
||||
gtk_notebook_page_compare);
|
||||
|
||||
#ifndef G_DISABLE_CHECKS
|
||||
if (!list)
|
||||
g_warning ("child argument to '%s' does not refer to the contents of a notebook page",
|
||||
function);
|
||||
if (!list && function)
|
||||
g_warning ("%s: unable to find child %p in notebook %p",
|
||||
function, child, notebook);
|
||||
#endif
|
||||
|
||||
return list;
|
||||
@ -3796,6 +3804,10 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook,
|
||||
gtk_notebook_menu_item_create (notebook,
|
||||
g_list_find (notebook->children, page));
|
||||
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (notebook));
|
||||
if (tab_label)
|
||||
gtk_widget_set_parent (tab_label, GTK_WIDGET (notebook));
|
||||
|
||||
gtk_notebook_update_labels (notebook);
|
||||
|
||||
if (!notebook->first_tab)
|
||||
@ -3814,10 +3826,6 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook,
|
||||
gtk_widget_hide (tab_label);
|
||||
}
|
||||
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (notebook));
|
||||
if (tab_label)
|
||||
gtk_widget_set_parent (tab_label, GTK_WIDGET (notebook));
|
||||
|
||||
if (!notebook->cur_page)
|
||||
{
|
||||
gtk_notebook_switch_page (notebook, page, 0);
|
||||
@ -4447,7 +4455,7 @@ gtk_notebook_get_tab_label (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
|
||||
g_return_val_if_fail (child != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
@ -4478,7 +4486,7 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
|
||||
g_return_if_fail (child != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
@ -4593,7 +4601,7 @@ gtk_notebook_get_menu_label (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
|
||||
g_return_val_if_fail (child != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
@ -4622,7 +4630,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
|
||||
g_return_if_fail (child != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
@ -4750,7 +4758,7 @@ gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
|
||||
g_return_if_fail (child != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
@ -4800,7 +4808,7 @@ gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
|
||||
g_return_if_fail (child != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = CHECK_FIND_CHILD (notebook, child);
|
||||
if (!list)
|
||||
|
@ -4182,34 +4182,21 @@ void
|
||||
gtk_widget_set_child_visible (GtkWidget *widget,
|
||||
gboolean is_visible)
|
||||
{
|
||||
gboolean was_visible;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget));
|
||||
|
||||
was_visible = GTK_WIDGET_CHILD_VISIBLE (widget);
|
||||
is_visible = is_visible != FALSE;
|
||||
|
||||
if (is_visible != was_visible)
|
||||
if (is_visible)
|
||||
GTK_PRIVATE_SET_FLAG (widget, GTK_CHILD_VISIBLE);
|
||||
else
|
||||
GTK_PRIVATE_UNSET_FLAG (widget, GTK_CHILD_VISIBLE);
|
||||
if (GTK_WIDGET_REALIZED (widget->parent))
|
||||
{
|
||||
if (is_visible)
|
||||
{
|
||||
GTK_PRIVATE_SET_FLAG (widget, GTK_CHILD_VISIBLE);
|
||||
|
||||
if (widget->parent &&
|
||||
GTK_WIDGET_VISIBLE (widget->parent) &&
|
||||
GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
if (GTK_WIDGET_MAPPED (widget->parent))
|
||||
gtk_widget_map (widget);
|
||||
}
|
||||
}
|
||||
if (GTK_WIDGET_MAPPED (widget->parent) &&
|
||||
GTK_WIDGET_CHILD_VISIBLE (widget) &&
|
||||
GTK_WIDGET_VISIBLE (widget))
|
||||
gtk_widget_map (widget);
|
||||
else
|
||||
{
|
||||
GTK_PRIVATE_UNSET_FLAG (widget, GTK_CHILD_VISIBLE);
|
||||
|
||||
if (GTK_WIDGET_MAPPED (widget))
|
||||
gtk_widget_unmap (widget);
|
||||
}
|
||||
gtk_widget_unmap (widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user