GNOME Bugzilla – Bug 693291
Kill application.py, port to GTK Application
Last modified: 2014-04-02 16:52:41 UTC
I've been pondering for a while killing Pitivi's menu bar and using Gtk's appmenu. This would allow better integrating with GNOME Shell and other platforms, eliminate redundancy and save screen space (because the application could now be undecorated when maximized, as first suggested in bug #679471). Most of our menu items are either duplicates of what we have in toolbars, or could be moved to a GtkApplication menu. Some items would probably need to be moved elsewhere in the UI: - “Revert to saved” could become a full-fledged main toolbar button. - "Export as archive" → “Gear” menu - Detach/Attach viewer → Make it a button in the viewer’s toolbar - Save snapshot of the current image → “Gear” menu - Keyframe actions: they should be contextual anyway. Either in the effect properties UI, or appearing temporarily in the timeline toolbar (to avoid visual clutter). Will depend on someone actually implementing the keyframe UI. - "Remove layer": kill the menu item, leave the contextual menu, and replace the main interaction by “drag the layer out of the screen or into the media library”? That one is going to depend on our port to a clutter timeline/some other expert than me. I'm left wondering about the relevance of a "gear" menu (à la Chromium/Epiphany/Nautilus), given that GTK's toolbars will automatically create a "dropdown" arrow if it can't fit all items on the screen...
Created attachment 236959 [details] screenshots of the current menu items For reference, here's what menus currently look like.
Additional reference: https://developer.gnome.org/gtk3/stable/GtkApplication.html for AppMenu stuff https://developer.gnome.org/gtk3/stable/GtkMenuButton.html for a "gear" button https://developer.gnome.org/gtk3/stable/GtkWindow.html for the "set_hide_titlebar_when_maximized" method that should be used when the system actually supports/uses the appmenu. Sample Python app using Gtk App menus (I no idea why it uses Gio, especially since the original "bloatpad" does not use that): https://github.com/MicahCarrick/python-bloatpad (from http://www.micahcarrick.com/gtk-bloatpad-in-python.html ) The appmenu must be visible to AT-SPI (and thus Dogtail); one can verify using tools such as "sniff" or "accerciser" (but for some reason they don't seem to work properly on Fedora 18 at the moment).
To use the AppMenu and have the menu in gnome-shell's top bar. You need to use GtkApplication. GtkApplication communicates with gnome-shell through dbus and this would be complicated and not worth it to try to replicate. GtkApplication is a GObject class meant to be subclassed at the top/main block of the application. In the case of PiTiVi this means major surgery. Since doing this would make GtkApplication control the main loop that is running. One of the biggest conflicts is that GtkApplication has it's own "instance" elemenent, which clashes with PiTiVi.instance. PiTiVi.instance hold all the objects that PiTiVi needs to share globally. So stripping this out is out of the question and it needs to be suplanted carefully. So using GtkApplication in PiTiVi is major surgery. Moving all the global objects and how these are accessed in all of PiTiVi's code. The code size of PiTiVi would be reduced and greatly simplified though.
As far as I can tell, the use of GTK HeaderBar, GTK MenuButton and https://developer.gnome.org/gtk3/3.10/GtkWindow.html#gtk-window-set-titlebar does not require the use of GtkApplication, so there is no urgent need to nuke application.py. As such, retitling for clarity and removing the blocker dependency. Porting to GtkApplication could still be desireable as a code refactoring initiative.
commit f7e23b0955525a72e9e923940d8a766aa690d87d Author: Alexandru Băluț <alexandru.balut@gmail.com> Date: Sun Mar 16 23:43:02 2014 +0100 Make Pitivi a GtkApplication Fixes https://bugzilla.gnome.org/show_bug.cgi?id=693291