From f13f3bb8dd6f1083ac8b31717184b307810fb828 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 19 Oct 2018 11:53:37 -0400 Subject: [PATCH 1/7] headerbar.py: Use standard spacing for buttons Rather than setting the spacing for each individual button, Gtk.Box can be initialized with a uniform spacing between elements. The HIG recommends increments of 6px, with 6px being the generally used spacing between buttons. Fixes spacing issues between the right headerbar buttons and strange spacing between the settings button and the right edge of the headerbar. --- Authenticator/widgets/headerbar.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Authenticator/widgets/headerbar.py b/Authenticator/widgets/headerbar.py index f835ffb..215e1c0 100644 --- a/Authenticator/widgets/headerbar.py +++ b/Authenticator/widgets/headerbar.py @@ -126,7 +126,8 @@ class HeaderBar(Gtk.HeaderBar): self.set_show_close_button(True) left_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) - right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) + right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, + spacing=6) # Hide the search button if nothing is found if Database.get_default().count > 0: @@ -139,7 +140,7 @@ class HeaderBar(Gtk.HeaderBar): right_box.pack_start(self.search_btn, False, False, 0) right_box.pack_start(self.select_btn, False, False, 0) right_box.pack_start(self.cancel_btn, False, False, 0) - right_box.pack_end(self.settings_btn, False, False, 3) + right_box.pack_end(self.settings_btn, False, False, 0) self.pack_start(left_box) self.pack_end(right_box) From 6e55ad36aeb156fe4e17d7d681ea2a2c88288a6d Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 19 Oct 2018 12:04:32 -0400 Subject: [PATCH 2/7] application.py: Remove Quit action from menu According to https://developer.gnome.org/hig/3.30/primary-menus.html.en the primary menu should not contain the Quit action. This commit removes it from the Gio.Menu. --- Authenticator/application.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Authenticator/application.py b/Authenticator/application.py index fedcf24..0f96d34 100644 --- a/Authenticator/application.py +++ b/Authenticator/application.py @@ -115,7 +115,6 @@ class Application(Gtk.Application): main_content.append_item(Gio.MenuItem.new(_("Settings"), "app.settings")) main_content.append_item(Gio.MenuItem.new(_("About"), "app.about")) main_content.append_item(Gio.MenuItem.new(_("Keyboard Shortcuts"), "app.shortcuts")) - main_content.append_item(Gio.MenuItem.new(_("Quit"), "app.quit")) help_section = Gio.MenuItem.new_section(None, main_content) self._menu.append_item(help_section) From 5ff1f05a654b0f6d60d0be829216d36fdc809161 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 19 Oct 2018 12:07:21 -0400 Subject: [PATCH 3/7] application.py: Change Settings to Preferences According to the HIG Settings should be Preferences. For consistency with other applications this has been changed. --- Authenticator/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Authenticator/application.py b/Authenticator/application.py index 0f96d34..f961697 100644 --- a/Authenticator/application.py +++ b/Authenticator/application.py @@ -112,7 +112,7 @@ class Application(Gtk.Application): # Main section main_content = Gio.Menu.new() # Night mode action - main_content.append_item(Gio.MenuItem.new(_("Settings"), "app.settings")) + main_content.append_item(Gio.MenuItem.new(_("Preferences"), "app.settings")) main_content.append_item(Gio.MenuItem.new(_("About"), "app.about")) main_content.append_item(Gio.MenuItem.new(_("Keyboard Shortcuts"), "app.shortcuts")) help_section = Gio.MenuItem.new_section(None, main_content) From 9db31ffd164ce3f5f2d76be5b7a473c4fa07b6fc Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 19 Oct 2018 12:37:57 -0400 Subject: [PATCH 4/7] accounts/row.py: Normalize spacing between account row buttons Adjusts the spacing for the ActionsBox to 6px for constant spacing between action buttons. Removes the need for individual spacing. Also allows for constant distance from the row's top, right, and bottom edges for the Edit action. --- Authenticator/widgets/accounts/row.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Authenticator/widgets/accounts/row.py b/Authenticator/widgets/accounts/row.py index a1b536c..d728fe4 100644 --- a/Authenticator/widgets/accounts/row.py +++ b/Authenticator/widgets/accounts/row.py @@ -54,15 +54,16 @@ class ActionsBox(Gtk.Box): """ def __init__(self): - Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) + Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, + spacing=6) self.copy_btn = ActionButton("edit-copy-symbolic", _("Copy")) self.edit_btn = ActionButton("document-edit-symbolic", _("Edit")) self._build_widget() def _build_widget(self): """Build ActionsBox widgets.""" - self.pack_start(self.copy_btn, False, False, 3) - self.pack_start(self.edit_btn, False, False, 3) + self.pack_start(self.copy_btn, False, False, 0) + self.pack_start(self.edit_btn, False, False, 0) class AccountRow(Gtk.ListBoxRow, GObject.GObject): @@ -134,7 +135,7 @@ class AccountRow(Gtk.ListBoxRow, GObject.GObject): actions.copy_btn.connect("clicked", self._on_copy) actions.edit_btn.connect("clicked", self._on_edit) actions.set_valign(Gtk.Align.CENTER) - container.pack_end(actions, False, False, 6) + container.pack_end(actions, False, False, 0) # Secret code otp_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) From ea67bffd2140ff76b998abf4c50cafd8a39a1a1b Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 19 Oct 2018 22:35:57 -0400 Subject: [PATCH 5/7] search_bar: Hide close button on search bar The close button on the search bar is redundant since the bar can be closed by un-toggling the search button. Since no other GNOME app uses it for search it can be removed. --- Authenticator/widgets/search_bar.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Authenticator/widgets/search_bar.py b/Authenticator/widgets/search_bar.py index a6b0f8e..f19325f 100644 --- a/Authenticator/widgets/search_bar.py +++ b/Authenticator/widgets/search_bar.py @@ -50,8 +50,6 @@ class SearchBar(Gtk.SearchBar): """ Build the SearchBar widgets """ - self.set_show_close_button(True) - self.search_entry.set_width_chars(28) self.search_entry.connect("search-changed", self.set_filter_func, From 2b72be7304aecd7bc8f7483698a620e4a29828a4 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Sat, 20 Oct 2018 17:19:28 -0400 Subject: [PATCH 6/7] application.py: Use "About Authenticator" instead of "About" With the change to the primary menu it was decided that apps should use their name for the About menu entry. --- Authenticator/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Authenticator/application.py b/Authenticator/application.py index f961697..fcb78f6 100644 --- a/Authenticator/application.py +++ b/Authenticator/application.py @@ -113,7 +113,7 @@ class Application(Gtk.Application): main_content = Gio.Menu.new() # Night mode action main_content.append_item(Gio.MenuItem.new(_("Preferences"), "app.settings")) - main_content.append_item(Gio.MenuItem.new(_("About"), "app.about")) + main_content.append_item(Gio.MenuItem.new(_("About Authenticator"), "app.about")) main_content.append_item(Gio.MenuItem.new(_("Keyboard Shortcuts"), "app.shortcuts")) help_section = Gio.MenuItem.new_section(None, main_content) self._menu.append_item(help_section) From f76a70049df8d3af0ed1589c708079f1cc63226f Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Sat, 20 Oct 2018 20:21:49 -0400 Subject: [PATCH 7/7] style.css: Remove progressbar radius with new css class The ProgressBar at the top of the screen had rounded corners on both ends. With the new style class only the right edge of the blue moving part is rounded. This keeps everything else flush with the corners for clean styling. --- Authenticator/widgets/accounts/list.py | 1 + data/style.css | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/Authenticator/widgets/accounts/list.py b/Authenticator/widgets/accounts/list.py index 4aeebce..190843e 100644 --- a/Authenticator/widgets/accounts/list.py +++ b/Authenticator/widgets/accounts/list.py @@ -47,6 +47,7 @@ class AccountsWidget(Gtk.Box, GObject.GObject): def _build_widgets(self): self.otp_progress_bar = Gtk.ProgressBar() + self.otp_progress_bar.get_style_context().add_class("progress-bar") self.add(self.otp_progress_bar) AccountsManager.get_default().connect( "counter_updated", self._on_counter_updated) diff --git a/data/style.css b/data/style.css index 20552ae..f0d6d8f 100644 --- a/data/style.css +++ b/data/style.css @@ -75,3 +75,12 @@ font-size: 18px; } + +.progress-bar trough progress { + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} + +.progress-bar trough { + border-radius: 0px +}