After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694325 - Use GtkStack instead of notebooks
Use GtkStack instead of notebooks
Status: RESOLVED OBSOLETE
Product: gnome-control-center
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-21 00:08 UTC by William Jon McCann
Modified: 2021-06-09 16:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
shell: Use GdStack for switching panels (9.10 KB, patch)
2013-02-21 14:11 UTC, Bastien Nocera
committed Details | Review
cc-editable-entry: use GtkStack instead of GtkNotebook (5.61 KB, patch)
2014-06-05 14:06 UTC, Ondrej Holy
needs-work Details | Review
cc-editable-entry: use GtkStack instead of GtkNotebook (6.67 KB, patch)
2014-06-12 13:19 UTC, Ondrej Holy
reviewed Details | Review
um-editable-combo: use GtkStack instead of GtkNotebook (9.36 KB, patch)
2014-06-12 13:22 UTC, Ondrej Holy
reviewed Details | Review
cc-editable-entry: use GtkStack instead of GtkNotebook (6.93 KB, patch)
2014-06-23 15:54 UTC, Ondrej Holy
committed Details | Review
um-editable-combo: use GtkStack instead of GtkNotebook (10.09 KB, patch)
2014-06-23 15:56 UTC, Ondrej Holy
committed Details | Review
cc-editable-button: use GtkStack instead of GtkNotebook (3.59 KB, patch)
2014-08-14 11:50 UTC, Ondrej Holy
committed Details | Review

Description William Jon McCann 2013-02-21 00:08:35 UTC
So we can do nice resizes and stuff.
Comment 1 Bastien Nocera 2013-02-21 14:11:59 UTC
Created attachment 237040 [details] [review]
shell: Use GdStack for switching panels
Comment 2 Alexander Larsson 2013-02-21 18:46:09 UTC
This was a bug in gd-header-bar, fixed in libgd master.
Comment 3 Bastien Nocera 2013-02-22 07:28:59 UTC
Pushed to gnome-3-8 and master

Attachment 237040 [details] pushed as 575bd62 - shell: Use GdStack for switching panels
Comment 4 Bastien Nocera 2013-02-22 07:58:50 UTC
Reopening, there's other places where we should be using GdStack.
Comment 5 Matthias Clasen 2013-04-24 00:46:05 UTC
in 3.10, you should even be using GtkStack
Comment 6 Bastien Nocera 2013-04-24 09:14:52 UTC
(In reply to comment #5)
> in 3.10, you should even be using GtkStack

We are now. I've retitled the bug to match the new purpose of the bug. We would need clearer guidelines as to what parts of the UI should have a transition when switching content.
Comment 7 Ondrej Holy 2014-06-05 14:06:32 UTC
Created attachment 277955 [details] [review]
cc-editable-entry: use GtkStack instead of GtkNotebook

It also fixes following warnings:

(gnome-control-center:32638): Gtk-WARNING **: GtkEntry 0x28bcef0 is mapped but not child_visible
(gnome-control-center:32638): Gtk-WARNING **: GtkEntry 0x28bcef0 is mapped but visible=1 child_visible=0 parent GtkNotebook 0x2b86600 mapped=1
Comment 8 Bastien Nocera 2014-06-06 10:26:59 UTC
Review of attachment 277955 [details] [review]:

::: shell/cc-editable-entry.c
@@ +610,3 @@
         /* Entry */
         priv->entry = (GtkEntry*)gtk_entry_new ();
+        gtk_container_add (GTK_CONTAINER (priv->stack), GTK_WIDGET (priv->entry));

I'd rather you used gtk_stack_add_named(), and used gtk_stack_set_visible_child_name() to switch between stack children.
Comment 9 Ondrej Holy 2014-06-12 13:19:16 UTC
Created attachment 278340 [details] [review]
cc-editable-entry: use GtkStack instead of GtkNotebook

Thanks for the review. Named children are used now. In additional the mechanism of setting label padding had to be changed, because noneditable widget has wrong padding (size-allocate signal was not called on button).
Comment 10 Ondrej Holy 2014-06-12 13:22:50 UTC
Created attachment 278341 [details] [review]
um-editable-combo: use GtkStack instead of GtkNotebook

Also similar patch for um-editable-combo:

The mechanism of setting label padding had to be changed consequently.
    
It fixes following warnings:
(gnome-control-center:32638): Gtk-WARNING **: GtkComboBox 0x28bcef0 is mapped but not child_visible
(gnome-control-center:32638): Gtk-WARNING **: GtkComboBoy 0x28bcef0 is mapped but visible=1 child_visible=0 parent GtkNotebook 0x2b86600 mapped=1
    
The ugly hack to catch when combo is losing focus had to be also removed and notify::popup-shown is used instead. It fixes when GtkComboBox is wrongly shown instead of GtkButton due to escape is pressed or active item is selected.
Comment 11 Bastien Nocera 2014-06-13 08:12:10 UTC
Review of attachment 278340 [details] [review]:

::: shell/cc-editable-entry.c
@@ +514,3 @@
         e->priv->in_stop_editing = TRUE;
+        gtk_stack_set_visible_child_name (e->priv->stack, PAGE_BUTTON);
+        gtk_widget_grab_focus (GTK_WIDGET (e->priv->button));

Is grabbing the focus necessary here?

@@ +525,3 @@
         gtk_entry_set_text (e->priv->entry, cc_editable_entry_get_text (e));
+        gtk_stack_set_visible_child_name (e->priv->stack, PAGE_BUTTON);
+        gtk_widget_grab_focus (GTK_WIDGET (e->priv->button));

Ditto.
Comment 12 Bastien Nocera 2014-06-13 08:16:07 UTC
Review of attachment 278341 [details] [review]:

Does using the keyboard to edit the drop-down still work?
With the GtkNotebook you can:
- tab to the button
- press the button using space
- press escape or arrows and enter to choose a new entry
- it turns back into a button after tabbing away

::: panels/user-accounts/um-editable-combo.c
@@ +307,3 @@
                                       gtk_combo_box_get_active (combo->priv->combo));
+        gtk_stack_set_visible_child_name (combo->priv->stack, PAGE_BUTTON);
+        gtk_widget_grab_focus (GTK_WIDGET (combo->priv->button));

Why do we need to grab the focus for the button again?

@@ +318,3 @@
                                   um_editable_combo_get_active (combo));
+        gtk_stack_set_visible_child_name (combo->priv->stack, PAGE_BUTTON);
+        gtk_widget_grab_focus (GTK_WIDGET (combo->priv->button));

Ditto.
Comment 13 Ondrej Holy 2014-06-23 11:28:51 UTC
(In reply to comment #11)
> Review of attachment 278340 [details] [review]:
> 
> ::: shell/cc-editable-entry.c
> @@ +514,3 @@
>          e->priv->in_stop_editing = TRUE;
> +        gtk_stack_set_visible_child_name (e->priv->stack, PAGE_BUTTON);
> +        gtk_widget_grab_focus (GTK_WIDGET (e->priv->button));
> 
> Is grabbing the focus necessary here?

Grabbing the focus is necessary to have same behavioral as before (as other widgets). The focus is lost when the GtkComboBox/GtkEntry is shown and escape/enter is pressed, but the GtkButton should have the focus instead. But I see the problem, with every gtk_combo_box_set_active_iter() etc. it grabs the focus which is wrong :-/ I can grab it only if gtk_widget_has_focus(), or do you have better idea how to fix it?

(In reply to comment #12)
> Review of attachment 278341 [details] [review]:
> 
> Does using the keyboard to edit the drop-down still work?
> With the GtkNotebook you can:
> - tab to the button
> - press the button using space
> - press escape or arrows and enter to choose a new entry
> - it turns back into a button after tabbing away

Yes, it works.
Comment 14 Bastien Nocera 2014-06-23 12:43:36 UTC
(In reply to comment #13)
> (In reply to comment #11)
> > Review of attachment 278340 [details] [review] [details]:
> > 
> > ::: shell/cc-editable-entry.c
> > @@ +514,3 @@
> >          e->priv->in_stop_editing = TRUE;
> > +        gtk_stack_set_visible_child_name (e->priv->stack, PAGE_BUTTON);
> > +        gtk_widget_grab_focus (GTK_WIDGET (e->priv->button));
> > 
> > Is grabbing the focus necessary here?
> 
> Grabbing the focus is necessary to have same behavioral as before (as other
> widgets). The focus is lost when the GtkComboBox/GtkEntry is shown and
> escape/enter is pressed, but the GtkButton should have the focus instead. But I
> see the problem, with every gtk_combo_box_set_active_iter() etc. it grabs the
> focus which is wrong :-/ I can grab it only if gtk_widget_has_focus(), or do
> you have better idea how to fix it?

Adding a gtk_widget_has_focus() is fine by me.

> (In reply to comment #12)
> > Review of attachment 278341 [details] [review] [details]:
> > 
> > Does using the keyboard to edit the drop-down still work?
> > With the GtkNotebook you can:
> > - tab to the button
> > - press the button using space
> > - press escape or arrows and enter to choose a new entry
> > - it turns back into a button after tabbing away
> 
> Yes, it works.

Great.
Comment 15 Ondrej Holy 2014-06-23 15:54:42 UTC
Created attachment 279050 [details] [review]
cc-editable-entry: use GtkStack instead of GtkNotebook

Check gtk_widget_has_focus() before grabbing it.
Comment 16 Ondrej Holy 2014-06-23 15:56:29 UTC
Created attachment 279052 [details] [review]
um-editable-combo: use GtkStack instead of GtkNotebook

Check focus before grabbing using new function...
Comment 17 Bastien Nocera 2014-06-23 15:57:09 UTC
Review of attachment 279050 [details] [review]:

Looks good.
Comment 18 Bastien Nocera 2014-06-23 15:59:01 UTC
Review of attachment 279052 [details] [review]:

Looks good otherwise.

::: panels/user-accounts/um-editable-combo.c
@@ +310,3 @@
+        widget = gtk_window_get_focus (window);
+        if (widget)
+        {

On the same line as the conditional.
Comment 19 Ondrej Holy 2014-06-23 16:24:57 UTC
Comment on attachment 279050 [details] [review]
cc-editable-entry: use GtkStack instead of GtkNotebook

commit 07f3416e043ffe49a6c74ff6619799d528bff8ae
Comment 20 Ondrej Holy 2014-06-23 16:25:31 UTC
Comment on attachment 279052 [details] [review]
um-editable-combo: use GtkStack instead of GtkNotebook

commit 58c1bbc2553b2998b6ac4eafe4e9f7bd2a699201
Comment 21 Ondrej Holy 2014-06-23 16:25:50 UTC
Thanks for the reviews :-)
Comment 22 Ondrej Holy 2014-08-14 11:50:28 UTC
Created attachment 283380 [details] [review]
cc-editable-button: use GtkStack instead of GtkNotebook
Comment 23 Bastien Nocera 2014-08-15 13:01:35 UTC
Review of attachment 283380 [details] [review]:

Looks good.
Comment 24 Ondrej Holy 2014-08-15 15:14:06 UTC
Comment on attachment 283380 [details] [review]
cc-editable-button: use GtkStack instead of GtkNotebook

Thanks for the review :-)

commit ed4653627bcd065ea0bcdd559fe7e7b057e6e935
Comment 25 André Klapper 2021-06-09 16:06:18 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new bug report at
  https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/

Thank you for your understanding and your help.