From b52fe87e2b4603aa07a300293db65b491ffb73fd Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 12:04:05 -0600 Subject: [PATCH 01/20] MainWindow: Add an account button, comment out some bullshit --- data/styles/application.css | 52 ++++++++++++++++++------------------- src/MainWindow.vala | 36 +++++++++++++++---------- 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index cb35543c0..2c73abbd0 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -17,33 +17,33 @@ @import url("categories.css"); -.badge { - background-image: - linear-gradient( - to bottom, - shade(@error_color, 1.3), - @error_color - ); - border: 1px solid shade(@error_color, 0.9); - border-radius: 12px; - box-shadow: - inset 0 0 0 1px alpha(white, 0.05), - inset 0 1px 0 0 alpha(white, 0.25), - inset 0 -1px 0 0 alpha(white, 0.1), - 0 1px 2px alpha(black, 0.3); - color: white; - font-size: 11px; - font-weight: 700; - margin: 2px; - min-height: 18px; - min-width: 18px; - text-shadow: 0 1px 1px alpha(black, 0.3); -} +/*.badge {*/ +/* background-image:*/ +/* linear-gradient(*/ +/* to bottom,*/ +/* shade(@error_color, 1.3),*/ +/* @error_color*/ +/* );*/ +/* border: 1px solid shade(@error_color, 0.9);*/ +/* border-radius: 12px;*/ +/* box-shadow:*/ +/* inset 0 0 0 1px alpha(white, 0.05),*/ +/* inset 0 1px 0 0 alpha(white, 0.25),*/ +/* inset 0 -1px 0 0 alpha(white, 0.1),*/ +/* 0 1px 2px alpha(black, 0.3);*/ +/* color: white;*/ +/* font-size: 11px;*/ +/* font-weight: 700;*/ +/* margin: 2px;*/ +/* min-height: 18px;*/ +/* min-width: 18px;*/ +/* text-shadow: 0 1px 1px alpha(black, 0.3);*/ +/*}*/ -.titlebar { - padding-bottom: 0; - padding-top: 0; -} +/*.titlebar {*/ +/* padding-bottom: 0;*/ +/* padding-top: 0;*/ +/*}*/ .banner { background-color: @banner_bg_color; diff --git a/src/MainWindow.vala b/src/MainWindow.vala index b002a9ad8..538daa42c 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -38,7 +38,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { private Gtk.Button return_button; private ulong task_finished_connection = 0U; private Gee.LinkedList return_button_history; - private Gtk.Label updates_badge; + // private Gtk.Label updates_badge; private uint configure_id; private int homepage_view_id; @@ -137,19 +137,19 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { view_mode = new Granite.Widgets.ModeButton (); view_mode.margin_end = view_mode.margin_start = 12; - view_mode.margin_bottom = view_mode.margin_top = 7; + // view_mode.margin_bottom = view_mode.margin_top = 7; homepage_view_id = view_mode.append_text (_("Home")); installed_view_id = view_mode.append_text (C_("view", "Installed")); - updates_badge = new Gtk.Label ("!"); - updates_badge.halign = Gtk.Align.END; - updates_badge.valign = Gtk.Align.START; - updates_badge.get_style_context ().add_class ("badge"); - set_widget_visibility (updates_badge, false); + // updates_badge = new Gtk.Label ("!"); + // updates_badge.halign = Gtk.Align.END; + // updates_badge.valign = Gtk.Align.START; + // updates_badge.get_style_context ().add_class ("badge"); + // set_widget_visibility (updates_badge, false); var view_mode_overlay = new Gtk.Overlay (); view_mode_overlay.add (view_mode); - view_mode_overlay.add_overlay (updates_badge); + // view_mode_overlay.add_overlay (updates_badge); view_mode_revealer = new Gtk.Revealer (); view_mode_revealer.reveal_child = true; @@ -164,6 +164,13 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { custom_title_stack.add (homepage_header); custom_title_stack.set_visible_child (view_mode_revealer); + var account_button = new Gtk.MenuButton (); + account_button.image = new Gtk.Image.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); + account_button.tooltip_text = _("Account"); + + var account_popover = new Gtk.Popover (account_button); + account_button.popover = account_popover; + search_entry = new Gtk.SearchEntry (); search_entry.valign = Gtk.Align.CENTER; search_entry.placeholder_text = _("Search Apps"); @@ -175,6 +182,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { headerbar.show_close_button = true; headerbar.set_custom_title (custom_title_stack); headerbar.pack_start (return_button); + headerbar.pack_end (account_button); headerbar.pack_end (search_entry); headerbar.pack_end (spinner); @@ -251,12 +259,12 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { } public void show_update_badge (uint updates_number) { - if (updates_number == 0U) { - set_widget_visibility (updates_badge, false); - } else { - updates_badge.label = updates_number.to_string (); - set_widget_visibility (updates_badge, true); - } + // if (updates_number == 0U) { + // set_widget_visibility (updates_badge, false); + // } else { + // updates_badge.label = updates_number.to_string (); + // set_widget_visibility (updates_badge, true); + // } } public void show_package (AppCenterCore.Package package) { From bd75cdb28aff82bc4d4f6b157aa9e95c611d0f55 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 12:20:31 -0600 Subject: [PATCH 02/20] MainWindow: More style finagling --- data/styles/application.css | 65 ++++++++++++++++++++++--------------- src/MainWindow.vala | 28 ++++++++-------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index 2c73abbd0..85d70e76c 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -17,33 +17,44 @@ @import url("categories.css"); -/*.badge {*/ -/* background-image:*/ -/* linear-gradient(*/ -/* to bottom,*/ -/* shade(@error_color, 1.3),*/ -/* @error_color*/ -/* );*/ -/* border: 1px solid shade(@error_color, 0.9);*/ -/* border-radius: 12px;*/ -/* box-shadow:*/ -/* inset 0 0 0 1px alpha(white, 0.05),*/ -/* inset 0 1px 0 0 alpha(white, 0.25),*/ -/* inset 0 -1px 0 0 alpha(white, 0.1),*/ -/* 0 1px 2px alpha(black, 0.3);*/ -/* color: white;*/ -/* font-size: 11px;*/ -/* font-weight: 700;*/ -/* margin: 2px;*/ -/* min-height: 18px;*/ -/* min-width: 18px;*/ -/* text-shadow: 0 1px 1px alpha(black, 0.3);*/ -/*}*/ - -/*.titlebar {*/ -/* padding-bottom: 0;*/ -/* padding-top: 0;*/ -/*}*/ +/* To account for badge styling */ +.titlebar { + padding-bottom: 0; + padding-top: 0; +} + +/* To account for no headerbar padding due to badge styling */ +.titlebar .view-switcher { + margin: 12px 0 11px; +} + +/* To get the slimmer headerbar on tile/maximize */ +.tiled .titlebar .view-switcher { + margin: 8px 0; +} + +.badge { + background-image: + linear-gradient( + to bottom, + shade(@error_color, 1.3), + @error_color + ); + border: 1px solid shade(@error_color, 0.9); + border-radius: 12px; + box-shadow: + inset 0 0 0 1px alpha(white, 0.05), + inset 0 1px 0 0 alpha(white, 0.25), + inset 0 -1px 0 0 alpha(white, 0.1), + 0 1px 2px alpha(black, 0.3); + color: white; + font-size: 11px; + font-weight: 700; + margin: 2px; + min-height: 18px; + min-width: 18px; + text-shadow: 0 1px 1px alpha(black, 0.3); +} .banner { background-color: @banner_bg_color; diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 538daa42c..7f3e453b5 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -38,7 +38,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { private Gtk.Button return_button; private ulong task_finished_connection = 0U; private Gee.LinkedList return_button_history; - // private Gtk.Label updates_badge; + private Gtk.Label updates_badge; private uint configure_id; private int homepage_view_id; @@ -138,18 +138,19 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { view_mode = new Granite.Widgets.ModeButton (); view_mode.margin_end = view_mode.margin_start = 12; // view_mode.margin_bottom = view_mode.margin_top = 7; + view_mode.get_style_context ().add_class ("view-switcher"); homepage_view_id = view_mode.append_text (_("Home")); installed_view_id = view_mode.append_text (C_("view", "Installed")); - // updates_badge = new Gtk.Label ("!"); - // updates_badge.halign = Gtk.Align.END; - // updates_badge.valign = Gtk.Align.START; - // updates_badge.get_style_context ().add_class ("badge"); - // set_widget_visibility (updates_badge, false); + updates_badge = new Gtk.Label ("!"); + updates_badge.halign = Gtk.Align.END; + updates_badge.valign = Gtk.Align.START; + updates_badge.get_style_context ().add_class ("badge"); + set_widget_visibility (updates_badge, false); var view_mode_overlay = new Gtk.Overlay (); view_mode_overlay.add (view_mode); - // view_mode_overlay.add_overlay (updates_badge); + view_mode_overlay.add_overlay (updates_badge); view_mode_revealer = new Gtk.Revealer (); view_mode_revealer.reveal_child = true; @@ -167,6 +168,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { var account_button = new Gtk.MenuButton (); account_button.image = new Gtk.Image.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); account_button.tooltip_text = _("Account"); + account_button.valign = Gtk.Align.CENTER; var account_popover = new Gtk.Popover (account_button); account_button.popover = account_popover; @@ -259,12 +261,12 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { } public void show_update_badge (uint updates_number) { - // if (updates_number == 0U) { - // set_widget_visibility (updates_badge, false); - // } else { - // updates_badge.label = updates_number.to_string (); - // set_widget_visibility (updates_badge, true); - // } + if (updates_number == 0U) { + set_widget_visibility (updates_badge, false); + } else { + updates_badge.label = updates_number.to_string (); + set_widget_visibility (updates_badge, true); + } } public void show_package (AppCenterCore.Package package) { From a34f775e59697fc6bafddbad4707edb2d185db7c Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:41:49 -0600 Subject: [PATCH 03/20] Add basic dialog with app listbox --- data/styles/AppHistoryRow.css | 40 +++++++++++++++++ src/Dialogs/AccountDialog.vala | 82 ++++++++++++++++++++++++++++++++++ src/MainWindow.vala | 13 +++--- src/Widgets/AppHistoryRow.vala | 56 +++++++++++++++++++++++ src/meson.build | 2 + 5 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 data/styles/AppHistoryRow.css create mode 100644 src/Dialogs/AccountDialog.vala create mode 100644 src/Widgets/AppHistoryRow.vala diff --git a/data/styles/AppHistoryRow.css b/data/styles/AppHistoryRow.css new file mode 100644 index 000000000..cf5f07012 --- /dev/null +++ b/data/styles/AppHistoryRow.css @@ -0,0 +1,40 @@ +/* + * Copyright © 2020 elementary, Inc. (https://elementary.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +@keyframes reveal-spin { + to { + -gtk-icon-transform: rotate(90deg); + } +} + +list row button.delete { + background-color: @STRAWBERRY_500; + border-radius: 50%; + border-width: 0; + box-shadow: + 0 1px 3px alpha (@STRAWBERRY_900, 0.12), + 0 1px 2px alpha (@STRAWBERRY_900, 0.24); + color: #fff; + margin: 6px; + padding: 2px; + -gtk-icon-shadow: 0 1px 2px alpha (#000, 0.6); + -gtk-icon-shadow: 0 1px 2px alpha (@STRAWBERRY_700, 0.6); +} + +list row:selected button.delete image { + animation: reveal-spin 250ms ease-out 1; +} diff --git a/src/Dialogs/AccountDialog.vala b/src/Dialogs/AccountDialog.vala new file mode 100644 index 000000000..61f894aae --- /dev/null +++ b/src/Dialogs/AccountDialog.vala @@ -0,0 +1,82 @@ +/* + * Copyright © 2020 elementary, Inc. (https://elementary.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { + public AccountDialog () { + Object ( + default_width: 400, + default_height: 300, + title: _("Log In or Sign Up") + ); + } + + construct { + var primary_label = new Gtk.Label (_("Account")); + primary_label.wrap = true; + primary_label.max_width_chars = 60; + primary_label.xalign = 0; + primary_label.get_style_context ().add_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + + var secondary_label = new Gtk.Label (_("Download previously installed apps.")); + secondary_label.wrap = true; + secondary_label.max_width_chars = 60; + secondary_label.xalign = 0; + + var search_entry = new Gtk.SearchEntry (); + search_entry.margin = 6; + search_entry.placeholder_text = _("Search App History"); + + var placeholder = new Granite.Widgets.AlertView ( + _("No app history"), + _("Download or purchase an app for it to show up here."), + "" + ); + placeholder.show_all (); + + var listbox = new Gtk.ListBox (); + listbox.activate_on_single_click = false; + listbox.expand = true; + listbox.selection_mode = Gtk.SelectionMode.MULTIPLE; + listbox.set_placeholder (placeholder); + + listbox.add (new AppHistoryRow("Example App", "App description goes here", "application-default-icon")); + + var scrolled_window = new Gtk.ScrolledWindow (null, null); + scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER; + scrolled_window.add (listbox); + + var list_grid = new Gtk.Grid (); + list_grid.attach (search_entry, 0, 0); + list_grid.attach (scrolled_window, 0, 1); + + var frame = new Gtk.Frame (null); + frame.margin_top = 24; + frame.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + frame.add (list_grid); + + var grid = new Gtk.Grid (); + grid.margin = 12; + grid.margin_top = 0; + grid.orientation = Gtk.Orientation.VERTICAL; + grid.add (primary_label); + grid.add (secondary_label); + grid.add (frame); + grid.show_all (); + + get_content_area ().add (grid); + } +} diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 7f3e453b5..ae1f4e480 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -137,7 +137,6 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { view_mode = new Granite.Widgets.ModeButton (); view_mode.margin_end = view_mode.margin_start = 12; - // view_mode.margin_bottom = view_mode.margin_top = 7; view_mode.get_style_context ().add_class ("view-switcher"); homepage_view_id = view_mode.append_text (_("Home")); installed_view_id = view_mode.append_text (C_("view", "Installed")); @@ -165,13 +164,15 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { custom_title_stack.add (homepage_header); custom_title_stack.set_visible_child (view_mode_revealer); - var account_button = new Gtk.MenuButton (); - account_button.image = new Gtk.Image.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); - account_button.tooltip_text = _("Account"); + + var account_button = new Gtk.Button.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); + account_button.tooltip_text = _("Account…"); account_button.valign = Gtk.Align.CENTER; - var account_popover = new Gtk.Popover (account_button); - account_button.popover = account_popover; + account_button.clicked.connect (() => { + var account_dialog = new AppCenter.Widgets.AccountDialog (); + account_dialog.show (); + }); search_entry = new Gtk.SearchEntry (); search_entry.valign = Gtk.Align.CENTER; diff --git a/src/Widgets/AppHistoryRow.vala b/src/Widgets/AppHistoryRow.vala new file mode 100644 index 000000000..f066c2eee --- /dev/null +++ b/src/Widgets/AppHistoryRow.vala @@ -0,0 +1,56 @@ +/* + * Copyright © 2020 elementary, Inc. (https://elementary.io) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { + public string description { get; construct; } + public string title_text { get; construct set; } + public string icon_name { get; construct set; } + + public AppHistoryRow (string? _title_text, string? _description, string? _icon_name = "application-default-icon") { + Object ( + title_text: _title_text, + description: _description, + icon_name: _icon_name + ); + } + + construct { + var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DND); + image.pixel_size = 32; + + var title_label = new Gtk.Label (title_text); + title_label.ellipsize = Pango.EllipsizeMode.END; + title_label.halign = Gtk.Align.START; + + var description_label = new Gtk.Label ("%s".printf (Markup.escape_text (description))); + description_label.ellipsize = Pango.EllipsizeMode.END; + description_label.halign = Gtk.Align.START; + description_label.use_markup = true; + + var grid = new Gtk.Grid (); + grid.margin = 6; + grid.column_spacing = 6; + grid.attach (image, 0, 0, 1, 2); + grid.attach (title_label, 1, 0); + grid.attach (description_label, 1, 1); + + add (grid); + + title_label.bind_property ("label", this, "title-text"); + } +} + diff --git a/src/meson.build b/src/meson.build index b9fefbdf9..5098277b5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,6 +18,7 @@ appcenter_files = files( 'Core/Task.vala', 'Core/UbuntuDriversBackend.vala', 'Core/UpdateManager.vala', + 'Dialogs/AccountDialog.vala', 'Dialogs/ContentWarningDialog.vala', 'Dialogs/NonCuratedWarningDialog.vala', 'Dialogs/RestartDialog.vala', @@ -36,6 +37,7 @@ appcenter_files = files( 'Views/SearchView.vala', 'Views/View.vala', 'Widgets/AbstractAppList.vala', + 'Widgets/AppHistoryRow.vala', 'Widgets/AppListRow.vala', 'Widgets/Banner.vala', 'Widgets/CardNumberEntry.vala', From 33c7ce2e0677765215793f38bba526b06e882570 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:46:09 -0600 Subject: [PATCH 04/20] Make dialog modal and give it a top-level window --- src/MainWindow.vala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ae1f4e480..3e534fafb 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -171,7 +171,9 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { account_button.clicked.connect (() => { var account_dialog = new AppCenter.Widgets.AccountDialog (); - account_dialog.show (); + account_dialog.transient_for = (Gtk.Window) get_toplevel (); + account_dialog.run (); + account_dialog.destroy (); }); search_entry = new Gtk.SearchEntry (); From 69cc01f7bac4f82a1548d7f6a2ac389896a754c8 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:47:49 -0600 Subject: [PATCH 05/20] Lint --- src/Dialogs/AccountDialog.vala | 2 +- src/Widgets/AppHistoryRow.vala | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Dialogs/AccountDialog.vala b/src/Dialogs/AccountDialog.vala index 61f894aae..473daf46b 100644 --- a/src/Dialogs/AccountDialog.vala +++ b/src/Dialogs/AccountDialog.vala @@ -53,7 +53,7 @@ public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { listbox.selection_mode = Gtk.SelectionMode.MULTIPLE; listbox.set_placeholder (placeholder); - listbox.add (new AppHistoryRow("Example App", "App description goes here", "application-default-icon")); + listbox.add (new AppHistoryRow ("Example App", "App description goes here", "application-default-icon")); var scrolled_window = new Gtk.ScrolledWindow (null, null); scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER; diff --git a/src/Widgets/AppHistoryRow.vala b/src/Widgets/AppHistoryRow.vala index f066c2eee..b37bd7f41 100644 --- a/src/Widgets/AppHistoryRow.vala +++ b/src/Widgets/AppHistoryRow.vala @@ -53,4 +53,3 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { title_label.bind_property ("label", this, "title-text"); } } - From 3c4db800e19c0effa1ba1ebc459a9e85fd14a7c6 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:48:29 -0600 Subject: [PATCH 06/20] Remove unused CSS --- data/styles/AppHistoryRow.css | 40 ----------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 data/styles/AppHistoryRow.css diff --git a/data/styles/AppHistoryRow.css b/data/styles/AppHistoryRow.css deleted file mode 100644 index cf5f07012..000000000 --- a/data/styles/AppHistoryRow.css +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright © 2020 elementary, Inc. (https://elementary.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -@keyframes reveal-spin { - to { - -gtk-icon-transform: rotate(90deg); - } -} - -list row button.delete { - background-color: @STRAWBERRY_500; - border-radius: 50%; - border-width: 0; - box-shadow: - 0 1px 3px alpha (@STRAWBERRY_900, 0.12), - 0 1px 2px alpha (@STRAWBERRY_900, 0.24); - color: #fff; - margin: 6px; - padding: 2px; - -gtk-icon-shadow: 0 1px 2px alpha (#000, 0.6); - -gtk-icon-shadow: 0 1px 2px alpha (@STRAWBERRY_700, 0.6); -} - -list row:selected button.delete image { - animation: reveal-spin 250ms ease-out 1; -} From bf07913324169a5c9027e26987e05f0f01ab8927 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:50:32 -0600 Subject: [PATCH 07/20] DRY title --- src/Dialogs/AccountDialog.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dialogs/AccountDialog.vala b/src/Dialogs/AccountDialog.vala index 473daf46b..cea62b14e 100644 --- a/src/Dialogs/AccountDialog.vala +++ b/src/Dialogs/AccountDialog.vala @@ -20,12 +20,12 @@ public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { Object ( default_width: 400, default_height: 300, - title: _("Log In or Sign Up") + title: _("Account") ); } construct { - var primary_label = new Gtk.Label (_("Account")); + var primary_label = new Gtk.Label (title); primary_label.wrap = true; primary_label.max_width_chars = 60; primary_label.xalign = 0; From b63c620d91897778741029cf1033c5858e12d939 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 15:51:49 -0600 Subject: [PATCH 08/20] RY title because apparently that didn't work --- src/Dialogs/AccountDialog.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dialogs/AccountDialog.vala b/src/Dialogs/AccountDialog.vala index cea62b14e..45143be36 100644 --- a/src/Dialogs/AccountDialog.vala +++ b/src/Dialogs/AccountDialog.vala @@ -25,7 +25,7 @@ public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { } construct { - var primary_label = new Gtk.Label (title); + var primary_label = new Gtk.Label (_("Account")); primary_label.wrap = true; primary_label.max_width_chars = 60; primary_label.xalign = 0; From 8c7c651a0de1b894d27522e95720b2c9d658dfae Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 20:10:27 -0600 Subject: [PATCH 09/20] MainWindow: Add account popover --- ...countDialog.vala => AppHistoryDialog.vala} | 19 +++++-- src/MainWindow.vala | 54 +++++++++++++++---- src/meson.build | 2 +- 3 files changed, 60 insertions(+), 15 deletions(-) rename src/Dialogs/{AccountDialog.vala => AppHistoryDialog.vala} (84%) diff --git a/src/Dialogs/AccountDialog.vala b/src/Dialogs/AppHistoryDialog.vala similarity index 84% rename from src/Dialogs/AccountDialog.vala rename to src/Dialogs/AppHistoryDialog.vala index 45143be36..928151ded 100644 --- a/src/Dialogs/AccountDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -15,17 +15,18 @@ * along with this program. If not, see . */ -public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { - public AccountDialog () { +public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { + public AppHistoryDialog () { Object ( + deletable: false, default_width: 400, default_height: 300, - title: _("Account") + title: _("App History") ); } construct { - var primary_label = new Gtk.Label (_("Account")); + var primary_label = new Gtk.Label (_("App History")); primary_label.wrap = true; primary_label.max_width_chars = 60; primary_label.xalign = 0; @@ -41,7 +42,7 @@ public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { search_entry.placeholder_text = _("Search App History"); var placeholder = new Granite.Widgets.AlertView ( - _("No app history"), + _("No apps in history"), _("Download or purchase an app for it to show up here."), "" ); @@ -77,6 +78,14 @@ public class AppCenter.Widgets.AccountDialog : Gtk.Dialog { grid.add (frame); grid.show_all (); + var action_area = (Gtk.ButtonBox) get_action_area (); + action_area.margin = 6; + get_content_area ().add (grid); + add_button (_("Cancel"), Gtk.ResponseType.CANCEL); + + response.connect (() => { + destroy (); + }); } } diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 3e534fafb..429be73d9 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -164,25 +164,61 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow { custom_title_stack.add (homepage_header); custom_title_stack.set_visible_child (view_mode_revealer); + var app_history_model_button = new Gtk.ModelButton (); + app_history_model_button.text = _("App History…"); - var account_button = new Gtk.Button.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); - account_button.tooltip_text = _("Account…"); - account_button.valign = Gtk.Align.CENTER; + app_history_model_button.clicked.connect (() => { + var app_history_dialog = new AppCenter.Widgets.AppHistoryDialog (); + app_history_dialog.transient_for = (Gtk.Window) get_toplevel (); + app_history_dialog.show_all (); + }); - account_button.clicked.connect (() => { - var account_dialog = new AppCenter.Widgets.AccountDialog (); - account_dialog.transient_for = (Gtk.Window) get_toplevel (); - account_dialog.run (); - account_dialog.destroy (); + var wallet_model_button = new Gtk.ModelButton (); + wallet_model_button.text = _("Wallet…"); + + wallet_model_button.clicked.connect (() => { + try { + AppInfo.launch_default_for_uri ("settings://personal/payments", null); + } catch (Error e) { + critical (e.message); + } }); + var account_settings_model_button = new Gtk.ModelButton (); + account_settings_model_button.text = _("Online Accounts Settings…"); + + account_settings_model_button.clicked.connect (() => { + try { + AppInfo.launch_default_for_uri ("settings://accounts/online", null); + } catch (Error e) { + critical (e.message); + } + }); + + var account_popover_grid = new Gtk.Grid (); + account_popover_grid.margin_bottom = account_popover_grid.margin_top = 3; + account_popover_grid.orientation = Gtk.Orientation.VERTICAL; + + account_popover_grid.add (app_history_model_button); + account_popover_grid.add (wallet_model_button); + account_popover_grid.add (account_settings_model_button); + account_popover_grid.show_all (); + + var account_popover = new Gtk.Popover (null); + account_popover.add (account_popover_grid); + + var account_button = new Gtk.MenuButton (); + account_button.image = new Gtk.Image.from_icon_name ("avatar-default", Gtk.IconSize.LARGE_TOOLBAR); + account_button.popover = account_popover; + account_button.tooltip_text = _("Account"); + account_button.valign = Gtk.Align.CENTER; + search_entry = new Gtk.SearchEntry (); search_entry.valign = Gtk.Align.CENTER; search_entry.placeholder_text = _("Search Apps"); spinner = new Gtk.Spinner (); - /* HeaderBar */ headerbar = new Gtk.HeaderBar (); headerbar.show_close_button = true; headerbar.set_custom_title (custom_title_stack); diff --git a/src/meson.build b/src/meson.build index 5098277b5..e8915abef 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,7 +18,7 @@ appcenter_files = files( 'Core/Task.vala', 'Core/UbuntuDriversBackend.vala', 'Core/UpdateManager.vala', - 'Dialogs/AccountDialog.vala', + 'Dialogs/AppHistoryDialog.vala', 'Dialogs/ContentWarningDialog.vala', 'Dialogs/NonCuratedWarningDialog.vala', 'Dialogs/RestartDialog.vala', From c0ebac9e04a53f89ee4a64188ce840e0fadb76fa Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 20:28:01 -0600 Subject: [PATCH 10/20] Update copyright headers --- data/styles/application.css | 34 +++++++++++++++++----------------- src/MainWindow.vala | 32 +++++++++++++++++--------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index 85d70e76c..b58c5de48 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017–2018 elementary, Inc. (https://elementary.io) + * Copyright © 2017–2020 elementary, Inc. (https://elementary.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,22 +17,6 @@ @import url("categories.css"); -/* To account for badge styling */ -.titlebar { - padding-bottom: 0; - padding-top: 0; -} - -/* To account for no headerbar padding due to badge styling */ -.titlebar .view-switcher { - margin: 12px 0 11px; -} - -/* To get the slimmer headerbar on tile/maximize */ -.tiled .titlebar .view-switcher { - margin: 8px 0; -} - .badge { background-image: linear-gradient( @@ -56,6 +40,22 @@ text-shadow: 0 1px 1px alpha(black, 0.3); } +/* To account for badge styling */ +.titlebar { + padding-bottom: 0; + padding-top: 0; +} + +/* To account for no headerbar padding due to badge styling */ +.titlebar .view-switcher { + margin: 12px 0 11px; +} + +/* To get the slimmer headerbar on tile/maximize */ +.tiled .titlebar .view-switcher { + margin: 8px 0; +} + .banner { background-color: @banner_bg_color; background-image: diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 429be73d9..4a853d6e1 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1,18 +1,20 @@ -/* Copyright 2015 Marvin Beckers -* -* This program is free software: you can redistribute it -* and/or modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation, either version 3 of the -* License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be -* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -* Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see http://www.gnu.org/licenses/. -*/ +/* + * Copyright © 2020 elementary, Inc. (https://elementary.io) + * 2015 Marvin Beckers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ public class AppCenter.MainWindow : Gtk.ApplicationWindow { public bool working { From 77bf0017a5ceea10ca17235cdf3a3d7c09ef2561 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 20:30:16 -0600 Subject: [PATCH 11/20] Fix CSS indentation --- data/styles/application.css | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index b58c5de48..84a3b6023 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -18,42 +18,42 @@ @import url("categories.css"); .badge { - background-image: - linear-gradient( - to bottom, - shade(@error_color, 1.3), - @error_color - ); - border: 1px solid shade(@error_color, 0.9); - border-radius: 12px; - box-shadow: - inset 0 0 0 1px alpha(white, 0.05), - inset 0 1px 0 0 alpha(white, 0.25), - inset 0 -1px 0 0 alpha(white, 0.1), - 0 1px 2px alpha(black, 0.3); - color: white; - font-size: 11px; - font-weight: 700; - margin: 2px; - min-height: 18px; - min-width: 18px; - text-shadow: 0 1px 1px alpha(black, 0.3); + background-image: + linear-gradient( + to bottom, + shade(@error_color, 1.3), + @error_color + ); + border: 1px solid shade(@error_color, 0.9); + border-radius: 12px; + box-shadow: + inset 0 0 0 1px alpha(white, 0.05), + inset 0 1px 0 0 alpha(white, 0.25), + inset 0 -1px 0 0 alpha(white, 0.1), + 0 1px 2px alpha(black, 0.3); + color: white; + font-size: 11px; + font-weight: 700; + margin: 2px; + min-height: 18px; + min-width: 18px; + text-shadow: 0 1px 1px alpha(black, 0.3); } /* To account for badge styling */ .titlebar { - padding-bottom: 0; - padding-top: 0; + padding-bottom: 0; + padding-top: 0; } /* To account for no headerbar padding due to badge styling */ .titlebar .view-switcher { - margin: 12px 0 11px; + margin: 12px 0 11px; } /* To get the slimmer headerbar on tile/maximize */ .tiled .titlebar .view-switcher { - margin: 8px 0; + margin: 8px 0; } .banner { From bd9137f71a4782ddf3b62e06e29a06a02aca8cfd Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 20:30:41 -0600 Subject: [PATCH 12/20] Fix CSS indentation --- data/styles/application.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index 84a3b6023..22345382d 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -19,11 +19,11 @@ .badge { background-image: - linear-gradient( - to bottom, - shade(@error_color, 1.3), - @error_color - ); + linear-gradient( + to bottom, + shade(@error_color, 1.3), + @error_color + ); border: 1px solid shade(@error_color, 0.9); border-radius: 12px; box-shadow: From 6ab7029ebaafb4ca25e4d57a8fa561263c7c28ae Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 21:13:48 -0600 Subject: [PATCH 13/20] AppHistoryDialog: Open AppStream link on activating row --- src/Dialogs/AppHistoryDialog.vala | 27 ++++++++++++++++----------- src/Widgets/AppHistoryRow.vala | 31 ++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index 928151ded..cb26134be 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -48,26 +48,31 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { ); placeholder.show_all (); - var listbox = new Gtk.ListBox (); - listbox.activate_on_single_click = false; - listbox.expand = true; - listbox.selection_mode = Gtk.SelectionMode.MULTIPLE; - listbox.set_placeholder (placeholder); + var list_box = new Gtk.ListBox (); + list_box.activate_on_single_click = true; + list_box.expand = true; + list_box.selection_mode = Gtk.SelectionMode.MULTIPLE; + list_box.set_placeholder (placeholder); - listbox.add (new AppHistoryRow ("Example App", "App description goes here", "application-default-icon")); + list_box.add (new AppHistoryRow ( + "Example App", + "App description goes here", + "com.example.app", + "application-default-icon" + )); var scrolled_window = new Gtk.ScrolledWindow (null, null); scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER; - scrolled_window.add (listbox); + scrolled_window.add (list_box); - var list_grid = new Gtk.Grid (); - list_grid.attach (search_entry, 0, 0); - list_grid.attach (scrolled_window, 0, 1); + var list_box_grid = new Gtk.Grid (); + list_box_grid.attach (search_entry, 0, 0); + list_box_grid.attach (scrolled_window, 0, 1); var frame = new Gtk.Frame (null); frame.margin_top = 24; frame.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); - frame.add (list_grid); + frame.add (list_box_grid); var grid = new Gtk.Grid (); grid.margin = 12; diff --git a/src/Widgets/AppHistoryRow.vala b/src/Widgets/AppHistoryRow.vala index b37bd7f41..4d6c57bf8 100644 --- a/src/Widgets/AppHistoryRow.vala +++ b/src/Widgets/AppHistoryRow.vala @@ -16,14 +16,21 @@ */ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { + public string name { get; construct; } public string description { get; construct; } - public string title_text { get; construct set; } - public string icon_name { get; construct set; } + public string rdnn { get; construct; } + public string icon_name { get; construct; } - public AppHistoryRow (string? _title_text, string? _description, string? _icon_name = "application-default-icon") { + public AppHistoryRow ( + string _name, + string _description, + string _rdnn, + string? _icon_name = "application-default-icon" + ) { Object ( - title_text: _title_text, + name: _name, description: _description, + rdnn: _rdnn, icon_name: _icon_name ); } @@ -32,9 +39,9 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DND); image.pixel_size = 32; - var title_label = new Gtk.Label (title_text); - title_label.ellipsize = Pango.EllipsizeMode.END; - title_label.halign = Gtk.Align.START; + var name_label = new Gtk.Label (name); + name_label.ellipsize = Pango.EllipsizeMode.END; + name_label.halign = Gtk.Align.START; var description_label = new Gtk.Label ("%s".printf (Markup.escape_text (description))); description_label.ellipsize = Pango.EllipsizeMode.END; @@ -45,11 +52,17 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { grid.margin = 6; grid.column_spacing = 6; grid.attach (image, 0, 0, 1, 2); - grid.attach (title_label, 1, 0); + grid.attach (name_label, 1, 0); grid.attach (description_label, 1, 1); add (grid); - title_label.bind_property ("label", this, "title-text"); + activate.connect (() => { + try { + AppInfo.launch_default_for_uri ("appstream://%s".printf (rdnn), null); + } catch (Error e) { + critical (e.message); + } + }); } } From 04076f55525d5f799ff0255c3a3e92153896f6b0 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Thu, 12 Mar 2020 21:42:54 -0600 Subject: [PATCH 14/20] Try to get activating on single click --- src/Dialogs/AppHistoryDialog.vala | 2 +- src/Widgets/AppHistoryRow.vala | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index cb26134be..2acbe55f4 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -51,7 +51,7 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { var list_box = new Gtk.ListBox (); list_box.activate_on_single_click = true; list_box.expand = true; - list_box.selection_mode = Gtk.SelectionMode.MULTIPLE; + list_box.selection_mode = Gtk.SelectionMode.SINGLE; list_box.set_placeholder (placeholder); list_box.add (new AppHistoryRow ( diff --git a/src/Widgets/AppHistoryRow.vala b/src/Widgets/AppHistoryRow.vala index 4d6c57bf8..36cdf1e60 100644 --- a/src/Widgets/AppHistoryRow.vala +++ b/src/Widgets/AppHistoryRow.vala @@ -16,19 +16,19 @@ */ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { - public string name { get; construct; } + public string title { get; construct; } public string description { get; construct; } public string rdnn { get; construct; } public string icon_name { get; construct; } public AppHistoryRow ( - string _name, + string _title, string _description, string _rdnn, string? _icon_name = "application-default-icon" ) { Object ( - name: _name, + title: _title, description: _description, rdnn: _rdnn, icon_name: _icon_name @@ -39,9 +39,9 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DND); image.pixel_size = 32; - var name_label = new Gtk.Label (name); - name_label.ellipsize = Pango.EllipsizeMode.END; - name_label.halign = Gtk.Align.START; + var title_label = new Gtk.Label (title); + title_label.ellipsize = Pango.EllipsizeMode.END; + title_label.halign = Gtk.Align.START; var description_label = new Gtk.Label ("%s".printf (Markup.escape_text (description))); description_label.ellipsize = Pango.EllipsizeMode.END; @@ -52,7 +52,7 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { grid.margin = 6; grid.column_spacing = 6; grid.attach (image, 0, 0, 1, 2); - grid.attach (name_label, 1, 0); + grid.attach (title_label, 1, 0); grid.attach (description_label, 1, 1); add (grid); From 40c2dd3c1a06613bfb6cafb4f6946e8b1fb2ada5 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Fri, 13 Mar 2020 11:10:18 -0600 Subject: [PATCH 15/20] Fix single-click activation --- src/Dialogs/AppHistoryDialog.vala | 5 +++++ src/Widgets/AppHistoryRow.vala | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index 2acbe55f4..5e81f2a2c 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -89,6 +89,11 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { get_content_area ().add (grid); add_button (_("Cancel"), Gtk.ResponseType.CANCEL); + list_box.row_activated.connect ((row) => { + (row as Widgets.AppHistoryRow).open_app (); + destroy (); + }); + response.connect (() => { destroy (); }); diff --git a/src/Widgets/AppHistoryRow.vala b/src/Widgets/AppHistoryRow.vala index 36cdf1e60..03507b4fa 100644 --- a/src/Widgets/AppHistoryRow.vala +++ b/src/Widgets/AppHistoryRow.vala @@ -56,13 +56,13 @@ public class AppCenter.Widgets.AppHistoryRow : Gtk.ListBoxRow { grid.attach (description_label, 1, 1); add (grid); + } - activate.connect (() => { - try { - AppInfo.launch_default_for_uri ("appstream://%s".printf (rdnn), null); - } catch (Error e) { - critical (e.message); - } - }); + public void open_app () { + try { + AppInfo.launch_default_for_uri ("appstream://%s".printf (rdnn), null); + } catch (Error e) { + critical (e.message); + } } } From dcce5b3e622eb8a9ca003b5a5fa443ba60130def Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Fri, 13 Mar 2020 13:19:08 -0600 Subject: [PATCH 16/20] Add filter checkbox --- src/Dialogs/AppHistoryDialog.vala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index 5e81f2a2c..fdfdc3169 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -20,7 +20,7 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { Object ( deletable: false, default_width: 400, - default_height: 300, + default_height: 5gut00, title: _("App History") ); } @@ -65,9 +65,14 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { scrolled_window.hscrollbar_policy = Gtk.PolicyType.NEVER; scrolled_window.add (list_box); + var filter_check_button = new Gtk.CheckButton (); + filter_check_button.label = _("Include currently-installed apps"); + filter_check_button.margin = 6; + var list_box_grid = new Gtk.Grid (); - list_box_grid.attach (search_entry, 0, 0); - list_box_grid.attach (scrolled_window, 0, 1); + list_box_grid.orientation = Gtk.Orientation.VERTICAL; + list_box_grid.add (search_entry); + list_box_grid.add (scrolled_window); var frame = new Gtk.Frame (null); frame.margin_top = 24; @@ -81,6 +86,7 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { grid.add (primary_label); grid.add (secondary_label); grid.add (frame); + grid.add (filter_check_button); grid.show_all (); var action_area = (Gtk.ButtonBox) get_action_area (); From 477bfdbcf50c67197ca7bd91269625f23e964cd8 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Fri, 13 Mar 2020 13:19:32 -0600 Subject: [PATCH 17/20] Fix keyboard spam --- src/Dialogs/AppHistoryDialog.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index fdfdc3169..91e6e0f80 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -20,7 +20,7 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { Object ( deletable: false, default_width: 400, - default_height: 5gut00, + default_height: 500, title: _("App History") ); } From ad58742672825a1f46132852500619b0e4b5005a Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Wed, 10 Feb 2021 17:14:20 -0700 Subject: [PATCH 18/20] AppHistoryDialog: Subclass Granite.Dialog --- src/Dialogs/AppHistoryDialog.vala | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index 91e6e0f80..d4d68b7b3 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { +public class AppCenter.Widgets.AppHistoryDialog : Granite.Dialog { public AppHistoryDialog () { Object ( deletable: false, @@ -89,9 +89,6 @@ public class AppCenter.Widgets.AppHistoryDialog : Gtk.Dialog { grid.add (filter_check_button); grid.show_all (); - var action_area = (Gtk.ButtonBox) get_action_area (); - action_area.margin = 6; - get_content_area ().add (grid); add_button (_("Cancel"), Gtk.ResponseType.CANCEL); From 4a0bc9cf9be67d7a2b3546812963c9cb899f9d93 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Wed, 10 Feb 2021 17:15:22 -0700 Subject: [PATCH 19/20] Bump copyrights --- data/styles/application.css | 2 +- src/Dialogs/AppHistoryDialog.vala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index 1212a746a..1d51162ce 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -1,5 +1,5 @@ /* - * Copyright © 2017–2020 elementary, Inc. (https://elementary.io) + * Copyright 2017–2021 elementary, Inc. (https://elementary.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/Dialogs/AppHistoryDialog.vala b/src/Dialogs/AppHistoryDialog.vala index d4d68b7b3..92935f6b5 100644 --- a/src/Dialogs/AppHistoryDialog.vala +++ b/src/Dialogs/AppHistoryDialog.vala @@ -1,5 +1,5 @@ /* - * Copyright © 2020 elementary, Inc. (https://elementary.io) + * Copyright 2020–2021 elementary, Inc. (https://elementary.io) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 7f9cc28a8fd938d14c6daab3a9062617ae63b755 Mon Sep 17 00:00:00 2001 From: Cassidy James Blaede Date: Wed, 10 Feb 2021 17:34:11 -0700 Subject: [PATCH 20/20] Remove custom styling for badge --- data/styles/application.css | 16 ---------------- src/MainWindow.vala | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/data/styles/application.css b/data/styles/application.css index 1d51162ce..6dfc35d48 100644 --- a/data/styles/application.css +++ b/data/styles/application.css @@ -15,22 +15,6 @@ * along with this program. If not, see . */ -/* To account for badge styling */ -.titlebar { - padding-bottom: 0; - padding-top: 0; -} - -/* To account for no headerbar padding due to badge styling */ -.titlebar .view-switcher { - margin: 12px 0 11px; -} - -/* To get the slimmer headerbar on tile/maximize */ -.tiled .titlebar .view-switcher { - margin: 8px 0; -} - .switcher { background-color: transparent; border: none; diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 63de41900..8471c1fc3 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -154,9 +154,13 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow { return_button.get_style_context ().add_class ("back-button"); return_button_history = new Gee.LinkedList (); - view_mode = new Granite.Widgets.ModeButton (); - view_mode.margin_end = view_mode.margin_start = 12; + view_mode = new Granite.Widgets.ModeButton () { + margin_end = 12, + margin_start = 12, + valign = Gtk.Align.CENTER + }; view_mode.get_style_context ().add_class ("view-switcher"); + homepage_view_id = view_mode.append_text (_("Home")); installed_view_id = view_mode.append_text (C_("view", "Installed")); @@ -173,10 +177,11 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow { eventbox_badge.add (updates_badge); eventbox_badge.button_release_event.connect (badge_event); - updates_badge_revealer = new Gtk.Revealer (); - updates_badge_revealer.halign = Gtk.Align.END; - updates_badge_revealer.valign = Gtk.Align.START; - updates_badge_revealer.transition_type = Gtk.RevealerTransitionType.CROSSFADE; + updates_badge_revealer = new Gtk.Revealer () { + halign = Gtk.Align.END, + transition_type = Gtk.RevealerTransitionType.CROSSFADE, + valign = Gtk.Align.START + }; updates_badge_revealer.add (eventbox_badge); var view_mode_overlay = new Gtk.Overlay (); @@ -251,7 +256,6 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow { spinner = new Gtk.Spinner (); - /* HeaderBar */ headerbar = new Hdy.HeaderBar (); headerbar.show_close_button = true; headerbar.set_custom_title (custom_title_stack); @@ -386,7 +390,7 @@ public class AppCenter.MainWindow : Hdy.ApplicationWindow { last_installed_package = package; // Only show a toast when we're not on the installed app's page, i.e if - // no package is selected (we are not on an app page), or a package is + // no package is selected (we are not on an app page), or a package is // selected but it's not the app we're installing. if (selected_package == null || (selected_package != null && selected_package.get_name () != package.get_name ())) { toast.title = _("“%s” has been installed").printf (package.get_name ());