-
-
Notifications
You must be signed in to change notification settings - Fork 118
Use org.freedesktop.portal.OpenURI for Providing the AppChooser
#1162
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
00a1753
Use org.freedesktop.portal.OpenURI for providing the app chooser
Marukesu 2fddf5f
Merge branch 'master' into open-in-no-libportal
Marukesu cdd44cc
apply suggestions, handle read-only files correctly
Marukesu 25cf90d
Merge branch 'master' into open-in-no-libportal
d0243c5
Fix spelling
a64585c
Apply Review
Marukesu 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
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,49 @@ | ||
| /* | ||
| * Copyright (c) 2021 elementary, Inc. (https://elementary.io) | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace Portal { | ||
| const string DESKTOP_BUS_NAME = "org.freedesktop.portal.Desktop"; | ||
| const string DESKTOP_BUS_PATH = "/org/freedesktop/portal/desktop"; | ||
| OpenURI? open_uri_portal = null; | ||
|
|
||
| public static string generate_token () { | ||
| return "%s_%i".printf ( | ||
| GLib.Application.get_default ().application_id.replace (".", "_"), | ||
| Random.int_range (0, int32.MAX) | ||
| ); | ||
| } | ||
|
|
||
| [DBus (name = "org.freedesktop.portal.OpenURI")] | ||
| interface OpenURI : Object { | ||
| [DBus (name = "version")] | ||
| public abstract uint32 version { get; } | ||
|
|
||
| public static OpenURI @get () throws Error { | ||
| if (open_uri_portal == null) { | ||
| var connection = GLib.Application.get_default ().get_dbus_connection (); | ||
| open_uri_portal = connection.get_proxy_sync<OpenURI> (DESKTOP_BUS_NAME, DESKTOP_BUS_PATH); | ||
| } | ||
|
|
||
| return open_uri_portal; | ||
| } | ||
|
|
||
| public abstract ObjectPath open_uri (string parent_window, string uri, HashTable<string, Variant> options) throws DBusError, IOError; | ||
| public abstract ObjectPath open_file (string parent_window, UnixInputStream fd, HashTable<string, Variant> options) throws DBusError, IOError; | ||
| public abstract ObjectPath open_directory (string parent_window, UnixInputStream fd, HashTable<string, Variant> options) throws DBusError, IOError; | ||
| } | ||
| } |
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,14 @@ | ||
| [CCode (cheader_filename = "gdk/gdkwayland.h")] | ||
| namespace Gdk.Wayland { | ||
| [CCode (type_id = "GDK_TYPE_WAYLAND_WINDOW", type_check_function = "GDK_IS_WAYLAND_WINDOW")] | ||
| public class Window : Gdk.Window { | ||
| protected Window (); | ||
|
|
||
| public bool export_handle (owned WindowExported callback); | ||
| public bool set_transient_for_exported (string parent_handle_str); | ||
| public void unexport_handle (); | ||
| } | ||
|
|
||
| [CCode (instance_pos = 2.9)] | ||
| public delegate void WindowExported (Gdk.Window window, string handle); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.