-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headerbar support via plugin (discussion in #276) #614
Conversation
The `gtk-apply` icon name is a legacy Gtk stock icon name and should be replaced.
…lbacks A single GAction that take a GVariant parameter replaces the multiple GtkRadioAction. It looks like radio menu items are created only with a parameter of type string.
Add the toolbar in its own ui file.
Adds functions in ui_common to enable or add to a map all actions of a group. Modifies functions that enable/disable actions.
Modifies plugin-installer to use builder.
instead of creating a GtkMenuBar widget. This way accelerators at least work.
It doesn't work with GAction.
With the accelerators set in the menu, it was possible to change them by calling `gtk_application_set_accels_for_action` but if an accelerator was already defined for an action the old one stayed displayed in the menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this plugin needs to be deactivated with the "no plugin" option from the command line. You can merge #608 now (there may be bugs and custom accelerators don't work but it's not broken) if you want to add a few actions, and people could test both together.
plugins/headerbar.plugin
Outdated
Name=Header Bar | ||
Version=0.1 | ||
Description=Get a GNOME style header bar for Liferea | ||
Authors=Mozbugbox <mozbugbox@yahoo.com.au> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mozbugbox ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy&Paste :-)
plugins/headerbar.py
Outdated
ui_manager.get_widget("/MainwindowMenubar/").set_visible(True) | ||
self.hb = None | ||
|
||
def _on_back(self, button): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be necessary. Buttons are GtkActionables and can be directly associated with an action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now.
plugins/headerbar.py
Outdated
|
||
self.shell.lookup("mainwindow").set_titlebar(self.hb) | ||
|
||
ui_manager = self.shell.get_property("ui-manager") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the property name to "builder" in #608. (And maybe it doesn't need to be a property, as liferea_shell_lookup
could be used).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about not using ui_manager. Will rebase it once #608 is merged.
liferea_shell_lookup() cannot be used though (with GtkUIManager at least) as the widget names are not exposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also resolved.
plugins/headerbar.py
Outdated
ui_manager = self.shell.get_property("ui-manager") | ||
ui_manager.get_widget("/maintoolbar/").set_visible(True) | ||
ui_manager.get_widget("/MainwindowMenubar/").set_visible(True) | ||
self.hb = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The window likely takes ownership of the bar, so this won't remove it. Setting the window's titlebar to None should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it works. Setting to None might be problematic when reactivating.
Does the titlebar stay visible for you? If yes, which WM do you use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the GtkHeaderBar stays. I use XMonad, but the same thing happens in a Debian 8 VM with Gnome.
Why would it be problematic ? A new GtkHeaderBar is created and set as titlebar in do_activate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I changed the deactivate() behaviour to
self.shell.lookup("mainwindow").set_titlebar(None)
Update Turkish translation
I previously used the same user_data parameter as the gtk_action_group_add_actions calls but no callback actually uses that parameter.
Style suggested on the Gnome wiki : https://wiki.gnome.org/HowDoI/GAction
- fix the translation of the word “support”, thanks to external review - wrap to 80 characters
Update french translation
Modifies the ui_popup_item_menu function to build the menu with actions, and to apply to the clicked item. Changes the button press event handler to not change selection on right click. The item passed to `ui_popup_item_menu` will be destroyed after the function returns, it can't be directly passed to callbacks. Some actions use only a link and are identical to actions in the web view context menu. Those actions take the link as parameter and are added to the application to be accessible to both menus, this also makes them directly usable by plugins : - open-link-in-tab - open-link-browser - open-link-in-external-browser - social-bookmark-link - copy-link-to-clipboard Some actions require the item. In that case the actions take the item->id as a parameter. Those actions are added directly to the popup menu. The same callbacks are used for those actions and the actions that use the selected item. - copy-item-to-newsbin - toggle-item-flag - toggle-item-status - remove-item
Creates GActions that act on the node passed as a user-data parameter instead of the selected node. Uses the "new-" actions from the app, as making them insert new node relative to a passed node instead of the selected one would require more changes.
Switch to GAction and GtkBuilder
…into headerbar-plugin
So far I'd say the plugin is somewhat complete. |
Yes, looks good. 👍 |
No description provided.