GNOME Bugzilla – Bug 722588
GtkStack: add gtk_stack_get_child_by_name()
Last modified: 2014-01-21 08:34:59 UTC
In gedit, in the context of upgrading the UI to match the GNOME 3 style, we are looking at replacing our GtkNotebook usage in the side and bottom panels with GtkStacks. But in those panels the pages are added and removed dynamically. The currently visible panel is stored in GSettings. In some case it is possible that no panel has a name equal to the value in GSettings (plugin removed, etc). In this case we'd like to be able to check if the stack has a child with the name before acting on it. This current method, gtk_stack_get_child_by_name(), will do just that, in a generic fashion.
Created attachment 266705 [details] [review] GtkStack: add gtk_stack_get_child_by_name() This new method allows getting a widget from a GtkStack when we know its name, and will also return NULL if there is no widget going by that name. Usage example would be to check if a child with a given name exists before calling gtk_stack_set_visible_child_name().
Review of attachment 266705 [details] [review]: looks good to me
Created attachment 266713 [details] [review] GtkStack: add gtk_stack_get_child_by_name() This new method allows getting a widget from a GtkStack when we know its name, and will also return NULL if there is no widget going by that name. Usage example would be to check if a child with a given name exists before calling gtk_stack_set_visible_child_name().
Created attachment 266717 [details] [review] GtkContainer: add gtk_container_get_n_children() This is a generalization over gtk_notebook_get_n_pages(), to get the amount of non-internal children for any container.