-
-
Notifications
You must be signed in to change notification settings - Fork 36
App/Launcher: Add AppCenter actions #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ba62a4f
App/Launcher: Add AppCenter actions
danirabbit 1cdd1b1
Add issue links to dock.metainfo.xml.in
danirabbit 0848e51
Skip actions if appcenter not found
danirabbit 6898bbc
Don't mark as launched
danirabbit 7992a5b
Merge branch 'main' into danirabbit/appcenter-actions
danirabbit 52ce13a
Merge branch 'main' into danirabbit/appcenter-actions
zeebok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * SPDX-License-Identifier: GPL-3.0 | ||
| * SPDX-FileCopyrightText: 2026 elementary, Inc. (https://elementary.io) | ||
| */ | ||
|
|
||
| [DBus (name = "io.elementary.appcenter")] | ||
| public interface AppCenterDBus : Object { | ||
| public abstract async void install (string component_id) throws GLib.Error; | ||
| public abstract async void update (string component_id) throws GLib.Error; | ||
| public abstract async void uninstall (string component_id) throws GLib.Error; | ||
| public abstract async string get_component_from_desktop_id (string desktop_id) throws GLib.Error; | ||
| public abstract async string[] search_components (string query) throws GLib.Error; | ||
| } | ||
|
|
||
| public class Dock.AppCenter : Object { | ||
| private const string DBUS_NAME = "io.elementary.appcenter"; | ||
| private const string DBUS_PATH = "/io/elementary/appcenter"; | ||
| private const uint RECONNECT_TIMEOUT = 5000U; | ||
|
|
||
| private static AppCenter? instance; | ||
| public static unowned AppCenter get_default () { | ||
| if (instance == null) { | ||
| instance = new AppCenter (); | ||
| } | ||
|
|
||
| return instance; | ||
| } | ||
|
|
||
| public AppCenterDBus? dbus { public get; private set; default = null; } | ||
|
|
||
| construct { | ||
| Bus.watch_name (BusType.SESSION, DBUS_NAME, BusNameWatcherFlags.AUTO_START, | ||
| () => try_connect (), name_vanished_callback); | ||
| } | ||
|
|
||
| private AppCenter () { | ||
|
|
||
| } | ||
|
|
||
| private void try_connect () { | ||
| Bus.get_proxy.begin<AppCenterDBus> (BusType.SESSION, DBUS_NAME, DBUS_PATH, 0, null, (obj, res) => { | ||
| try { | ||
| dbus = Bus.get_proxy.end (res); | ||
| } catch (Error e) { | ||
| warning (e.message); | ||
| Timeout.add (RECONNECT_TIMEOUT, () => { | ||
| try_connect (); | ||
| return false; | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| private void name_vanished_callback (DBusConnection connection, string name) { | ||
| dbus = null; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this causes a memory leak (we have to capture the app center local and therefore the instance as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops thanks for catching this. I'll make a branch to fix it