From d881696d4c2fd4a28cd223d22041820aae76e0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 19 May 2025 13:07:58 -0700 Subject: [PATCH 01/34] Bump deps --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index cbd5ae75e..8e12f7261 100644 --- a/meson.build +++ b/meson.build @@ -37,14 +37,14 @@ add_project_arguments( glib_dep = dependency('glib-2.0') gee_dep = dependency('gee-0.8') gio_dep = dependency('gio-2.0') -gtk_dep = dependency('gtk+-3.0') -granite_dep = dependency('granite', version: '>=6.1.0') +gtk_dep = dependency('gtk4') +granite_dep = dependency('granite-7', version: '>=6.1.0') gobject_dep = dependency('gobject-2.0') gio_unix_dep = dependency('gio-unix-2.0') json_glib_dep = dependency('json-glib-1.0') switchboard_dep = dependency('switchboard-3') -libhandy_dep = dependency('libhandy-1', version: '>= 0.83.0') -wingpanel_dep = dependency('wingpanel', version: '>=2.1.0') +libhandy_dep = dependency('libadwaita-1', version: '>= 0.83.0') +wingpanel_dep = dependency('wingpanel-8', version: '>=2.1.0') posix_dep = meson.get_compiler('vala').find_library('posix') zeitgeist_dep = [] From e200457aed4e7370ae081dc9bea532324f16876b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 29 May 2025 19:16:56 -0700 Subject: [PATCH 02/34] Replace Hdy with Adw --- src/Widgets/PageChecker.vala | 4 ++-- src/Widgets/Switcher.vala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index 82d09d9aa..d9e8e9c6d 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -22,13 +22,13 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { public const double MIN_OPACITY = 0.4; - public unowned Hdy.Carousel paginator { get; construct; } + public unowned Adw.Carousel paginator { get; construct; } public unowned Gtk.Widget page { get; construct; } private static Gtk.CssProvider provider; private int page_number; - public PageChecker (Hdy.Carousel paginator, Gtk.Widget page) { + public PageChecker (Adw.Carousel paginator, Gtk.Widget page) { Object ( paginator: paginator, page: page diff --git a/src/Widgets/Switcher.vala b/src/Widgets/Switcher.vala index ce4edfcda..6481965a7 100644 --- a/src/Widgets/Switcher.vala +++ b/src/Widgets/Switcher.vala @@ -26,7 +26,7 @@ public class Slingshot.Widgets.Switcher : Gtk.Grid { } } - private Hdy.Carousel paginator; + private Adw.Carousel paginator; construct { halign = Gtk.Align.CENTER; @@ -36,7 +36,7 @@ public class Slingshot.Widgets.Switcher : Gtk.Grid { show_all (); } - public void set_paginator (Hdy.Carousel paginator) { + public void set_paginator (Adw.Carousel paginator) { if (this.paginator != null) { get_children ().foreach ((child) => { child.destroy (); From ac37c9ec7813acd7cca8f13383eb99e4f29d6010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 3 Jun 2025 15:07:49 -0700 Subject: [PATCH 03/34] Little replaces --- src/Views/CategoryView.vala | 2 +- src/Views/GridView.vala | 2 +- src/Views/SearchView.vala | 4 ++-- src/Widgets/AppButton.vala | 4 ++-- src/Widgets/AppContextMenu.vala | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 59e8dae35..513e3443d 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -public class Slingshot.Widgets.CategoryView : Gtk.EventBox { +public class Slingshot.Widgets.CategoryView : Granite.Bin { public SlingshotView view { get; construct; } private bool dragging = false; diff --git a/src/Views/GridView.vala b/src/Views/GridView.vala index e433148f9..cf17c442b 100644 --- a/src/Views/GridView.vala +++ b/src/Views/GridView.vala @@ -26,7 +26,7 @@ public class Slingshot.Widgets.Grid : Gtk.Grid { private Gtk.Grid current_grid; private Gee.HashMap grids; - private Hdy.Carousel paginator; + private Adw.Carousel paginator; private Page page; private Gtk.EventControllerKey key_controller; diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index 1dc09d25e..ce31c5522 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -75,14 +75,14 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { public signal void start_search (Synapse.SearchMatch search_match, Synapse.Match? target); public signal void app_launched (); - private Granite.Widgets.AlertView alert_view; + private Granite.Placeholder alert_view; private AppListBox list_box; Gee.HashMap limitator; construct { hscrollbar_policy = Gtk.PolicyType.NEVER; - alert_view = new Granite.Widgets.AlertView ("", _("Try changing search terms."), "edit-find-symbolic"); + alert_view = new Granite.Placeholder ("", _("Try changing search terms."), "edit-find-symbolic"); alert_view.show_all (); // list box diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index ecd4d4d04..f6ed45e7f 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -26,7 +26,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { private Gtk.Label badge; private bool dragging = false; //prevent launching - private Gtk.GestureMultiPress click_controller; + private Gtk.GestureClick click_controller; private Gtk.EventControllerKey menu_key_controller; public AppButton (Backend.App app) { @@ -88,7 +88,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { this.clicked.connect (launch_app); - click_controller = new Gtk.GestureMultiPress (this) { + click_controller = new Gtk.GestureClick (this) { button = 0, exclusive = true }; diff --git a/src/Widgets/AppContextMenu.vala b/src/Widgets/AppContextMenu.vala index 5524193e4..579e4a93e 100644 --- a/src/Widgets/AppContextMenu.vala +++ b/src/Widgets/AppContextMenu.vala @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -public class Slingshot.AppContextMenu : Gtk.Menu { +public class Slingshot.AppContextMenu : Gtk.PopoverMenu { public signal void app_launched (); private const string ACTION_GROUP_PREFIX = "app-actions"; From 149338e898616b24656cb98b41d516110711769d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 3 Jun 2025 15:09:43 -0700 Subject: [PATCH 04/34] Next compile stage --- src/SlingshotView.vala | 2 +- src/Views/CategoryView.vala | 2 +- src/Widgets/AppButton.vala | 2 +- src/Widgets/AppListBox.vala | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 7fdb40736..356bdb7e6 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -224,7 +224,7 @@ public class Slingshot.SlingshotView : Gtk.Grid, UnityClient { return Gdk.EVENT_PROPAGATE; } - public bool on_key_press (Gdk.EventKey event) { + public bool on_key_press (uint keyval, uint keycode, Gdk.ModifierType state) { var key = Gdk.keyval_name (event.keyval).replace ("KP_", ""); if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) { switch (key) { diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 513e3443d..99f164c02 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -24,7 +24,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { private NavListBox category_switcher; private NavListBox listbox; - private const Gtk.TargetEntry DND = { "text/uri-list", 0, 0 }; + // private const Gtk.TargetEntry DND = { "text/uri-list", 0, 0 }; private Gtk.EventControllerKey listbox_key_controller; private Gtk.EventControllerKey category_switcher_key_controller; diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index f6ed45e7f..1bb29ca0d 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -34,7 +34,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { } construct { - Gtk.TargetEntry dnd = {"text/uri-list", 0, 0}; + // Gtk.TargetEntry dnd = {"text/uri-list", 0, 0}; Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd}, Gdk.DragAction.COPY); diff --git a/src/Widgets/AppListBox.vala b/src/Widgets/AppListBox.vala index 432d7a085..421df05d8 100644 --- a/src/Widgets/AppListBox.vala +++ b/src/Widgets/AppListBox.vala @@ -30,7 +30,7 @@ public class Slingshot.AppListBox : Gtk.ListBox { construct { selection_mode = Gtk.SelectionMode.BROWSE; - const Gtk.TargetEntry DND = {"text/uri-list", 0, 0}; + // const Gtk.TargetEntry DND = {"text/uri-list", 0, 0}; Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); motion_notify_event.connect ((event) => { From 9f3e3f71b122b2ec6fbf54caa950ebae6d4d55c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 4 Jun 2025 11:12:41 -0700 Subject: [PATCH 05/34] Indicator cleanups --- src/Indicator.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Indicator.vala b/src/Indicator.vala index 4aa2843f3..fb918ad79 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -45,7 +45,7 @@ public class Slingshot.Indicator : Wingpanel.Indicator { Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default (); + weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()); default_theme.add_resource_path ("/io/elementary/desktop/wingpanel/applications-menu/icons"); } @@ -75,7 +75,7 @@ public class Slingshot.Indicator : Wingpanel.Indicator { var indicator_label = new Gtk.Label (_("Applications")); indicator_label.vexpand = true; - var indicator_icon = new Gtk.Image.from_icon_name ("system-search-symbolic", Gtk.IconSize.MENU); + var indicator_icon = new Gtk.Image.from_icon_name ("system-search-symbolic"); indicator_grid = new Gtk.Grid (); indicator_grid.attach (indicator_icon, 0, 0, 1, 1); From 3f569db567692077363e32e6054275cce632a91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 4 Jun 2025 12:20:51 -0700 Subject: [PATCH 06/34] build fixes --- src/SlingshotView.vala | 2 +- src/Views/CategoryView.vala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 69e679da6..805f4e7ca 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -4,7 +4,7 @@ * 2011-2012 Giulio Collura */ -public class Slingshot.SlingshotView : Gtk.Bin, UnityClient { +public class Slingshot.SlingshotView : Granite.Bin, UnityClient { public signal void close_indicator (); public Backend.AppSystem app_system; diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 688ad0064..e5eed514c 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -25,7 +25,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { private NavListBox listbox; // private const Gtk.TargetEntry DND = { "text/uri-list", 0, 0 }; - private Gtk.GestureMultiPress click_controller; + private Gtk.GestureClick click_controller; private Gtk.EventControllerKey listbox_key_controller; private Gtk.EventControllerKey category_switcher_key_controller; @@ -168,7 +168,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { return row1.cat_name.collate (row2.cat_name); } - private Gtk.Menu create_context_menu () { + private Gtk.PopoverMenu create_context_menu () { var selected_row = (AppListRow) listbox.get_selected_row (); var menu = new Slingshot.AppContextMenu (selected_row.app_id, selected_row.desktop_path); From 24c396f90746cf337ec441b1e3acd7441e64f706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 4 Jun 2025 12:27:24 -0700 Subject: [PATCH 07/34] Minor syntax stuff --- src/SlingshotView.vala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 805f4e7ca..c2507edbc 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -40,23 +40,23 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { var grid_view_btn = new Gtk.ToggleButton () { action_name = "view.view-mode", action_target = new Variant.string ("grid"), - image = new Gtk.Image.from_icon_name ("view-grid-symbolic", BUTTON), + icon_name = "view-grid-symbolic", tooltip_markup = Granite.markup_accel_tooltip ({"1"}, _("View as Grid")) }; var category_view_btn = new Gtk.ToggleButton () { action_name = "view.view-mode", action_target = new Variant.string ("category"), - image = new Gtk.Image.from_icon_name ("view-filter-symbolic", BUTTON), + icon_name = "view-filter-symbolic", tooltip_markup = Granite.markup_accel_tooltip ({"2"}, _("View by Category")) }; var view_selector = new Gtk.Box (HORIZONTAL, 0) { margin_end = 12 }; - view_selector.add (grid_view_btn); - view_selector.add (category_view_btn); - view_selector.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); + view_selector.append (grid_view_btn); + view_selector.append (category_view_btn); + view_selector.append_css_class (Gtk.STYLE_CLASS_LINKED); view_selector_revealer = new Gtk.Revealer () { child = view_selector, @@ -72,8 +72,8 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { margin_start = 12, margin_end = 12 }; - top_box.add (view_selector_revealer); - top_box.add (search_entry); + top_box.append (view_selector_revealer); + top_box.append (search_entry); grid_view = new Widgets.Grid (); @@ -92,8 +92,8 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { var container = new Gtk.Box (VERTICAL, 12) { margin_top = 12 }; - container.add (top_box); - container.add (stack); + container.append (top_box); + container.append (stack); // This function must be after creating the page switcher grid_view.populate (app_system); From 46a518a4432868495eadfca4712b88f275107c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 12:28:21 -0700 Subject: [PATCH 08/34] Wrap up SlingshotView --- src/SlingshotView.vala | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 5e82eb8cc..8d0c2e6fa 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -25,8 +25,6 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { private Widgets.Grid grid_view; private Widgets.SearchView search_view; private Widgets.CategoryView category_view; - private Gtk.EventControllerKey key_controller; - private Gtk.EventControllerKey search_key_controller; private static GLib.Settings settings { get; private set; default = null; } @@ -57,7 +55,7 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { }; view_selector.append (grid_view_btn); view_selector.append (category_view_btn); - view_selector.append_css_class (Gtk.STYLE_CLASS_LINKED); + view_selector.add_css_class (Granite.STYLE_CLASS_LINKED); view_selector_revealer = new Gtk.Revealer () { child = view_selector, @@ -116,22 +114,26 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { search.begin (search_entry.text, match, target); }); - key_press_event.connect ((event) => { - var search_handles_event = search_entry.handle_event (event); - if (search_handles_event && !search_entry.has_focus) { - search_entry.grab_focus (); - search_entry.move_cursor (BUFFER_ENDS, 0, false); - } + // key_press_event.connect ((event) => { + // var search_handles_event = search_entry.handle_event (event); + // if (search_handles_event && !search_entry.has_focus) { + // search_entry.grab_focus (); + // search_entry.move_cursor (BUFFER_ENDS, 0, false); + // } - return search_handles_event; - }); + // return search_handles_event; + // }); - key_controller = new Gtk.EventControllerKey (this); + var key_controller = new Gtk.EventControllerKey (); key_controller.key_pressed.connect (on_key_press); - search_key_controller = new Gtk.EventControllerKey (search_entry); + add_controller (key_controller); + + var search_key_controller = new Gtk.EventControllerKey (); search_key_controller.key_pressed.connect (on_search_view_key_press); + search_entry.add_controller (search_key_controller); + // Showing a menu reverts the effect of the grab_device function. search_entry.search_changed.connect (() => { if (modality != Modality.SEARCH_VIEW) { @@ -234,8 +236,8 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { return Gdk.EVENT_STOP; } } - // Alt accelerators - if ((state & Gdk.ModifierType.MOD1_MASK) != 0) { + + if ((state & Gdk.ModifierType.ALT_MASK) != 0) { switch (keyval) { case Gdk.Key.F4: close_indicator (); From 2bbc5ac312e5a01275e3f3a24ffaa08aa988d472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 13:41:11 -0700 Subject: [PATCH 09/34] CategoryView: little syntax things --- src/Views/CategoryView.vala | 39 +++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 0d61640da..81d536fcc 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -13,16 +13,12 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { private NavListBox listbox; // private const Gtk.TargetEntry DND = { "text/uri-list", 0, 0 }; - private Gtk.GestureClick click_controller; - private Gtk.EventControllerKey listbox_key_controller; - private Gtk.EventControllerKey category_switcher_key_controller; public CategoryView (SlingshotView view) { Object (view: view); } construct { - set_visible_window (false); hexpand = true; category_switcher = new NavListBox () { @@ -31,11 +27,11 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { }; category_switcher.set_sort_func ((Gtk.ListBoxSortFunc) category_sort_func); - var scrolled_category = new Gtk.ScrolledWindow (null, null) { + var scrolled_category = new Gtk.ScrolledWindow () { child = category_switcher, hscrollbar_policy = NEVER }; - scrolled_category.get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR); + scrolled_category.add_css_class (Granite.STYLE_CLASS_SIDEBAR); var separator = new Gtk.Separator (VERTICAL); @@ -46,7 +42,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { }; listbox.set_filter_func ((Gtk.ListBoxFilterFunc) filter_function); - var listbox_scrolled = new Gtk.ScrolledWindow (null, null) { + var listbox_scrolled = new Gtk.ScrolledWindow () { child = listbox, hscrollbar_policy = NEVER }; @@ -54,9 +50,9 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { var container = new Gtk.Box (HORIZONTAL, 0) { hexpand = true }; - container.add (scrolled_category); - container.add (separator); - container.add (listbox_scrolled); + container.append (scrolled_category); + container.append (separator); + container.append (listbox_scrolled); child = container; @@ -75,7 +71,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { }); }); - click_controller = new Gtk.GestureMultiPress (listbox) { + var click_controller = new Gtk.GestureClick () { button = 0, exclusive = true }; @@ -91,7 +87,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { } }); - listbox_key_controller = new Gtk.EventControllerKey (listbox); + var listbox_key_controller = new Gtk.EventControllerKey (); listbox_key_controller.key_pressed.connect (on_key_press); listbox_key_controller.key_released.connect ((keyval, keycode, state) => { var mods = state & Gtk.accelerator_get_default_mod_mask (); @@ -112,9 +108,14 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { } }); - category_switcher_key_controller = new Gtk.EventControllerKey (category_switcher); + listbox.add_controller (click_controller); + listbox.add_controller (listbox_key_controller); + + var category_switcher_key_controller = new Gtk.EventControllerKey (); category_switcher_key_controller.key_pressed.connect (on_key_press); + category_switcher.add_controller (category_switcher_key_controller); + Gtk.drag_source_set (listbox, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); listbox.motion_notify_event.connect ((event) => { @@ -193,16 +194,13 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { public void setup_sidebar () { CategoryRow? old_selected = (CategoryRow) category_switcher.get_selected_row (); - foreach (unowned Gtk.Widget child in category_switcher.get_children ()) { - child.destroy (); - } - listbox.foreach ((app_list_row) => listbox.remove (app_list_row)); + category_switcher.remove_all (); + listbox.remove_all (); foreach (unowned Backend.App app in view.app_system.get_apps_by_name ()) { - listbox.add (new AppListRow (app.desktop_id, app.desktop_path)); + listbox.append (new AppListRow (app.desktop_id, app.desktop_path)); } - listbox.show_all (); // Fill the sidebar unowned Gtk.ListBoxRow? new_selected = null; @@ -212,13 +210,12 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { } var row = new CategoryRow (cat_name); - category_switcher.add (row); + category_switcher.append (row); if (old_selected != null && old_selected.cat_name == cat_name) { new_selected = row; } } - category_switcher.show_all (); category_switcher.select_row (new_selected ?? category_switcher.get_row_at_index (0)); } From 16115143fc51c0ece39ac96c61b0032bcb1fc5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 13:45:44 -0700 Subject: [PATCH 10/34] Fix AppListRow --- src/Widgets/AppListRow.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Widgets/AppListRow.vala b/src/Widgets/AppListRow.vala index b31c03b95..1b6c6d755 100644 --- a/src/Widgets/AppListRow.vala +++ b/src/Widgets/AppListRow.vala @@ -19,8 +19,8 @@ public class AppListRow : Gtk.ListBoxRow { app_info = new GLib.DesktopAppInfo (app_id); var icon = app_info.get_icon (); - weak Gtk.IconTheme theme = Gtk.IconTheme.get_default (); - if (icon == null || theme.lookup_by_gicon (icon, 32, Gtk.IconLookupFlags.USE_BUILTIN) == null) { + unowned var theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()); + if (icon == null || theme.lookup_by_gicon (icon, 32, 32, get_direction (), 0) == null) { icon = new ThemedIcon ("application-default-icon"); } @@ -42,8 +42,8 @@ public class AppListRow : Gtk.ListBoxRow { margin_end = 6, margin_bottom = 6 }; - box.add (image); - box.add (name_label); + box.append (image); + box.append (name_label); child = box; } From 41145dffc8785e3cfd985e553a654e3fe498f8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 15:17:33 -0700 Subject: [PATCH 11/34] Make it build again --- src/Views/SearchView.vala | 10 +++++----- src/Widgets/SearchItem.vala | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index ce26d38cf..b6d4454a8 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -79,9 +79,6 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { private AppListBox list_box; Gee.HashMap limitator; - private Gtk.GestureMultiPress click_controller; - private Gtk.EventControllerKey menu_key_controller; - construct { hscrollbar_policy = Gtk.PolicyType.NEVER; @@ -123,7 +120,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { }); }); - click_controller = new Gtk.GestureMultiPress (list_box) { + var click_controller = new Gtk.GestureMultiPress () { button = 0, exclusive = true }; @@ -141,7 +138,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { } }); - menu_key_controller = new Gtk.EventControllerKey (list_box); + var menu_key_controller = new Gtk.EventControllerKey (); menu_key_controller.key_released.connect ((keyval, keycode, state) => { var search_item = (SearchItem) list_box.get_selected_row (); @@ -161,6 +158,9 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { } }); + list_box.add (click_controller); + list_box.add (menu_key_controller); + add (list_box); } diff --git a/src/Widgets/SearchItem.vala b/src/Widgets/SearchItem.vala index b3b76ca0e..31a670b89 100644 --- a/src/Widgets/SearchItem.vala +++ b/src/Widgets/SearchItem.vala @@ -134,7 +134,7 @@ public class Slingshot.Widgets.SearchItem : Gtk.ListBoxRow { cancellable.cancel (); } - public Gtk.Menu? create_context_menu () { + public Gtk.PopoverMenu? create_context_menu () { if (result_type != APPLICATION) { return null; } From 7aa724a1126d556f89c92cd0e3b1f7f2bd4e3fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 15:18:27 -0700 Subject: [PATCH 12/34] Fix oops --- src/Views/SearchView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index b6d4454a8..be4f71c67 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -158,8 +158,8 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { } }); - list_box.add (click_controller); - list_box.add (menu_key_controller); + list_box.add_controller (click_controller); + list_box.add_controller (menu_key_controller); add (list_box); } From f90e71dfa32279476ceacc646e4ed5f6d43976b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Jun 2025 15:24:09 -0700 Subject: [PATCH 13/34] small syntax fixes --- src/Views/GridView.vala | 6 +++--- src/Views/SearchView.vala | 15 +++++++-------- src/Widgets/SearchItem.vala | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Views/GridView.vala b/src/Views/GridView.vala index cf17c442b..778963b4c 100644 --- a/src/Views/GridView.vala +++ b/src/Views/GridView.vala @@ -29,8 +29,6 @@ public class Slingshot.Widgets.Grid : Gtk.Grid { private Adw.Carousel paginator; private Page page; - private Gtk.EventControllerKey key_controller; - private uint _focused_column = 1; public uint focused_column { set { @@ -107,8 +105,10 @@ public class Slingshot.Widgets.Grid : Gtk.Grid { return Gdk.EVENT_STOP; }); - key_controller = new Gtk.EventControllerKey (this); + var key_controller = new Gtk.EventControllerKey (); key_controller.key_pressed.connect (on_key_press); + + add_controller (key_controller); } public void populate (Backend.AppSystem app_system) { diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index be4f71c67..def98943c 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -82,8 +82,10 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { construct { hscrollbar_policy = Gtk.PolicyType.NEVER; - alert_view = new Granite.Placeholder ("", _("Try changing search terms."), "edit-find-symbolic"); - alert_view.show_all (); + alert_view = new Granite.Placeholder ("") { + icon = new ThemedIcon ("edit-find-symbolic"), + description = _("Try changing search terms.") + }; // list box limitator = new Gee.HashMap (); @@ -120,7 +122,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { }); }); - var click_controller = new Gtk.GestureMultiPress () { + var click_controller = new Gtk.GestureClick () { button = 0, exclusive = true }; @@ -219,15 +221,12 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { var search_item = new SearchItem (app, search_term, result_type); app.start_search.connect ((search, target) => start_search (search, target)); - list_box.add (search_item); - search_item.show_all (); + list_box.append (search_item); } public void clear () { limitator.clear (); - list_box.get_children ().foreach ((child) => { - child.destroy (); - }); + list_box.remove_all (); } public void activate_selection () { diff --git a/src/Widgets/SearchItem.vala b/src/Widgets/SearchItem.vala index 31a670b89..471828f8d 100644 --- a/src/Widgets/SearchItem.vala +++ b/src/Widgets/SearchItem.vala @@ -63,8 +63,8 @@ public class Slingshot.Widgets.SearchItem : Gtk.ListBoxRow { margin_bottom = 6, margin_start = 18 }; - box.add (icon); - box.add (name_label); + box.append (icon); + box.append (name_label); child = box; From 0f69031857e12bf2b78c1fcbe12214abf5126241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Sat, 7 Jun 2025 14:28:58 -0700 Subject: [PATCH 14/34] More fixes --- src/Backend/App.vala | 4 ++-- src/Views/GridView.vala | 20 +++++++++++--------- src/Views/SearchView.vala | 2 +- src/Widgets/AppButton.vala | 14 +++++++------- src/Widgets/PageChecker.vala | 9 ++++----- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/Backend/App.vala b/src/Backend/App.vala index e312d4afd..7f7144ddf 100644 --- a/src/Backend/App.vala +++ b/src/Backend/App.vala @@ -73,8 +73,8 @@ public class Slingshot.Backend.App : Object { icon = desktop_icon; } - weak Gtk.IconTheme theme = Gtk.IconTheme.get_default (); - if (theme.lookup_by_gicon (icon, 64, Gtk.IconLookupFlags.USE_BUILTIN) == null) { + weak Gtk.IconTheme theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()); + if (theme.lookup_by_gicon (icon, 64, 64, get_direction (), 0) == null) { icon = new ThemedIcon ("application-default-icon"); } } diff --git a/src/Views/GridView.vala b/src/Views/GridView.vala index 3f60a6fc5..68177b719 100644 --- a/src/Views/GridView.vala +++ b/src/Views/GridView.vala @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -public class Slingshot.Widgets.Grid : Gtk.Grid { +public class Slingshot.Widgets.Grid : Gtk.Box { public signal void app_launched (); private struct Page { @@ -85,19 +85,21 @@ public class Slingshot.Widgets.Grid : Gtk.Grid { page.rows = 3; page.columns = 5; - paginator = new Hdy.Carousel (); - paginator.expand = true; + paginator = new Adw.Carousel () { + hexpand = true, + vexpand = true + }; var page_switcher = new Widgets.Switcher () { carousel = paginator, halign = CENTER }; - orientation = Gtk.Orientation.VERTICAL; - row_spacing = 24; + orientation = VERTICAL; + spacing = 24; margin_bottom = 12; - add (paginator); - add (page_switcher); + append (paginator); + append (page_switcher); grids = new Gee.HashMap (null, null); @@ -145,14 +147,14 @@ public class Slingshot.Widgets.Grid : Gtk.Grid { next_col_index++; } - show_all (); // Show first page after populating the carousel current_grid_key = 1; } private void add_new_grid () { current_grid = new Gtk.Grid () { - expand = true, + hexpand = true, + vexpand = true, row_homogeneous = true, column_homogeneous = true, margin_start = 12, diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index 5efc59009..01f04fa30 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -207,7 +207,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { list_box.add_controller (click_controller); list_box.add_controller (menu_key_controller); - add (list_box); + child = list_box; } private void move_cursor (Gtk.MovementStep step, int count) { diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 0d6719929..65a32e1e7 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -14,9 +14,6 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { private Gtk.Label badge; private bool dragging = false; //prevent launching - private Gtk.GestureClick click_controller; - private Gtk.EventControllerKey menu_key_controller; - public AppButton (Backend.App app) { Object (app: app); } @@ -65,8 +62,8 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { hexpand = true, vexpand = true }; - box.add (overlay); - box.add (app_label); + box.append (overlay); + box.append (app_label); child = box; @@ -77,7 +74,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { this.clicked.connect (launch_app); - click_controller = new Gtk.GestureClick (this) { + var click_controller = new Gtk.GestureClick () { button = 0, exclusive = true }; @@ -93,7 +90,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { } }); - menu_key_controller = new Gtk.EventControllerKey (this); + var menu_key_controller = new Gtk.EventControllerKey (); menu_key_controller.key_released.connect ((keyval, keycode, state) => { var mods = state & Gtk.accelerator_get_default_mod_mask (); switch (keyval) { @@ -111,6 +108,9 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { } }); + add_controller (click_controller); + add_controller (menu_key_controller); + this.drag_begin.connect ((ctx) => { this.dragging = true; Gtk.drag_set_icon_gicon (ctx, app.icon, 16, 16); diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index d9e8e9c6d..c2639243b 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -41,12 +41,11 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { } construct { - unowned Gtk.StyleContext style_context = get_style_context (); - style_context.add_class (Gtk.STYLE_CLASS_FLAT); - style_context.add_class ("switcher"); - style_context.add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + add_css_class ("switcher"); + get_style_context ().add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - add (new Gtk.Image.from_icon_name ("pager-checked-symbolic", Gtk.IconSize.MENU)); + child = new Gtk.Image.from_icon_name ("pager-checked-symbolic"); + has_frame = false; page_number = paginator.get_children ().index (page); update_opacity (); From 460ad331216787d5a1e2a0e04c0c3b515b3a5a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 9 Jun 2025 13:17:26 -0700 Subject: [PATCH 15/34] More context menu --- src/Widgets/AppContextMenu.vala | 60 ++++++++++++++------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/src/Widgets/AppContextMenu.vala b/src/Widgets/AppContextMenu.vala index 579e4a93e..3656946ad 100644 --- a/src/Widgets/AppContextMenu.vala +++ b/src/Widgets/AppContextMenu.vala @@ -48,7 +48,13 @@ public class Slingshot.AppContextMenu : Gtk.PopoverMenu { construct { var action_group = new SimpleActionGroup (); - insert_action_group (ACTION_GROUP_PREFIX, action_group); + + var actions_section = new GLib.Menu (); + var shell_section = new GLib.Menu (); + + menu_model = new GLib.Menu (); + ((GLib.Menu) menu_model).append_section (null, actions_section); + ((GLib.Menu) menu_model).append_section (null, shell_section); app_info = new DesktopAppInfo (desktop_id); foreach (unowned var action in app_info.list_actions ()) { @@ -62,10 +68,10 @@ public class Slingshot.AppContextMenu : Gtk.PopoverMenu { }); action_group.add_action (simple_action); - var menuitem = new Gtk.MenuItem.with_mnemonic (app_info.get_action_name (action)); - menuitem.set_detailed_action_name (ACTION_PREFIX + APP_ACTION.printf (action)); - - add (menuitem); + actions_section.append ( + app_info.get_action_name (action), + ACTION_PREFIX + APP_ACTION.printf (action) + ); } switcheroo_control = new Slingshot.Backend.SwitcherooControl (); @@ -88,19 +94,13 @@ public class Slingshot.AppContextMenu : Gtk.PopoverMenu { }); action_group.add_action (switcheroo_action); - var menu_item = new Gtk.MenuItem.with_mnemonic ( - _("Open with %s Graphics").printf (switcheroo_control.get_gpu_name (prefers_non_default_gpu)) + actions_section.append ( + _("Open with %s Graphics").printf (switcheroo_control.get_gpu_name (prefers_non_default_gpu)), + ACTION_PREFIX + SWITCHEROO_ACTION ); - menu_item.set_detailed_action_name (ACTION_PREFIX + SWITCHEROO_ACTION); - - add (menu_item); } if (Environment.find_program_in_path ("io.elementary.dock") != null) { - if (get_children ().length () > 0) { - add (new Gtk.SeparatorMenuItem ()); - } - has_system_item = true; var dock = Backend.Dock.get_default (); @@ -116,23 +116,16 @@ public class Slingshot.AppContextMenu : Gtk.PopoverMenu { action_group.add_action (pinned_action); - var menuitem = new Gtk.CheckMenuItem () { - label = _("Keep in _Dock"), - use_underline = true - }; - menuitem.set_detailed_action_name (ACTION_PREFIX + PINNED_ACTION); - - add (menuitem); + shell_section.append ( + _("Keep in _Dock"), + ACTION_PREFIX + PINNED_ACTION + ); dock.notify["dbus"].connect (() => on_dock_dbus_changed (dock)); on_dock_dbus_changed (dock); } if (Environment.find_program_in_path ("io.elementary.appcenter") != null) { - if (!has_system_item && get_children ().length () > 0) { - add (new Gtk.SeparatorMenuItem ()); - } - uninstall_action = new SimpleAction (UNINSTALL_ACTION, null); uninstall_action.activate.connect (action_uninstall); @@ -142,21 +135,20 @@ public class Slingshot.AppContextMenu : Gtk.PopoverMenu { action_group.add_action (uninstall_action); action_group.add_action (view_action); - var uninstall_menuitem = new Gtk.MenuItem.with_label (_("Uninstall")); - uninstall_menuitem.set_detailed_action_name (ACTION_PREFIX + UNINSTALL_ACTION); - - var appcenter_menuitem = new Gtk.MenuItem.with_label (_("View in AppCenter")); - appcenter_menuitem.set_detailed_action_name (ACTION_PREFIX + VIEW_ACTION); + shell_section.append ( + _("Uninstall"), + ACTION_PREFIX + UNINSTALL_ACTION + ); - add (uninstall_menuitem); - add (appcenter_menuitem); + shell_section.append ( + _("View in AppCenter"), + ACTION_PREFIX + VIEW_ACTION + ); var appcenter = Backend.AppCenter.get_default (); appcenter.notify["dbus"].connect (() => on_appcenter_dbus_changed.begin (appcenter)); on_appcenter_dbus_changed.begin (appcenter); } - - show_all (); } private void action_uninstall () { From 53db5a63ca3ae7c540bc228bf78abb779c5d4a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 11 Jun 2025 10:43:41 -0700 Subject: [PATCH 16/34] Some carousel stuff --- src/Backend/App.vala | 2 +- src/Views/GridView.vala | 4 ++-- src/Widgets/AppButton.vala | 18 ++++++------------ src/Widgets/PageChecker.vala | 2 +- src/Widgets/SearchItem.vala | 4 ++-- src/Widgets/Switcher.vala | 12 ++++++------ src/synapse-plugins/desktop-file-plugin.vala | 2 +- 7 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/Backend/App.vala b/src/Backend/App.vala index 8211010c0..dbcdde47d 100644 --- a/src/Backend/App.vala +++ b/src/Backend/App.vala @@ -127,7 +127,7 @@ public class Slingshot.Backend.App : Object { launched (this); // Emit launched signal var context = Gdk.Display.get_default ().get_app_launch_context (); - context.set_timestamp (Gtk.get_current_event_time ()); + context.set_timestamp (Gdk.CURRENT_TIME); switcheroo_control.apply_gpu_environment (context, prefers_default_gpu); new DesktopAppInfo (desktop_id).launch (null, context); diff --git a/src/Views/GridView.vala b/src/Views/GridView.vala index 68177b719..ecec7a0ff 100644 --- a/src/Views/GridView.vala +++ b/src/Views/GridView.vala @@ -75,7 +75,7 @@ public class Slingshot.Widgets.Grid : Gtk.Box { return; } - paginator.scroll_to (grid); + paginator.scroll_to (grid, true); current_grid = grid; refocus (); } @@ -170,7 +170,7 @@ public class Slingshot.Widgets.Grid : Gtk.Box { } } - paginator.add (current_grid); + paginator.append (current_grid); current_grid_key = current_grid_key + 1; grids.set (current_grid_key, current_grid); } diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 454e47d7e..afc5bda90 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -23,10 +23,9 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd}, Gdk.DragAction.COPY); + has_frame = false; tooltip_text = app.description; - get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); - var app_label = new Gtk.Label (app.name) { halign = CENTER, ellipsize = END, @@ -38,12 +37,12 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { }; var icon = app.icon; - unowned var theme = Gtk.IconTheme.get_default (); - if (icon == null || theme.lookup_by_gicon (icon, ICON_SIZE, Gtk.IconLookupFlags.USE_BUILTIN) == null) { + unowned var theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()); + if (icon == null || theme.lookup_by_gicon (icon, ICON_SIZE, ICON_SIZE, get_direction (), 0) == null) { icon = new ThemedIcon ("application-default-icon"); } - var image = new Gtk.Image.from_gicon (icon, ICON_SIZE) { + var image = new Gtk.Image.from_gicon (icon) { margin_top = 9, margin_end = 6, margin_start = 6, @@ -55,7 +54,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { valign = START, visible = false }; - badge.get_style_context ().add_class (Granite.STYLE_CLASS_BADGE); + badge.add_css_class (Granite.STYLE_CLASS_BADGE); var overlay = new Gtk.Overlay () { child = image, @@ -156,11 +155,6 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { private void update_badge_visibility () { var count_visible = app.count_visible && app.current_count > 0; - badge.no_show_all = !count_visible; - if (count_visible) { - badge.show_all (); - } else { - badge.hide (); - } + badge.visible = count_visible; } } diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index c2639243b..6c7e75dab 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -51,7 +51,7 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { update_opacity (); clicked.connect (() => { - paginator.scroll_to (page); + paginator.scroll_to (page, true); }); paginator.notify["position"].connect (() => { diff --git a/src/Widgets/SearchItem.vala b/src/Widgets/SearchItem.vala index 8c4666fe9..12fa40a0c 100644 --- a/src/Widgets/SearchItem.vala +++ b/src/Widgets/SearchItem.vala @@ -44,8 +44,8 @@ public class Slingshot.Widgets.SearchItem : Gtk.ListBoxRow { }; var icon = app.icon; - unowned var theme = Gtk.IconTheme.get_default (); - if (icon == null || theme.lookup_by_gicon (icon, ICON_SIZE, Gtk.IconLookupFlags.USE_BUILTIN) == null) { + unowned var theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()); + if (icon == null || theme.lookup_by_gicon (icon, ICON_SIZE, ICON_SIZE, get_direction (), 0) == null) { icon = new ThemedIcon ("application-default-icon"); } diff --git a/src/Widgets/Switcher.vala b/src/Widgets/Switcher.vala index 1df777efa..4b1fbb228 100644 --- a/src/Widgets/Switcher.vala +++ b/src/Widgets/Switcher.vala @@ -10,9 +10,9 @@ public class Slingshot.Widgets.Switcher : Gtk.Box { public Adw.Carousel carousel { set { if (_carousel != null) { - get_children ().foreach ((child) => { - child.destroy (); - }); + while (get_first_child () != null) { + remove (get_first_child ()); + } } _carousel = value; @@ -22,11 +22,11 @@ public class Slingshot.Widgets.Switcher : Gtk.Box { return; } - foreach (unowned var child in _carousel.get_children ()) { - add_child (child); + for (int i = 1; i <= _carousel.n_pages; i++) { + add_child (carousel.get_nth_page (i)); } - _carousel.add.connect_after (add_child); + _carousel.append.connect_after (add_child); } } diff --git a/src/synapse-plugins/desktop-file-plugin.vala b/src/synapse-plugins/desktop-file-plugin.vala index 266ffa24a..c2cd9cc29 100644 --- a/src/synapse-plugins/desktop-file-plugin.vala +++ b/src/synapse-plugins/desktop-file-plugin.vala @@ -62,7 +62,7 @@ namespace Synapse { public override void execute (Match? match) { var context = Gdk.Display.get_default ().get_app_launch_context (); - context.set_timestamp (Gtk.get_current_event_time ()); + context.set_timestamp (Gdk.CURRENT_TIME); ((DesktopAppInfo) app_info).launch_action (action_name, context); } } From 98378f072010fe7e1b02401ed98afa9a6c4f249d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 11 Jun 2025 12:21:59 -0700 Subject: [PATCH 17/34] page checker, image size --- src/Widgets/PageChecker.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index dd54512b9..ac3405d5c 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -32,7 +32,7 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { construct { add_css_class ("switcher"); - child = new Gtk.Image.from_icon_name ("pager-checked-symbolic", MENU); + child = new Gtk.Image.from_icon_name ("pager-checked-symbolic"); update_opacity (); From fcccc24f6613ce07c58be086b3d2fbded673048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 11 Jun 2025 13:28:48 -0700 Subject: [PATCH 18/34] Fix up more syntax changes --- src/Views/CategoryView.vala | 10 +++++----- src/Widgets/Switcher.vala | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 9539bebeb..fa2e57d23 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -179,12 +179,12 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { } public void page_down () { - category_switcher.move_cursor (Gtk.MovementStep.DISPLAY_LINES, 1); + category_switcher.move_cursor (DISPLAY_LINES, 1, false, true); focus_select_first_row (); } public void page_up () { - category_switcher.move_cursor (Gtk.MovementStep.DISPLAY_LINES, -1); + category_switcher.move_cursor (DISPLAY_LINES, -1, false, true); focus_select_first_row (); } @@ -248,11 +248,11 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { page_down (); return Gdk.EVENT_STOP; case Gdk.Key.Home: - category_switcher.move_cursor (Gtk.MovementStep.PAGES, -1); + category_switcher.move_cursor (PAGES, -1, false, true);; focus_select_first_row (); return Gdk.EVENT_STOP; case Gdk.Key.End: - category_switcher.move_cursor (Gtk.MovementStep.PAGES, 1); + category_switcher.move_cursor (PAGES, 1, false, true);; focus_select_first_row (); return Gdk.EVENT_STOP; case Gdk.Key.KP_Up: @@ -275,7 +275,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { return Gdk.EVENT_PROPAGATE; } - private void move_cursor (Gtk.ListBox list_box, Gtk.MovementStep step, int count) { + private void move_cursor (Gtk.ListBox list_box, Gtk.MovementStep step, int count, bool extend, bool modify) { unowned var selected = list_box.get_selected_row (); if (step != DISPLAY_LINES || selected == null) { return; diff --git a/src/Widgets/Switcher.vala b/src/Widgets/Switcher.vala index 071c885fa..d44fcd531 100644 --- a/src/Widgets/Switcher.vala +++ b/src/Widgets/Switcher.vala @@ -42,7 +42,7 @@ public class Slingshot.Widgets.Switcher : Gtk.Box { button.clicked.connect (() => { unowned var page = _carousel.get_nth_page (i); - _carousel.scroll_to (page); + _carousel.scroll_to (page, true); }); } } From 2b6dff7eb534e56f155e556b72ccf1059e33d0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 23 Jun 2025 12:20:33 -0700 Subject: [PATCH 19/34] Comment out everything that's broken --- src/Views/CategoryView.vala | 84 +++++++++---------- src/Views/GridView.vala | 8 +- src/Views/SearchView.vala | 68 +++++++-------- src/Widgets/AppButton.vala | 32 +++---- .../Actions/ClipboardCopyAction.vala | 36 ++++---- 5 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index fa2e57d23..c86590b9b 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -84,7 +84,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - create_context_menu ().popup_at_pointer (); + // create_context_menu ().popup_at_pointer (); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -99,13 +99,13 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { var selected_row = (AppListRow) listbox.get_selected_row (); - create_context_menu ().popup_at_widget (selected_row , EAST, CENTER); + // create_context_menu ().popup_at_widget (selected_row , EAST, CENTER); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: var selected_row = (AppListRow) listbox.get_selected_row (); - create_context_menu ().popup_at_widget (selected_row, EAST, CENTER); + // create_context_menu ().popup_at_widget (selected_row, EAST, CENTER); break; default: return; @@ -120,45 +120,45 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { category_switcher.add_controller (category_switcher_key_controller); - Gtk.drag_source_set (listbox, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); - - listbox.motion_notify_event.connect ((event) => { - if (!dragging) { - listbox.select_row (listbox.get_row_at_y ((int) event.y)); - } - - return Gdk.EVENT_PROPAGATE; - }); - - listbox.drag_begin.connect ((ctx) => { - unowned Gtk.ListBoxRow? selected_row = listbox.get_selected_row (); - if (selected_row != null) { - dragging = true; - - var drag_item = (AppListRow) selected_row; - drag_uri = "file://" + drag_item.desktop_path; - if (drag_uri != null) { - Gtk.drag_set_icon_gicon (ctx, drag_item.app_info.get_icon (), 32, 32); - } - - view.close_indicator (); - } - }); - - listbox.drag_end.connect (() => { - if (drag_uri != null) { - view.close_indicator (); - } - - dragging = false; - drag_uri = null; - }); - - listbox.drag_data_get.connect ((ctx, sel, info, time) => { - if (drag_uri != null) { - sel.set_uris ({drag_uri}); - } - }); + // Gtk.drag_source_set (listbox, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); + + // listbox.motion_notify_event.connect ((event) => { + // if (!dragging) { + // listbox.select_row (listbox.get_row_at_y ((int) event.y)); + // } + + // return Gdk.EVENT_PROPAGATE; + // }); + + // listbox.drag_begin.connect ((ctx) => { + // unowned Gtk.ListBoxRow? selected_row = listbox.get_selected_row (); + // if (selected_row != null) { + // dragging = true; + + // var drag_item = (AppListRow) selected_row; + // drag_uri = "file://" + drag_item.desktop_path; + // if (drag_uri != null) { + // Gtk.drag_set_icon_gicon (ctx, drag_item.app_info.get_icon (), 32, 32); + // } + + // view.close_indicator (); + // } + // }); + + // listbox.drag_end.connect (() => { + // if (drag_uri != null) { + // view.close_indicator (); + // } + + // dragging = false; + // drag_uri = null; + // }); + + // listbox.drag_data_get.connect ((ctx, sel, info, time) => { + // if (drag_uri != null) { + // sel.set_uris ({drag_uri}); + // } + // }); setup_sidebar (); } diff --git a/src/Views/GridView.vala b/src/Views/GridView.vala index ecec7a0ff..ae703d539 100644 --- a/src/Views/GridView.vala +++ b/src/Views/GridView.vala @@ -104,10 +104,10 @@ public class Slingshot.Widgets.Grid : Gtk.Box { grids = new Gee.HashMap (null, null); can_focus = true; - focus_in_event.connect_after (() => { - refocus (); - return Gdk.EVENT_STOP; - }); + // focus_in_event.connect_after (() => { + // refocus (); + // return Gdk.EVENT_STOP; + // }); var key_controller = new Gtk.EventControllerKey (); key_controller.key_pressed.connect (on_key_press); diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index c3211adbd..9ad6310dd 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -93,7 +93,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { limitator = new Gee.HashMap (); // const Gtk.TargetEntry DND = {"text/uri-list", 0, 0}; - Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); + // Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); list_box = new Gtk.ListBox () { activate_on_single_click = true, @@ -103,43 +103,43 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { list_box.set_header_func ((Gtk.ListBoxUpdateHeaderFunc) update_header); list_box.set_placeholder (alert_view); - list_box.motion_notify_event.connect ((event) => { - if (!dragging) { - list_box.select_row (list_box.get_row_at_y ((int) event.y)); - } + // list_box.motion_notify_event.connect ((event) => { + // if (!dragging) { + // list_box.select_row (list_box.get_row_at_y ((int) event.y)); + // } - return Gdk.EVENT_PROPAGATE; - }); + // return Gdk.EVENT_PROPAGATE; + // }); - list_box.drag_begin.connect ((ctx) => { - var selected_row = list_box.get_selected_row (); - if (selected_row != null) { - dragging = true; + // list_box.drag_begin.connect ((ctx) => { + // var selected_row = list_box.get_selected_row (); + // if (selected_row != null) { + // dragging = true; - var drag_item = (Slingshot.Widgets.SearchItem) selected_row; - drag_uri = drag_item.app_uri; - if (drag_uri != null) { - Gtk.drag_set_icon_gicon (ctx, drag_item.image.gicon, 32, 32); - } + // var drag_item = (Slingshot.Widgets.SearchItem) selected_row; + // drag_uri = drag_item.app_uri; + // if (drag_uri != null) { + // Gtk.drag_set_icon_gicon (ctx, drag_item.image.gicon, 32, 32); + // } - app_launched (); - } - }); + // app_launched (); + // } + // }); - list_box.drag_end.connect (() => { - if (drag_uri != null) { - app_launched (); - } + // list_box.drag_end.connect (() => { + // if (drag_uri != null) { + // app_launched (); + // } - dragging = false; - drag_uri = null; - }); + // dragging = false; + // drag_uri = null; + // }); - list_box.drag_data_get.connect ((ctx, sel, info, time) => { - if (drag_uri != null) { - sel.set_uris ({drag_uri}); - } - }); + // list_box.drag_data_get.connect ((ctx, sel, info, time) => { + // if (drag_uri != null) { + // sel.set_uris ({drag_uri}); + // } + // }); list_box.move_cursor.connect (move_cursor); @@ -177,7 +177,7 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - search_item.create_context_menu ()?.popup_at_pointer (); + // search_item.create_context_menu ()?.popup_at_pointer (); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -192,12 +192,12 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { switch (keyval) { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { - search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); + // search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: - search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); + // search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); break; default: return; diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index afc5bda90..4aa29b517 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -20,8 +20,8 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { construct { // Gtk.TargetEntry dnd = {"text/uri-list", 0, 0}; - Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd}, - Gdk.DragAction.COPY); + // Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd}, + // Gdk.DragAction.COPY); has_frame = false; tooltip_text = app.description; @@ -88,7 +88,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - context_menu.popup_at_pointer (); + // context_menu.popup_at_pointer (); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -101,12 +101,12 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { switch (keyval) { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { - context_menu.popup_at_widget (this, EAST, CENTER); + // context_menu.popup_at_widget (this, EAST, CENTER); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: - context_menu.popup_at_widget (this, EAST, CENTER); + // context_menu.popup_at_widget (this, EAST, CENTER); break; default: return; @@ -116,19 +116,19 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { add_controller (click_controller); add_controller (menu_key_controller); - this.drag_begin.connect ((ctx) => { - this.dragging = true; - Gtk.drag_set_icon_gicon (ctx, app.icon, 16, 16); - app_launched (); - }); + // this.drag_begin.connect ((ctx) => { + // this.dragging = true; + // Gtk.drag_set_icon_gicon (ctx, app.icon, 16, 16); + // app_launched (); + // }); - this.drag_end.connect ( () => { - this.dragging = false; - }); + // this.drag_end.connect ( () => { + // this.dragging = false; + // }); - this.drag_data_get.connect ( (ctx, sel, info, time) => { - sel.set_uris ({File.new_for_path (app.desktop_path).get_uri ()}); - }); + // this.drag_data_get.connect ( (ctx, sel, info, time) => { + // sel.set_uris ({File.new_for_path (app.desktop_path).get_uri ()}); + // }); app.notify["current-count"].connect (update_badge_count); app.notify["count-visible"].connect (update_badge_visibility); diff --git a/src/synapse-core/Actions/ClipboardCopyAction.vala b/src/synapse-core/Actions/ClipboardCopyAction.vala index 0e2e72fc0..506212099 100644 --- a/src/synapse-core/Actions/ClipboardCopyAction.vala +++ b/src/synapse-core/Actions/ClipboardCopyAction.vala @@ -30,26 +30,26 @@ private class Synapse.ClipboardCopyAction: Synapse.BaseAction { } public override void do_execute (Match? match, Match? target = null) { - var cb = Gtk.Clipboard.get (Gdk.Atom.NONE); - if (match.match_type == MatchType.GENERIC_URI) { - UriMatch uri_match = match as UriMatch; - return_if_fail (uri_match != null); + // var cb = Gtk.Clipboard.get (Gdk.Atom.NONE); + // if (match.match_type == MatchType.GENERIC_URI) { + // UriMatch uri_match = match as UriMatch; + // return_if_fail (uri_match != null); - /* Just wow, Gtk and also Vala are trying really hard to make this hard to do... - Gtk.TargetEntry[] no_entries = {}; - Gtk.TargetList l = new Gtk.TargetList (no_entries); - l.add_uri_targets (0); - l.add_text_targets (0); - Gtk.TargetEntry te = Gtk.target_table_new_from_list (l, 2); - cb.set_with_data (); - */ - cb.set_text (uri_match.uri, -1); - } else if (match.match_type == MatchType.TEXT) { - TextMatch? text_match = match as TextMatch; - unowned string content = text_match != null ? text_match.text : match.title; + // /* Just wow, Gtk and also Vala are trying really hard to make this hard to do... + // Gtk.TargetEntry[] no_entries = {}; + // Gtk.TargetList l = new Gtk.TargetList (no_entries); + // l.add_uri_targets (0); + // l.add_text_targets (0); + // Gtk.TargetEntry te = Gtk.target_table_new_from_list (l, 2); + // cb.set_with_data (); + // */ + // cb.set_text (uri_match.uri, -1); + // } else if (match.match_type == MatchType.TEXT) { + // TextMatch? text_match = match as TextMatch; + // unowned string content = text_match != null ? text_match.text : match.title; - cb.set_text (content, -1); - } + // cb.set_text (content, -1); + // } } public override bool valid_for_match (Match match) { From c6c73ca1d9d26f45d780231a8be41b0ed02b672a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 23 Jun 2025 13:04:41 -0700 Subject: [PATCH 20/34] App: add menu model --- src/Backend/App.vala | 203 +++++++++++++++++++++++++++++++++++++ src/Widgets/AppButton.vala | 7 +- 2 files changed, 206 insertions(+), 4 deletions(-) diff --git a/src/Backend/App.vala b/src/Backend/App.vala index 8211010c0..3296ed3e1 100644 --- a/src/Backend/App.vala +++ b/src/Backend/App.vala @@ -28,6 +28,14 @@ public class Slingshot.Backend.App : Object { SYNAPSE } + public const string ACTION_GROUP_PREFIX = "app-actions"; + private const string ACTION_PREFIX = ACTION_GROUP_PREFIX + "."; + private const string APP_ACTION = "action.%s"; + private const string PINNED_ACTION = "pinned"; + private const string SWITCHEROO_ACTION = "switcheroo"; + private const string UNINSTALL_ACTION = "uninstall"; + private const string VIEW_ACTION = "view-in-appcenter"; + public string name { get; construct set; } public string description { get; private set; default = ""; } public string desktop_id { get; construct set; } @@ -49,6 +57,12 @@ public class Slingshot.Backend.App : Object { public Synapse.Match? target { get; private set; default = null; } private Slingshot.Backend.SwitcherooControl switcheroo_control; + private GLib.SimpleAction pinned_action; + private GLib.SimpleAction uninstall_action; + private GLib.SimpleAction view_action; + + private bool has_system_item = false; + private string appstream_comp_id = ""; construct { switcheroo_control = new Slingshot.Backend.SwitcherooControl (); @@ -174,4 +188,193 @@ public class Slingshot.Backend.App : Object { current_count = 0; } } + + public GLib.Menu get_menu_model (out SimpleActionGroup action_group) { + var actions_section = new GLib.Menu (); + var shell_section = new GLib.Menu (); + + action_group = new SimpleActionGroup (); + + var app_info = new DesktopAppInfo (desktop_id); + foreach (unowned var action in app_info.list_actions ()) { + var simple_action = new SimpleAction (APP_ACTION.printf (action), null); + simple_action.activate.connect (() => { + var context = Gdk.Display.get_default ().get_app_launch_context (); + context.set_timestamp (Gdk.CURRENT_TIME); + + app_info.launch_action (action, context); + launched (this); + }); + action_group.add_action (simple_action); + + actions_section.append ( + app_info.get_action_name (action), + ACTION_PREFIX + APP_ACTION.printf (action) + ); + } + + if (switcheroo_control != null && switcheroo_control.has_dual_gpu) { + bool prefers_non_default_gpu = app_info.get_boolean ("PrefersNonDefaultGPU"); + + var switcheroo_action = new SimpleAction (SWITCHEROO_ACTION, null); + switcheroo_action.activate.connect (() => { + try { + var context = Gdk.Display.get_default ().get_app_launch_context (); + context.set_timestamp (Gdk.CURRENT_TIME); + + switcheroo_control.apply_gpu_environment (context, prefers_non_default_gpu); + + app_info.launch (null, context); + launched (this); + } catch (Error e) { + warning ("Failed to launch %s: %s", name, e.message); + } + }); + action_group.add_action (switcheroo_action); + + actions_section.append ( + _("Open with %s Graphics").printf (switcheroo_control.get_gpu_name (prefers_non_default_gpu)), + ACTION_PREFIX + SWITCHEROO_ACTION + ); + } + + if (Environment.find_program_in_path ("io.elementary.dock") != null) { + has_system_item = true; + + var dock = Backend.Dock.get_default (); + var pinned_variant = new Variant.boolean (false); + try { + pinned_variant = new Variant.boolean (desktop_id in dock.dbus.list_launchers ()); + } catch (GLib.Error e) { + critical (e.message); + } + + pinned_action = new SimpleAction.stateful (PINNED_ACTION, null, pinned_variant); + pinned_action.change_state.connect (pinned_action_change_state); + + action_group.add_action (pinned_action); + + shell_section.append ( + _("Keep in _Dock"), + ACTION_PREFIX + PINNED_ACTION + ); + + dock.notify["dbus"].connect (() => on_dock_dbus_changed (dock)); + on_dock_dbus_changed (dock); + } + + if (Environment.find_program_in_path ("io.elementary.appcenter") != null) { + uninstall_action = new SimpleAction (UNINSTALL_ACTION, null); + uninstall_action.activate.connect (action_uninstall); + + view_action = new SimpleAction (VIEW_ACTION, null); + view_action.activate.connect (open_in_appcenter); + + action_group.add_action (uninstall_action); + action_group.add_action (view_action); + + shell_section.append ( + _("Uninstall"), + ACTION_PREFIX + UNINSTALL_ACTION + ); + + shell_section.append ( + _("View in AppCenter"), + ACTION_PREFIX + VIEW_ACTION + ); + + var appcenter = Backend.AppCenter.get_default (); + appcenter.notify["dbus"].connect (() => on_appcenter_dbus_changed.begin (appcenter)); + on_appcenter_dbus_changed.begin (appcenter); + } + + var model = new GLib.Menu (); + model.append_section (null, actions_section); + model.append_section (null, shell_section); + + return model; + } + + private void action_uninstall () { + var appcenter = Backend.AppCenter.get_default (); + if (appcenter.dbus == null || appstream_comp_id == "") { + return; + } + + launched (this); + + appcenter.dbus.uninstall.begin (appstream_comp_id, (obj, res) => { + try { + appcenter.dbus.uninstall.end (res); + } catch (GLib.Error e) { + warning (e.message); + } + }); + } + + private void open_in_appcenter () { + AppInfo.launch_default_for_uri_async.begin ("appstream://" + appstream_comp_id, null, null, (obj, res) => { + try { + AppInfo.launch_default_for_uri_async.end (res); + } catch (Error error) { + var app_info = new DesktopAppInfo (desktop_id); + var message_dialog = new Granite.MessageDialog.with_image_from_icon_name ( + "Unable to open %s in AppCenter".printf (app_info.get_display_name ()), + "", + "dialog-error", + Gtk.ButtonsType.CLOSE + ); + message_dialog.show_error_details (error.message); + message_dialog.response.connect (message_dialog.destroy); + message_dialog.present (); + } finally { + launched (this); + } + }); + } + + private async void on_appcenter_dbus_changed (Backend.AppCenter appcenter) { + if (appcenter.dbus != null) { + try { + appstream_comp_id = yield appcenter.dbus.get_component_from_desktop_id (desktop_id); + } catch (GLib.Error e) { + appstream_comp_id = ""; + warning (e.message); + } + } else { + appstream_comp_id = ""; + } + + uninstall_action.set_enabled (appstream_comp_id != ""); + view_action.set_enabled (appstream_comp_id != ""); + } + + private void on_dock_dbus_changed (Backend.Dock dock) { + pinned_action.set_enabled (dock.dbus != null); + + if (dock.dbus == null) { + return; + } + + try { + pinned_action.change_state (new Variant.boolean (desktop_id in dock.dbus.list_launchers ())); + } catch (GLib.Error e) { + critical (e.message); + } + } + + private void pinned_action_change_state (Variant? value) { + pinned_action.set_state (value); + + try { + var dock = Backend.Dock.get_default (); + if (value.get_boolean ()) { + dock.dbus.add_launcher (desktop_id); + } else { + dock.dbus.remove_launcher (desktop_id); + } + } catch (GLib.Error e) { + critical (e.message); + } + } } diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 5919212a5..a5629569b 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -76,10 +76,9 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { child = box; - var context_menu = new Slingshot.AppContextMenu (app.desktop_id, app.desktop_path); - context_menu.app_launched.connect (() => { - app_launched (); - }); + SimpleActionGroup? action_group = null; + var context_menu = new Gtk.Menu.from_model (app.get_menu_model (out action_group)); + insert_action_group (Backend.App.ACTION_GROUP_PREFIX, action_group); this.clicked.connect (launch_app); From 7e5c196ed8b14644ecb198d377c6426cef716cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 23 Jun 2025 13:21:53 -0700 Subject: [PATCH 21/34] More owl --- po/POTFILES | 1 - src/Backend/App.vala | 3 +- src/Views/CategoryView.vala | 10 +- src/Views/SearchView.vala | 2 + src/Widgets/AppButton.vala | 11 +- src/Widgets/AppContextMenu.vala | 243 -------------------------------- src/Widgets/AppListRow.vala | 10 +- src/Widgets/SearchItem.vala | 5 +- src/meson.build | 1 - 9 files changed, 25 insertions(+), 261 deletions(-) delete mode 100644 src/Widgets/AppContextMenu.vala diff --git a/po/POTFILES b/po/POTFILES index 75180cded..8c4ad60f2 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -15,7 +15,6 @@ src/Views/GridView.vala src/Views/SearchView.vala src/Widgets/AppButton.vala -src/Widgets/AppContextMenu.vala src/Widgets/PageChecker.vala src/Widgets/SearchItem.vala src/Widgets/Switcher.vala diff --git a/src/Backend/App.vala b/src/Backend/App.vala index 3296ed3e1..4ec6f986c 100644 --- a/src/Backend/App.vala +++ b/src/Backend/App.vala @@ -36,6 +36,7 @@ public class Slingshot.Backend.App : Object { private const string UNINSTALL_ACTION = "uninstall"; private const string VIEW_ACTION = "view-in-appcenter"; + public SimpleActionGroup action_group { get; private set; } public string name { get; construct set; } public string description { get; private set; default = ""; } public string desktop_id { get; construct set; } @@ -189,7 +190,7 @@ public class Slingshot.Backend.App : Object { } } - public GLib.Menu get_menu_model (out SimpleActionGroup action_group) { + public GLib.Menu get_menu_model () { var actions_section = new GLib.Menu (); var shell_section = new GLib.Menu (); diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index ba80cca79..445be0b85 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -169,12 +169,10 @@ public class Slingshot.Widgets.CategoryView : Gtk.EventBox { private Gtk.Menu create_context_menu () { var selected_row = (AppListRow) listbox.get_selected_row (); - var menu = new Slingshot.AppContextMenu (selected_row.app_id, selected_row.desktop_path); - menu.app_launched.connect (() => { - view.close_indicator (); - }); + var context_menu = new Gtk.Menu.from_model (selected_row.app.get_menu_model ()); + context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, selected_row.app.action_group); - return menu; + return context_menu; } public void page_down () { @@ -204,7 +202,7 @@ public class Slingshot.Widgets.CategoryView : Gtk.EventBox { listbox.foreach ((app_list_row) => listbox.remove (app_list_row)); foreach (unowned Backend.App app in view.app_system.get_apps_by_name ()) { - listbox.add (new AppListRow (app.desktop_id, app.desktop_path)); + listbox.add (new AppListRow (app)); } listbox.show_all (); diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index 513bb82c3..7fa740e55 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -282,6 +282,8 @@ public class Slingshot.Widgets.SearchView : Gtk.ScrolledWindow { var search_item = new SearchItem (app, search_term, result_type); app.start_search.connect ((search, target) => start_search (search, target)); + app.launched.connect (() => app_launched ()); + list_box.add (search_item); search_item.show_all (); } diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index a5629569b..8c1ee6a6f 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -76,9 +76,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { child = box; - SimpleActionGroup? action_group = null; - var context_menu = new Gtk.Menu.from_model (app.get_menu_model (out action_group)); - insert_action_group (Backend.App.ACTION_GROUP_PREFIX, action_group); + app.launched.connect (() => app_launched ()); this.clicked.connect (launch_app); @@ -91,6 +89,8 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { + var context_menu = new Gtk.Menu.from_model (app.get_menu_model ()); + context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); context_menu.popup_at_pointer (); click_controller.set_state (CLAIMED); @@ -104,11 +104,15 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { switch (keyval) { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { + var context_menu = new Gtk.Menu.from_model (app.get_menu_model ()); + context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); context_menu.popup_at_widget (this, EAST, CENTER); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: + var context_menu = new Gtk.Menu.from_model (app.get_menu_model ()); + context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); context_menu.popup_at_widget (this, EAST, CENTER); break; default: @@ -140,7 +144,6 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { public void launch_app () { app.launch (); - app_launched (); } private void update_badge_count () { diff --git a/src/Widgets/AppContextMenu.vala b/src/Widgets/AppContextMenu.vala deleted file mode 100644 index 4dbbdc94e..000000000 --- a/src/Widgets/AppContextMenu.vala +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright 2019-2025 elementary, Inc. (https://elementary.io) - * Copyright 2020-2021 Justin Haygood - * - * 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 Slingshot.AppContextMenu : Gtk.Menu { - public signal void app_launched (); - - private const string ACTION_GROUP_PREFIX = "app-actions"; - private const string ACTION_PREFIX = ACTION_GROUP_PREFIX + "."; - private const string APP_ACTION = "action.%s"; - private const string PINNED_ACTION = "pinned"; - private const string SWITCHEROO_ACTION = "switcheroo"; - private const string UNINSTALL_ACTION = "uninstall"; - private const string VIEW_ACTION = "view-in-appcenter"; - - public string desktop_id { get; construct; } - public string desktop_path { get; construct; } - private DesktopAppInfo app_info; - - private bool has_system_item = false; - private string appstream_comp_id = ""; - - private Slingshot.Backend.SwitcherooControl switcheroo_control; - private GLib.SimpleAction pinned_action; - private GLib.SimpleAction uninstall_action; - private GLib.SimpleAction view_action; - - public AppContextMenu (string desktop_id, string desktop_path) { - Object ( - desktop_id: desktop_id, - desktop_path: desktop_path - ); - } - - construct { - var action_group = new SimpleActionGroup (); - insert_action_group (ACTION_GROUP_PREFIX, action_group); - - app_info = new DesktopAppInfo (desktop_id); - foreach (unowned var action in app_info.list_actions ()) { - var simple_action = new SimpleAction (APP_ACTION.printf (action), null); - simple_action.activate.connect (() => { - var context = Gdk.Display.get_default ().get_app_launch_context (); - context.set_timestamp (Gdk.CURRENT_TIME); - - app_info.launch_action (action, context); - app_launched (); - }); - action_group.add_action (simple_action); - - var menuitem = new Gtk.MenuItem.with_mnemonic (app_info.get_action_name (action)); - menuitem.set_detailed_action_name (ACTION_PREFIX + APP_ACTION.printf (action)); - - add (menuitem); - } - - switcheroo_control = new Slingshot.Backend.SwitcherooControl (); - if (switcheroo_control != null && switcheroo_control.has_dual_gpu) { - bool prefers_non_default_gpu = app_info.get_boolean ("PrefersNonDefaultGPU"); - - var switcheroo_action = new SimpleAction (SWITCHEROO_ACTION, null); - switcheroo_action.activate.connect (() => { - try { - var context = Gdk.Display.get_default ().get_app_launch_context (); - context.set_timestamp (Gdk.CURRENT_TIME); - - switcheroo_control.apply_gpu_environment (context, prefers_non_default_gpu); - - app_info.launch (null, context); - app_launched (); - } catch (Error e) { - warning ("Failed to launch %s: %s", name, e.message); - } - }); - action_group.add_action (switcheroo_action); - - var menu_item = new Gtk.MenuItem.with_mnemonic ( - _("Open with %s Graphics").printf (switcheroo_control.get_gpu_name (prefers_non_default_gpu)) - ); - menu_item.set_detailed_action_name (ACTION_PREFIX + SWITCHEROO_ACTION); - - add (menu_item); - } - - if (Environment.find_program_in_path ("io.elementary.dock") != null) { - if (get_children ().length () > 0) { - add (new Gtk.SeparatorMenuItem ()); - } - - has_system_item = true; - - var dock = Backend.Dock.get_default (); - var pinned_variant = new Variant.boolean (false); - try { - pinned_variant = new Variant.boolean (desktop_id in dock.dbus.list_launchers ()); - } catch (GLib.Error e) { - critical (e.message); - } - - pinned_action = new SimpleAction.stateful (PINNED_ACTION, null, pinned_variant); - pinned_action.change_state.connect (pinned_action_change_state); - - action_group.add_action (pinned_action); - - var menuitem = new Gtk.CheckMenuItem () { - label = _("Keep in _Dock"), - use_underline = true - }; - menuitem.set_detailed_action_name (ACTION_PREFIX + PINNED_ACTION); - - add (menuitem); - - dock.notify["dbus"].connect (() => on_dock_dbus_changed (dock)); - on_dock_dbus_changed (dock); - } - - if (Environment.find_program_in_path ("io.elementary.appcenter") != null) { - if (!has_system_item && get_children ().length () > 0) { - add (new Gtk.SeparatorMenuItem ()); - } - - uninstall_action = new SimpleAction (UNINSTALL_ACTION, null); - uninstall_action.activate.connect (action_uninstall); - - view_action = new SimpleAction (VIEW_ACTION, null); - view_action.activate.connect (open_in_appcenter); - - action_group.add_action (uninstall_action); - action_group.add_action (view_action); - - var uninstall_menuitem = new Gtk.MenuItem.with_label (_("Uninstall")); - uninstall_menuitem.set_detailed_action_name (ACTION_PREFIX + UNINSTALL_ACTION); - - var appcenter_menuitem = new Gtk.MenuItem.with_label (_("View in AppCenter")); - appcenter_menuitem.set_detailed_action_name (ACTION_PREFIX + VIEW_ACTION); - - add (uninstall_menuitem); - add (appcenter_menuitem); - - var appcenter = Backend.AppCenter.get_default (); - appcenter.notify["dbus"].connect (() => on_appcenter_dbus_changed.begin (appcenter)); - on_appcenter_dbus_changed.begin (appcenter); - } - - show_all (); - } - - private void action_uninstall () { - var appcenter = Backend.AppCenter.get_default (); - if (appcenter.dbus == null || appstream_comp_id == "") { - return; - } - - app_launched (); - - appcenter.dbus.uninstall.begin (appstream_comp_id, (obj, res) => { - try { - appcenter.dbus.uninstall.end (res); - } catch (GLib.Error e) { - warning (e.message); - } - }); - } - - private void open_in_appcenter () { - AppInfo.launch_default_for_uri_async.begin ("appstream://" + appstream_comp_id, null, null, (obj, res) => { - try { - AppInfo.launch_default_for_uri_async.end (res); - } catch (Error error) { - var message_dialog = new Granite.MessageDialog.with_image_from_icon_name ( - "Unable to open %s in AppCenter".printf (app_info.get_display_name ()), - "", - "dialog-error", - Gtk.ButtonsType.CLOSE - ); - message_dialog.show_error_details (error.message); - message_dialog.response.connect (message_dialog.destroy); - message_dialog.present (); - } finally { - app_launched (); - } - }); - } - - private async void on_appcenter_dbus_changed (Backend.AppCenter appcenter) { - if (appcenter.dbus != null) { - try { - appstream_comp_id = yield appcenter.dbus.get_component_from_desktop_id (desktop_id); - } catch (GLib.Error e) { - appstream_comp_id = ""; - warning (e.message); - } - } else { - appstream_comp_id = ""; - } - - uninstall_action.set_enabled (appstream_comp_id != ""); - view_action.set_enabled (appstream_comp_id != ""); - } - - private void on_dock_dbus_changed (Backend.Dock dock) { - pinned_action.set_enabled (dock.dbus != null); - - if (dock.dbus == null) { - return; - } - - try { - pinned_action.change_state (new Variant.boolean (desktop_id in dock.dbus.list_launchers ())); - } catch (GLib.Error e) { - critical (e.message); - } - } - - private void pinned_action_change_state (Variant? value) { - pinned_action.set_state (value); - - try { - var dock = Backend.Dock.get_default (); - if (value.get_boolean ()) { - dock.dbus.add_launcher (desktop_id); - } else { - dock.dbus.remove_launcher (desktop_id); - } - } catch (GLib.Error e) { - critical (e.message); - } - } -} diff --git a/src/Widgets/AppListRow.vala b/src/Widgets/AppListRow.vala index b31c03b95..cb71fe719 100644 --- a/src/Widgets/AppListRow.vala +++ b/src/Widgets/AppListRow.vala @@ -3,15 +3,17 @@ * SPDX-FileCopyrightText: 2019-2025 elementary, Inc. (https://elementary.io) */ -public class AppListRow : Gtk.ListBoxRow { +public class Slingshot.AppListRow : Gtk.ListBoxRow { + public Backend.App app { get; construct; } public string app_id { get; construct; } public string desktop_path { get; construct; } public GLib.DesktopAppInfo app_info { get; private set; } - public AppListRow (string app_id, string desktop_path) { + public AppListRow (Backend.App app) { Object ( - app_id: app_id, - desktop_path: desktop_path + app: app, + app_id: app.desktop_id, + desktop_path: app.desktop_path ); } diff --git a/src/Widgets/SearchItem.vala b/src/Widgets/SearchItem.vala index 566093aa0..889b0a32d 100644 --- a/src/Widgets/SearchItem.vala +++ b/src/Widgets/SearchItem.vala @@ -138,6 +138,9 @@ public class Slingshot.Widgets.SearchItem : Gtk.ListBoxRow { return null; } - return new Slingshot.AppContextMenu (app.desktop_id, app.desktop_path); + var context_menu = new Gtk.Menu.from_model (app.get_menu_model ()); + context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); + + return context_menu; } } diff --git a/src/meson.build b/src/meson.build index fd486110e..d187e9375 100644 --- a/src/meson.build +++ b/src/meson.build @@ -25,7 +25,6 @@ sources = [ 'Views/SearchView.vala', 'Widgets/AppButton.vala', - 'Widgets/AppContextMenu.vala', 'Widgets/AppListRow.vala', 'Widgets/Switcher.vala', 'Widgets/SearchItem.vala', From c9a00b7725723001c2f61bf31b33357f1ed69550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 23 Jun 2025 13:51:17 -0700 Subject: [PATCH 22/34] Comment out last things --- src/Widgets/AppButton.vala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 44c514fa2..03214272c 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -10,9 +10,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { public Backend.App app { get; construct; } private const int ICON_SIZE = 64; - private Gtk.Label badge; - private bool dragging = false; //prevent launching public AppButton (Backend.App app) { Object (app: app); @@ -87,7 +85,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { if (event.triggers_context_menu ()) { var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - context_menu.popup_at_pointer (); + // context_menu.popup_at_pointer (); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -102,14 +100,14 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { if (mods == Gdk.ModifierType.SHIFT_MASK) { var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - context_menu.popup_at_widget (this, EAST, CENTER); + // context_menu.popup_at_widget (this, EAST, CENTER); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - context_menu.popup_at_widget (this, EAST, CENTER); + // context_menu.popup_at_widget (this, EAST, CENTER); break; default: return; From 5b4f338d8812b6ef5a6badae81776000683f7119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 09:34:32 -0700 Subject: [PATCH 23/34] Add menu utils --- src/Utils.vala | 19 +++++++++++++++++++ src/Views/CategoryView.vala | 6 +++--- src/Views/SearchView.vala | 15 ++++++++++++--- src/Widgets/AppButton.vala | 6 +++--- src/meson.build | 1 + 5 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 src/Utils.vala diff --git a/src/Utils.vala b/src/Utils.vala new file mode 100644 index 000000000..b2e3fa1b1 --- /dev/null +++ b/src/Utils.vala @@ -0,0 +1,19 @@ +namespace Slingshot.Utils { + private void menu_popup_on_keypress (Gtk.Popover popover) { + popover.halign = END; + popover.set_pointing_to (Gdk.Rectangle () { + x = (int) popover.get_root ().get_width (), + y = (int) popover.get_root ().get_height () / 2 + }); + popover.popup (); + } + + private void menu_popup_at_pointer (Gtk.Popover popover, double x, double y) { + var rect = Gdk.Rectangle () { + x = (int) x, + y = (int) y + }; + popover.pointing_to = rect; + popover.popup (); + } +} diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 5e2ffd235..2a7f16967 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -81,7 +81,7 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - // create_context_menu ().popup_at_pointer (); + Utils.menu_popup_at_pointer (create_context_menu (), x, y); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -96,13 +96,13 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { var selected_row = (AppListRow) listbox.get_selected_row (); - // create_context_menu ().popup_at_widget (selected_row , EAST, CENTER); + Utils.menu_popup_on_keypress (create_context_menu ()); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: var selected_row = (AppListRow) listbox.get_selected_row (); - // create_context_menu ().popup_at_widget (selected_row, EAST, CENTER); + Utils.menu_popup_on_keypress (create_context_menu ()); break; default: return; diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index 225fc4f09..f75dfcb96 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -165,7 +165,10 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - // search_item.create_context_menu ()?.popup_at_pointer (); + var context_menu = search_item.create_context_menu (); + if (context_menu != null) { + Utils.menu_popup_at_pointer (context_menu, x, y); + } click_controller.set_state (CLAIMED); click_controller.reset (); @@ -180,12 +183,18 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { switch (keyval) { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { - // search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); + var context_menu = search_item.create_context_menu (); + if (context_menu != null) { + Utils.menu_popup_on_keypress (context_menu); + } } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: - // search_item.create_context_menu ()?.popup_at_widget (this, EAST, CENTER); + var context_menu = search_item.create_context_menu (); + if (context_menu != null) { + Utils.menu_popup_on_keypress (context_menu); + } break; default: return; diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 03214272c..d5763f634 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -85,7 +85,7 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { if (event.triggers_context_menu ()) { var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - // context_menu.popup_at_pointer (); + Utils.menu_popup_at_pointer (context_menu, x, y); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -100,14 +100,14 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { if (mods == Gdk.ModifierType.SHIFT_MASK) { var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - // context_menu.popup_at_widget (this, EAST, CENTER); + Utils.menu_popup_on_keypress (context_menu); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - // context_menu.popup_at_widget (this, EAST, CENTER); + Utils.menu_popup_on_keypress (context_menu); break; default: return; diff --git a/src/meson.build b/src/meson.build index d187e9375..680988d95 100644 --- a/src/meson.build +++ b/src/meson.build @@ -8,6 +8,7 @@ endif sources = [ 'Indicator.vala', 'SlingshotView.vala', + 'Utils.vala', 'Backend/AppCenter.vala', 'Backend/AppSystem.vala', From e71828ccd00fc09f92635609d1a4cfc4a0e4ad8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 09:55:40 -0700 Subject: [PATCH 24/34] Update CI and README --- .github/workflows/githubci.yml | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index ac447b845..e153a828b 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libadwaita-1-dev libgee-0.8-dev libgranite-dev libgtk-3-dev libhandy-1-dev libjson-glib-dev libswitchboard-3-dev libwingpanel-dev libzeitgeist-2.0-dev meson valac bc + apt install -y libadwaita-1-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libjson-glib-dev libswitchboard-3-dev libwingpanel-8-dev libzeitgeist-2.0-dev meson valac bc - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index 4c30af122..8d474bb51 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ Lightweight and stylish app launcher. You'll need the following dependencies: * bc +* libadwaita-1-dev * libgee-0.8-dev -* libgranite-dev >= 6.1.0 -* libgtk-3-dev -* libhandy-1-dev >= 0.83.0 +* libgranite-7-dev >= 7.6.0 +* libgtk-4-dev * libjson-glib-dev * libswitchboard-3-dev -* libwingpanel-dev +* libwingpanel-8-dev * libzeitgeist-2.0-dev * meson * pkg-config From 8462137eac08d064fcf0e72b5e75fa107f0eef72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 11:49:05 -0700 Subject: [PATCH 25/34] Fix menu crashing --- src/Backend/App.vala | 15 ++++++++++----- src/Utils.vala | 8 ++++---- src/Views/CategoryView.vala | 18 ++++++------------ src/Widgets/AppButton.vala | 13 +++++-------- src/Widgets/SearchItem.vala | 5 +---- 5 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/Backend/App.vala b/src/Backend/App.vala index 3af40b40d..356a50b3c 100644 --- a/src/Backend/App.vala +++ b/src/Backend/App.vala @@ -28,7 +28,7 @@ public class Slingshot.Backend.App : Object { SYNAPSE } - public const string ACTION_GROUP_PREFIX = "app-actions"; + private const string ACTION_GROUP_PREFIX = "app-actions"; private const string ACTION_PREFIX = ACTION_GROUP_PREFIX + "."; private const string APP_ACTION = "action.%s"; private const string PINNED_ACTION = "pinned"; @@ -36,7 +36,6 @@ public class Slingshot.Backend.App : Object { private const string UNINSTALL_ACTION = "uninstall"; private const string VIEW_ACTION = "view-in-appcenter"; - public SimpleActionGroup action_group { get; private set; } public string name { get; construct set; } public string description { get; private set; default = ""; } public string desktop_id { get; construct set; } @@ -190,11 +189,11 @@ public class Slingshot.Backend.App : Object { } } - public GLib.Menu get_menu_model () { + public Gtk.PopoverMenu get_context_menu (Gtk.Widget parent) { var actions_section = new GLib.Menu (); var shell_section = new GLib.Menu (); - action_group = new SimpleActionGroup (); + var action_group = new SimpleActionGroup (); var app_info = new DesktopAppInfo (desktop_id); foreach (unowned var action in app_info.list_actions ()) { @@ -293,7 +292,13 @@ public class Slingshot.Backend.App : Object { model.append_section (null, actions_section); model.append_section (null, shell_section); - return model; + var context_menu = new Gtk.PopoverMenu.from_model (model) { + has_arrow = false + }; + context_menu.insert_action_group (ACTION_GROUP_PREFIX, action_group); + context_menu.set_parent (parent); + + return context_menu; } private void action_uninstall () { diff --git a/src/Utils.vala b/src/Utils.vala index b2e3fa1b1..e64e6b77e 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -1,14 +1,14 @@ namespace Slingshot.Utils { - private void menu_popup_on_keypress (Gtk.Popover popover) { + public void menu_popup_on_keypress (Gtk.Popover popover) { popover.halign = END; popover.set_pointing_to (Gdk.Rectangle () { - x = (int) popover.get_root ().get_width (), - y = (int) popover.get_root ().get_height () / 2 + x = (int) popover.parent.get_width (), + y = (int) popover.parent.get_height () / 2 }); popover.popup (); } - private void menu_popup_at_pointer (Gtk.Popover popover, double x, double y) { + public void menu_popup_at_pointer (Gtk.Popover popover, double x, double y) { var rect = Gdk.Rectangle () { x = (int) x, y = (int) y diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 2a7f16967..22bb129ac 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -81,7 +81,10 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - Utils.menu_popup_at_pointer (create_context_menu (), x, y); + var context_menu = ((AppListRow) listbox.get_row_at_y ((int) y)).app.get_context_menu (this); + context_menu.halign = START; + + Utils.menu_popup_at_pointer (context_menu, x, y); click_controller.set_state (CLAIMED); click_controller.reset (); @@ -96,13 +99,13 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { var selected_row = (AppListRow) listbox.get_selected_row (); - Utils.menu_popup_on_keypress (create_context_menu ()); + Utils.menu_popup_on_keypress (selected_row.app.get_context_menu (selected_row)); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: var selected_row = (AppListRow) listbox.get_selected_row (); - Utils.menu_popup_on_keypress (create_context_menu ()); + Utils.menu_popup_on_keypress (selected_row.app.get_context_menu (selected_row)); break; default: return; @@ -153,15 +156,6 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { return row1.cat_name.collate (row2.cat_name); } - private Gtk.PopoverMenu create_context_menu () { - var selected_row = (AppListRow) listbox.get_selected_row (); - - var context_menu = new Gtk.PopoverMenu.from_model (selected_row.app.get_menu_model ()); - context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, selected_row.app.action_group); - - return context_menu; - } - public void page_down () { category_switcher.move_cursor (DISPLAY_LINES, 1, false, true); focus_select_first_row (); diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index d5763f634..4fd0acfc6 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -83,8 +83,9 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { var event = click_controller.get_last_event (sequence); if (event.triggers_context_menu ()) { - var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); - context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); + var context_menu = app.get_context_menu (this); + context_menu.halign = START; + Utils.menu_popup_at_pointer (context_menu, x, y); click_controller.set_state (CLAIMED); @@ -98,16 +99,12 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { switch (keyval) { case Gdk.Key.F10: if (mods == Gdk.ModifierType.SHIFT_MASK) { - var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); - context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - Utils.menu_popup_on_keypress (context_menu); + Utils.menu_popup_on_keypress (app.get_context_menu (this)); } break; case Gdk.Key.Menu: case Gdk.Key.MenuKB: - var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); - context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - Utils.menu_popup_on_keypress (context_menu); + Utils.menu_popup_on_keypress (app.get_context_menu (this)); break; default: return; diff --git a/src/Widgets/SearchItem.vala b/src/Widgets/SearchItem.vala index 2e5c2d0c4..033706fd3 100644 --- a/src/Widgets/SearchItem.vala +++ b/src/Widgets/SearchItem.vala @@ -139,9 +139,6 @@ public class Slingshot.Widgets.SearchItem : Gtk.ListBoxRow { return null; } - var context_menu = new Gtk.PopoverMenu.from_model (app.get_menu_model ()); - context_menu.insert_action_group (Backend.App.ACTION_GROUP_PREFIX, app.action_group); - - return context_menu; + return app.get_context_menu (this); } } From d16eb9d63b906099bdc483be721f009989f2ff3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:00:39 -0700 Subject: [PATCH 26/34] Replace search handle event --- src/SlingshotView.vala | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 8d0c2e6fa..5f750f130 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -114,15 +114,7 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { search.begin (search_entry.text, match, target); }); - // key_press_event.connect ((event) => { - // var search_handles_event = search_entry.handle_event (event); - // if (search_handles_event && !search_entry.has_focus) { - // search_entry.grab_focus (); - // search_entry.move_cursor (BUFFER_ENDS, 0, false); - // } - - // return search_handles_event; - // }); + search_entry.set_key_capture_widget (this); var key_controller = new Gtk.EventControllerKey (); key_controller.key_pressed.connect (on_key_press); From 6b1fbeaf6911bbd43fe333d1e7c5225759e53a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:08:20 -0700 Subject: [PATCH 27/34] Fix pager hide --- src/Widgets/PageChecker.vala | 2 +- src/Widgets/Switcher.vala | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index ac3405d5c..8c32e7128 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -32,7 +32,7 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { construct { add_css_class ("switcher"); - child = new Gtk.Image.from_icon_name ("pager-checked-symbolic"); + icon_name = "pager-checked-symbolic"; update_opacity (); diff --git a/src/Widgets/Switcher.vala b/src/Widgets/Switcher.vala index d44fcd531..ef4e73e91 100644 --- a/src/Widgets/Switcher.vala +++ b/src/Widgets/Switcher.vala @@ -33,6 +33,8 @@ public class Slingshot.Widgets.Switcher : Gtk.Box { if (_carousel.n_pages == 1) { hide (); return; + } else { + show (); } for (int i = 0; i < _carousel.get_n_pages (); i++) { From 67baaca7d8df5db69ed98099d1b9d2deb2e34c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:09:53 -0700 Subject: [PATCH 28/34] Remove extra sep --- src/Views/CategoryView.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 22bb129ac..7c43f7aca 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -50,7 +50,6 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { hexpand = true }; container.append (scrolled_category); - container.append (separator); container.append (listbox_scrolled); child = container; From dcdfb9753f431d2c52cf8ff7e956b4c4d1c5bf49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:10:51 -0700 Subject: [PATCH 29/34] Fix shadow clip --- src/SlingshotView.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 5f750f130..2e247be3d 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -59,7 +59,8 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { view_selector_revealer = new Gtk.Revealer () { child = view_selector, - transition_type = SLIDE_RIGHT + transition_type = SLIDE_RIGHT, + overflow = VISIBLE }; search_entry = new Gtk.SearchEntry () { From f53c093a5ab2476131752e6a8778706a9b8f2311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:13:37 -0700 Subject: [PATCH 30/34] Fix pager click --- src/Widgets/PageChecker.vala | 5 +++++ src/Widgets/Switcher.vala | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Widgets/PageChecker.vala b/src/Widgets/PageChecker.vala index 8c32e7128..ae5cf6c8d 100644 --- a/src/Widgets/PageChecker.vala +++ b/src/Widgets/PageChecker.vala @@ -39,6 +39,11 @@ public class Slingshot.Widgets.PageChecker : Gtk.Button { carousel.notify["position"].connect (() => { update_opacity (); }); + + clicked.connect (() => { + unowned var page = carousel.get_nth_page (index); + carousel.scroll_to (page, true); + }); } private void update_opacity () { diff --git a/src/Widgets/Switcher.vala b/src/Widgets/Switcher.vala index ef4e73e91..fcfb9c865 100644 --- a/src/Widgets/Switcher.vala +++ b/src/Widgets/Switcher.vala @@ -39,13 +39,7 @@ public class Slingshot.Widgets.Switcher : Gtk.Box { for (int i = 0; i < _carousel.get_n_pages (); i++) { var button = new PageChecker (_carousel, i); - append (button); - - button.clicked.connect (() => { - unowned var page = _carousel.get_nth_page (i); - _carousel.scroll_to (page, true); - }); } } } From feb977f756a0619919136893ded4099b71bb27ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 24 Jun 2025 12:53:16 -0700 Subject: [PATCH 31/34] Fix DnD --- src/Views/CategoryView.vala | 60 +++++++++++++++++-------------------- src/Views/SearchView.vala | 52 ++++++++++++++++---------------- src/Widgets/AppButton.vala | 41 ++++++++++++++----------- 3 files changed, 77 insertions(+), 76 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 7c43f7aca..7e744f28a 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -7,12 +7,9 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { public SlingshotView view { get; construct; } - private string? drag_uri = null; private Gtk.ListBox category_switcher; private Gtk.ListBox listbox; - // private const Gtk.TargetEntry DND = { "text/uri-list", 0, 0 }; - public CategoryView (SlingshotView view) { Object (view: view); } @@ -111,7 +108,35 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { } }); + var drag_source = new Gtk.DragSource () { + actions = COPY + }; + drag_source.prepare.connect ((x, y) => { + var drag_item = (AppListRow) listbox.get_row_at_y ((int) y); + if (drag_item == null) { + return null; + } + + drag_source.set_icon ( + Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).lookup_by_gicon ( + drag_item.app_info.get_icon (), + 32, + scale_factor, + get_direction (), + PRELOAD + ), 0, 0 + ); + + return new Gdk.ContentProvider.union ({ + new Gdk.ContentProvider.for_value ("file://" + drag_item.desktop_path) + }); + }); + drag_source.drag_begin.connect ((drag_source, drag) => { + view.close_indicator (); + }); + listbox.add_controller (click_controller); + listbox.add_controller (drag_source); listbox.add_controller (listbox_key_controller); var category_switcher_key_controller = new Gtk.EventControllerKey (); @@ -119,35 +144,6 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { category_switcher.add_controller (category_switcher_key_controller); - // Gtk.drag_source_set (listbox, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); - - // listbox.drag_begin.connect ((ctx) => { - // unowned Gtk.ListBoxRow? selected_row = listbox.get_selected_row (); - // if (selected_row != null) { - // var drag_item = (AppListRow) selected_row; - // drag_uri = "file://" + drag_item.desktop_path; - // if (drag_uri != null) { - // Gtk.drag_set_icon_gicon (ctx, drag_item.app_info.get_icon (), 32, 32); - // } - - // view.close_indicator (); - // } - // }); - - // listbox.drag_end.connect (() => { - // if (drag_uri != null) { - // view.close_indicator (); - // } - - // drag_uri = null; - // }); - - // listbox.drag_data_get.connect ((ctx, sel, info, time) => { - // if (drag_uri != null) { - // sel.set_uris ({drag_uri}); - // } - // }); - setup_sidebar (); } diff --git a/src/Views/SearchView.vala b/src/Views/SearchView.vala index f75dfcb96..0052d71c2 100644 --- a/src/Views/SearchView.vala +++ b/src/Views/SearchView.vala @@ -78,7 +78,6 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { private Granite.Placeholder alert_view; private Gtk.ListBox list_box; Gee.HashMap limitator; - private string? drag_uri = null; construct { alert_view = new Granite.Placeholder ("") { @@ -89,9 +88,6 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { // list box limitator = new Gee.HashMap (); - // const Gtk.TargetEntry DND = {"text/uri-list", 0, 0}; - // Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {DND}, Gdk.DragAction.COPY); - list_box = new Gtk.ListBox () { activate_on_single_click = true, selection_mode = BROWSE @@ -107,29 +103,32 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { child = scrolled_window; - // list_box.drag_begin.connect ((ctx) => { - // var selected_row = list_box.get_selected_row (); - // if (selected_row != null) { - - // var drag_item = (Slingshot.Widgets.SearchItem) selected_row; - // drag_uri = drag_item.app_uri; - // if (drag_uri != null) { - // Gtk.drag_set_icon_gicon (ctx, drag_item.image.gicon, 32, 32); - // } - - // list_box.drag_end.connect (() => { - // if (drag_uri != null) { - // app_launched (); - // } - - // drag_uri = null; - // }); + var drag_source = new Gtk.DragSource () { + actions = COPY + }; + drag_source.prepare.connect ((x, y) => { + var drag_item = (Slingshot.Widgets.SearchItem) list_box.get_row_at_y ((int) y); + if (drag_item == null) { + return null; + } - // list_box.drag_data_get.connect ((ctx, sel, info, time) => { - // if (drag_uri != null) { - // sel.set_uris ({drag_uri}); - // } - // }); + drag_source.set_icon ( + Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).lookup_by_gicon ( + drag_item.image.gicon, + 32, + scale_factor, + get_direction (), + PRELOAD + ), 0, 0 + ); + + return new Gdk.ContentProvider.union ({ + new Gdk.ContentProvider.for_value (drag_item.app_uri) + }); + }); + drag_source.drag_begin.connect ((drag_source, drag) => { + app_launched (); + }); list_box.move_cursor.connect (move_cursor); @@ -202,6 +201,7 @@ public class Slingshot.Widgets.SearchView : Granite.Bin { }); list_box.add_controller (click_controller); + list_box.add_controller (drag_source); list_box.add_controller (menu_key_controller); } diff --git a/src/Widgets/AppButton.vala b/src/Widgets/AppButton.vala index 4fd0acfc6..154d9b2b3 100644 --- a/src/Widgets/AppButton.vala +++ b/src/Widgets/AppButton.vala @@ -17,10 +17,6 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { } construct { - // Gtk.TargetEntry dnd = {"text/uri-list", 0, 0}; - // Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd}, - // Gdk.DragAction.COPY); - has_frame = false; tooltip_text = app.description; @@ -111,22 +107,31 @@ public class Slingshot.Widgets.AppButton : Gtk.Button { } }); + var drag_source = new Gtk.DragSource () { + actions = COPY, + content = new Gdk.ContentProvider.union ({ + new Gdk.ContentProvider.for_value ( + File.new_for_path (app.desktop_path).get_uri () + ) + }) + }; + drag_source.drag_begin.connect ((drag_source, drag) => { + drag_source.set_icon ( + Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).lookup_by_gicon ( + icon, + 32, + scale_factor, + get_direction (), + PRELOAD + ), 0, 0 + ); + + app_launched (); + }); + add_controller (click_controller); add_controller (menu_key_controller); - - // this.drag_begin.connect ((ctx) => { - // this.dragging = true; - // Gtk.drag_set_icon_gicon (ctx, app.icon, 16, 16); - // app_launched (); - // }); - - // this.drag_end.connect ( () => { - // this.dragging = false; - // }); - - // this.drag_data_get.connect ( (ctx, sel, info, time) => { - // sel.set_uris ({File.new_for_path (app.desktop_path).get_uri ()}); - // }); + add_controller (drag_source); app.notify["current-count"].connect (update_badge_count); app.notify["count-visible"].connect (update_badge_visibility); From ca93c7225cd633048ad5da60ebcf5df7bb4db6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 13 Jan 2026 08:50:25 -0800 Subject: [PATCH 32/34] lint --- src/Views/CategoryView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/CategoryView.vala b/src/Views/CategoryView.vala index 7e744f28a..b95d051ea 100644 --- a/src/Views/CategoryView.vala +++ b/src/Views/CategoryView.vala @@ -221,11 +221,11 @@ public class Slingshot.Widgets.CategoryView : Granite.Bin { page_down (); return Gdk.EVENT_STOP; case Gdk.Key.Home: - category_switcher.move_cursor (PAGES, -1, false, true);; + category_switcher.move_cursor (PAGES, -1, false, true); focus_select_first_row (); return Gdk.EVENT_STOP; case Gdk.Key.End: - category_switcher.move_cursor (PAGES, 1, false, true);; + category_switcher.move_cursor (PAGES, 1, false, true); focus_select_first_row (); return Gdk.EVENT_STOP; case Gdk.Key.KP_Up: From 13acf0ca1961b96d3d332b38eba09eba484cadea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Mar 2026 09:50:25 -0800 Subject: [PATCH 33/34] Bump to wingpanel 9 --- .github/workflows/githubci.yml | 2 +- README.md | 2 +- meson.build | 2 +- src/SlingshotView.vala | 3 +-- src/synapse-plugins/calculator-plugin/calculator-plugin.vala | 4 ++-- src/synapse-plugins/converter-plugin/converter-plugin.vala | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index 9e42554e8..3485be3ac 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libadwaita-1-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libjson-glib-dev libswitchboard-3-dev libwingpanel-8-dev libzeitgeist-2.0-dev meson valac bc + apt install -y libadwaita-1-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libjson-glib-dev libswitchboard-3-dev libwingpanel-9-dev libzeitgeist-2.0-dev meson valac bc - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index 9be83ca29..3438e9f0e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ You'll need the following dependencies: * libgtk-4-dev * libjson-glib-dev * libswitchboard-3-dev -* libwingpanel-8-dev +* libwingpanel-9-dev * libzeitgeist-2.0-dev * meson * pkg-config diff --git a/meson.build b/meson.build index dd492446e..68c59f0bc 100644 --- a/meson.build +++ b/meson.build @@ -44,7 +44,7 @@ gio_unix_dep = dependency('gio-unix-2.0') json_glib_dep = dependency('json-glib-1.0') switchboard_dep = dependency('switchboard-3') libhandy_dep = dependency('libadwaita-1', version: '>= 0.83.0') -wingpanel_dep = dependency('wingpanel-8', version: '>=2.1.0') +wingpanel_dep = dependency('wingpanel-9', version: '>=2.1.0') posix_dep = meson.get_compiler('vala').find_library('posix') zeitgeist_dep = [] diff --git a/src/SlingshotView.vala b/src/SlingshotView.vala index 01d7fbd3c..97664e12c 100644 --- a/src/SlingshotView.vala +++ b/src/SlingshotView.vala @@ -50,12 +50,11 @@ public class Slingshot.SlingshotView : Granite.Bin, UnityClient { tooltip_markup = Granite.markup_accel_tooltip ({"2"}, _("View by Category")) }; - var view_selector = new Gtk.Box (HORIZONTAL, 0) { + var view_selector = new Granite.Box (HORIZONTAL, LINKED) { margin_end = 12 }; view_selector.append (grid_view_btn); view_selector.append (category_view_btn); - view_selector.add_css_class (Granite.STYLE_CLASS_LINKED); view_selector_revealer = new Gtk.Revealer () { child = view_selector, diff --git a/src/synapse-plugins/calculator-plugin/calculator-plugin.vala b/src/synapse-plugins/calculator-plugin/calculator-plugin.vala index 8b09a0a47..ea5759cc4 100644 --- a/src/synapse-plugins/calculator-plugin/calculator-plugin.vala +++ b/src/synapse-plugins/calculator-plugin/calculator-plugin.vala @@ -44,8 +44,8 @@ namespace Synapse { public override void execute (Match? match) { unowned var display = Gdk.Display.get_default (); - unowned var clipboard = Gtk.Clipboard.get_default (display); - clipboard.set_text (text, -1); + // unowned var clipboard = Gtk.Clipboard.get_default (display); + // clipboard.set_text (text, -1); } } diff --git a/src/synapse-plugins/converter-plugin/converter-plugin.vala b/src/synapse-plugins/converter-plugin/converter-plugin.vala index 604bc6a85..4eed5f117 100644 --- a/src/synapse-plugins/converter-plugin/converter-plugin.vala +++ b/src/synapse-plugins/converter-plugin/converter-plugin.vala @@ -41,8 +41,8 @@ namespace Synapse { public override void execute (Match? match) { unowned var display = Gdk.Display.get_default (); - unowned var clipboard = Gtk.Clipboard.get_default (display); - clipboard.set_text (text, -1); + // unowned var clipboard = Gtk.Clipboard.get_default (display); + // clipboard.set_text (text, -1); } } From ceb2fba71d9c21b5d42401f9bd9839468f15dd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 6 Mar 2026 09:52:49 -0800 Subject: [PATCH 34/34] Update clipboard stuff --- src/synapse-plugins/calculator-plugin/calculator-plugin.vala | 5 ++--- src/synapse-plugins/converter-plugin/converter-plugin.vala | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/synapse-plugins/calculator-plugin/calculator-plugin.vala b/src/synapse-plugins/calculator-plugin/calculator-plugin.vala index ea5759cc4..b1c90b31f 100644 --- a/src/synapse-plugins/calculator-plugin/calculator-plugin.vala +++ b/src/synapse-plugins/calculator-plugin/calculator-plugin.vala @@ -43,9 +43,8 @@ namespace Synapse { } public override void execute (Match? match) { - unowned var display = Gdk.Display.get_default (); - // unowned var clipboard = Gtk.Clipboard.get_default (display); - // clipboard.set_text (text, -1); + unowned var clipboard = Gdk.Display.get_default ().get_clipboard (); + clipboard.set_text (text); } } diff --git a/src/synapse-plugins/converter-plugin/converter-plugin.vala b/src/synapse-plugins/converter-plugin/converter-plugin.vala index 4eed5f117..fc96e730d 100644 --- a/src/synapse-plugins/converter-plugin/converter-plugin.vala +++ b/src/synapse-plugins/converter-plugin/converter-plugin.vala @@ -40,9 +40,8 @@ namespace Synapse { } public override void execute (Match? match) { - unowned var display = Gdk.Display.get_default (); - // unowned var clipboard = Gtk.Clipboard.get_default (display); - // clipboard.set_text (text, -1); + unowned var clipboard = Gdk.Display.get_default ().get_clipboard (); + clipboard.set_text (text); } }