Skip to content
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

Merged
merged 46 commits into from
Apr 11, 2018
Merged

Conversation

lwindolf
Copy link
Owner

@lwindolf lwindolf commented Mar 7, 2018

No description provided.

Lars Windolf and others added 20 commits January 29, 2018 22:45
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.
@lwindolf lwindolf added this to the 1.12.3 milestone Mar 7, 2018
@lwindolf lwindolf self-assigned this Mar 7, 2018
@lwindolf lwindolf requested a review from Leiaz March 7, 2018 20:11
Copy link
Collaborator

@Leiaz Leiaz left a 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.

Name=Header Bar
Version=0.1
Description=Get a GNOME style header bar for Liferea
Authors=Mozbugbox <mozbugbox@yahoo.com.au>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mozbugbox ? :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy&Paste :-)

ui_manager.get_widget("/MainwindowMenubar/").set_visible(True)
self.hb = None

def _on_back(self, button):
Copy link
Collaborator

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now.


self.shell.lookup("mainwindow").set_titlebar(self.hb)

ui_manager = self.shell.get_property("ui-manager")
Copy link
Collaborator

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).

Copy link
Owner Author

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also resolved.

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
Copy link
Collaborator

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.

Copy link
Owner Author

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?

Copy link
Collaborator

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.

Copy link
Owner Author

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)

lwindolf and others added 23 commits March 12, 2018 21:34
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.
- 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.
@lwindolf
Copy link
Owner Author

So far I'd say the plugin is somewhat complete.

@Leiaz
Copy link
Collaborator

Leiaz commented Apr 11, 2018

Yes, looks good. 👍

@lwindolf lwindolf merged commit 50078e8 into master Apr 11, 2018
@lwindolf lwindolf deleted the headerbar-plugin branch August 17, 2018 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants