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 578095 - gtk_widget_show() overrides visible property of GtkAction
gtk_widget_show() overrides visible property of GtkAction
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.16.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-04-06 03:57 UTC by Robert Ancell
Modified: 2009-09-03 11:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert Ancell 2009-04-06 03:57:46 UTC
gtk_widget_show() shows a widget even if it is connected to an action with the invisible property set to FALSE.

To reproduce:
1. Create an action
2. Create a widget from that action (e.g. toolbar item)
3. Set the visible property on the action to FALSE
4. Show the new widget

Outcome:
The widget is shown even though the action has been marked as not visible.

Expected outcome:
The widget would remain invisible even though gtk_widget_show() was called.

Rationale:
gtk_widget_show_all() is commonly used to display a window once it has been assembled.  If widgets do not honour their action's visibility then widgets can become inconsistent.

This expected outcome occurred in GTK+ 2.14.x
Comment 1 Robert Ancell 2009-04-06 04:02:47 UTC
Example prog:

import gtk
w = gtk.Window()
tb = gtk.Toolbar()
a = gtk.Action("hidden_action", "Hello World", "hello_tooltip", "")
tb.add(a.create_tool_item())
w.add(tb)
a.set_visible(False)  # Appears to have no effect
w.show_all()          # Window appears with the "Hello World" button visible
#a.set_visible(False) # Setting to invisible here works
gtk.main()
Comment 2 Zac Luzader 2009-04-14 14:27:59 UTC
This bug is not restricted to linux, I am getting this with GTK 2.16.0 on win32. I was not getting it with any prior version (2.14.* or 2.12.*). It causes my 'leave fullscreen' toolbar button to be shown even though the program does not start fullscreen. I will have to use a separate action group as a workaround.
Comment 3 Christian Dywan 2009-09-03 11:44:15 UTC
This is not a bug. You need to be careful when using gtk_widget_show_all. Regardless of how your widget tree is created, be it UI manager, GTK builder, glade or something else. Either you change the way you are creating your widgets or use gtk_widget_set_no_show_all.