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 673177 - Shows separators in app menu that it should hide
Shows separators in app menu that it should hide
Status: RESOLVED WONTFIX
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 673098
 
 
Reported: 2012-03-30 13:53 UTC by Bastien Nocera
Modified: 2012-06-01 12:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popupMenu: Don't add separators for empty sections (1.01 KB, patch)
2012-03-30 14:02 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
test-gapplication: Untabify, add modeline (1.38 KB, patch)
2012-03-30 14:46 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
test-gapplication: Fix the test (1.03 KB, patch)
2012-03-30 14:46 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
test-gapplication: Add new empty-section test (2.92 KB, patch)
2012-03-30 15:55 UTC, Bastien Nocera
none Details | Review
popupMenu: Rework _updateSeparatorVisibility (4.12 KB, patch)
2012-03-30 17:05 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
popupMenu: Expand sections before testing for consecutive separators (1.79 KB, patch)
2012-03-30 17:05 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
gactionmuxer: Fix list_actions (1.07 KB, patch)
2012-03-30 17:05 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
Make it possible for plugins to add themselves to the app menu (9.36 KB, patch)
2012-04-03 14:51 UTC, Bastien Nocera
none Details | Review

Description Bastien Nocera 2012-03-30 13:53:41 UTC
gnome-shell-3.4.0-1.fc17.x86_64

<menu id="appmenu">
        <section>
                <item>
                        <attribute name="label" translatable="yes">_Open</attribute>
                        <attribute name="action">app.open</attribute>
                        <attribute name="accel">&lt;Ctrl&gt;o</attribute>
                </item>
                <item>
                        <attribute name="label" translatable="yes">Open _Location</attribute>
                        <attribute name="action">app.open-location</attribute>
                        <attribute name="accel">&lt;Ctrl&gt;l</attribute>
                </item>
                <section id="save-placeholder"/>
        </section>
</menu>

$ gdbus call --session --dest org.gnome.Totem --object-path /org/gnome/Totem/menus/appmenu --method org.gtk.Menus.Start "[0]"
([(uint32 0, uint32 0, [{':section': <(uint32 0, uint32 1)>}]), (0, 1, [{'action': <'app.open'>, 'label': <'_Open'>, 'accel': <'<Ctrl>o'>}, {'action': <'app.open-location'>, 'label': <'Open _Location'>, 'accel': <'<Ctrl>l'>}, {':section': <(uint32 0, uint32 2)>}])],)

With this menu I get:
Open
Open Location
[separator]
[separator]

After telling GTK+ to show the menu:
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/ShellShowsAppMenu':<0>}"

The menu shows no separators in Totem itself.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-03-30 14:02:54 UTC
Created attachment 210957 [details] [review]
popupMenu: Don't add separators for empty sections

Make sure that a section has more than one item before adding a
separator for it.
Comment 2 Giovanni Campagna 2012-03-30 14:16:29 UTC
Review of attachment 210957 [details] [review]:

The fix makes sense, but then why doesn't src/test-gapplication.js (which has an explicit test for both empty submenus and empty sections) fail?
Comment 3 Bastien Nocera 2012-03-30 14:26:25 UTC
(In reply to comment #2)
> Review of attachment 210957 [details] [review]:
> 
> The fix makes sense, but then why doesn't src/test-gapplication.js (which has
> an explicit test for both empty submenus and empty sections) fail?

I can't make the test app run at all[1], but notice how the 2nd section is a level deeper than the top-level in the definition (that's because only top-level sections should have separators, I've been told).

The patch works for me.

[1]: Spits out, in a tight loop:
GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion `G_IS_DBUS_CONNECTION (connection)' failed
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-03-30 14:46:14 UTC
Created attachment 210964 [details] [review]
test-gapplication: Untabify, add modeline
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-03-30 14:46:17 UTC
Created attachment 210965 [details] [review]
test-gapplication: Fix the test

set_app_menu() requires that we have a bus, which means that we need to
do this in startup.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-03-30 15:44:03 UTC
(In reply to comment #2)
> Review of attachment 210957 [details] [review]:
> 
> The fix makes sense, but then why doesn't src/test-gapplication.js (which has
> an explicit test for both empty submenus and empty sections) fail?

Because of _updateSeparatorVisibility. I have a feeling for what would cause this bug to happen, but I'm going to need a reproducible testcase.
Comment 7 Bastien Nocera 2012-03-30 15:55:41 UTC
Created attachment 210980 [details] [review]
test-gapplication: Add new empty-section test
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-03-30 17:05:33 UTC
Created attachment 210983 [details] [review]
popupMenu: Rework _updateSeparatorVisibility

Instead of calculating separator visiblity for each separator on a signal,
do it once when we open the menu.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-03-30 17:05:36 UTC
Created attachment 210984 [details] [review]
popupMenu: Expand sections before testing for consecutive separators

If we have a model like:

   Separator
   Section
     Separator
   Separator

Then we won't detect two consecutive separators, and thus we won't hide any
of them. Fix this by expanding sections before testing separator consecutivity.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-03-30 17:05:40 UTC
Created attachment 210985 [details] [review]
gactionmuxer: Fix list_actions

The code there before was just completely wrong
Comment 11 Bastien Nocera 2012-03-31 11:37:51 UTC
Seems that the new code is just a little wrong ;)

gactionmuxer.c: In function 'g_action_muxer_list_actions':
gactionmuxer.c:106:3: warning: passing argument 2 of 'g_hash_table_iter_next' from incompatible pointer type [enabled by default]
In file included from /home/hadess/Projects/gnome-install/include/glib-2.0/glib.h:52:0,
                 from /home/hadess/Projects/gnome-install/include/glib-2.0/gobject/gbinding.h:30,
                 from /home/hadess/Projects/gnome-install/include/glib-2.0/glib-object.h:25,
                 from /home/hadess/Projects/gnome-install/include/glib-2.0/gio/gioenums.h:30,
                 from /home/hadess/Projects/gnome-install/include/glib-2.0/gio/giotypes.h:30,
                 from /home/hadess/Projects/gnome-install/include/glib-2.0/gio/gio.h:28,
                 from gactionmuxer.h:25,
                 from gactionmuxer.c:24:
/home/hadess/Projects/gnome-install/include/glib-2.0/glib/ghash.h:105:13: note: expected 'void **' but argument is of type 'gchar **'
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-03-31 12:28:18 UTC
(In reply to comment #11)
> Seems that the new code is just a little wrong ;)
> 
> gactionmuxer.c: In function 'g_action_muxer_list_actions':
> gactionmuxer.c:106:3: warning: passing argument 2 of 'g_hash_table_iter_next'
> from incompatible pointer type [enabled by default]
> In file included from
> /home/hadess/Projects/gnome-install/include/glib-2.0/glib.h:52:0,
>                  from
> /home/hadess/Projects/gnome-install/include/glib-2.0/gobject/gbinding.h:30,
>                  from
> /home/hadess/Projects/gnome-install/include/glib-2.0/glib-object.h:25,
>                  from
> /home/hadess/Projects/gnome-install/include/glib-2.0/gio/gioenums.h:30,
>                  from
> /home/hadess/Projects/gnome-install/include/glib-2.0/gio/giotypes.h:30,
>                  from
> /home/hadess/Projects/gnome-install/include/glib-2.0/gio/gio.h:28,
>                  from gactionmuxer.h:25,
>                  from gactionmuxer.c:24:
> /home/hadess/Projects/gnome-install/include/glib-2.0/glib/ghash.h:105:13: note:
> expected 'void **' but argument is of type 'gchar **'

Yeah, I fixed that locally. Just change the (gchar **) cast to (void **).
Comment 13 Bastien Nocera 2012-04-03 14:51:22 UTC
Created attachment 211230 [details] [review]
Make it possible for plugins to add themselves to the app menu
Comment 14 Bastien Nocera 2012-04-03 15:32:15 UTC
Comment on attachment 211230 [details] [review]
Make it possible for plugins to add themselves to the app menu

Wrong bug, sorry.
Comment 15 Jasper St. Pierre (not reading bugmail) 2012-04-24 18:31:28 UTC
Review of attachment 210957 [details] [review]:

No.
Comment 16 Jasper St. Pierre (not reading bugmail) 2012-04-24 18:31:41 UTC
Review of attachment 210983 [details] [review]:

No.
Comment 17 Jasper St. Pierre (not reading bugmail) 2012-04-24 18:31:46 UTC
Review of attachment 210984 [details] [review]:

No.
Comment 18 Jasper St. Pierre (not reading bugmail) 2012-04-24 18:32:53 UTC
I think we decided that the model in this bug is completely broken and has undefined behaviour, so we're not going to land the patches.

The gactionmuxer and test-gapplication.js fixed should still land, though.
Comment 19 Matthias Clasen 2012-04-25 01:21:16 UTC
Review of attachment 210985 [details] [review]:

This is the same fix that was applied to the gtk copy of gactionmuxer.c.
Makes sense to keep the copies in sync.
Comment 20 Jasper St. Pierre (not reading bugmail) 2012-05-02 20:26:21 UTC
Comment on attachment 210985 [details] [review]
gactionmuxer: Fix list_actions

Attachment 210985 [details] pushed as a36de92 - gactionmuxer: Fix list_actions
Comment 21 Giovanni Campagna 2012-05-02 21:32:05 UTC
Review of attachment 210964 [details] [review]:

Definitely
Comment 22 Giovanni Campagna 2012-05-02 21:33:03 UTC
Review of attachment 210965 [details] [review]:

And this one too.
(to be honest, I had it locally, and just didn't push because I thought nobody used test-gapplication...)