Skip to content
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

Add show uri on window patch #12

Merged
merged 3 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions fr-remove-open-with.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/src/ui/menus.ui
+++ b/src/ui/menus.ui
@@ -7,10 +7,6 @@
<attribute name="label" translatable="yes" context="Action">Open</attribute>
<attribute name="action">win.view-selection</attribute>
</item>
- <item>
- <attribute name="label" translatable="yes">_Open With…</attribute>
- <attribute name="action">win.open-with</attribute>
- </item>
</section>
<section>
<item>
90 changes: 90 additions & 0 deletions msandova:show-uri-on-window.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
From a61ea2f32a8c06fd7c9fc25dab49f19a385976bc Mon Sep 17 00:00:00 2001
From: Maximiliano Sandoval R <[email protected]>
Date: Fri, 23 Jul 2021 12:59:34 +0200
Subject: [PATCH] dlg-open-with: Use gtk_show_uri_on_window

Instead of using a GtkAppChooserDialog. gtk_show_uri_on_window works on
Flatpak and sandboxed environments.

Fixes: https://gitlab.gnome.org/GNOME/file-roller/-/issues/105
---
src/dlg-open-with.c | 53 +++++++++++----------------------------------
1 file changed, 13 insertions(+), 40 deletions(-)

diff --git a/src/dlg-open-with.c b/src/dlg-open-with.c
index b797c61d..448fa365 100644
--- a/src/dlg-open-with.c
+++ b/src/dlg-open-with.c
@@ -36,56 +36,29 @@ typedef struct {
} OpenData;


-static void
-app_chooser_response_cb (GtkDialog *dialog,
- int response_id,
- gpointer user_data)
-{
- OpenData *o_data = user_data;
- GAppInfo *app_info;
-
- switch (response_id) {
- case GTK_RESPONSE_OK:
- app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
- if (app_info != NULL) {
- fr_window_open_files_with_application (o_data->window, o_data->file_list, app_info);
- g_object_unref (app_info);
- }
- g_free (o_data);
- gtk_widget_destroy (GTK_WIDGET (dialog));
- break;
-
- case GTK_RESPONSE_CANCEL:
- case GTK_RESPONSE_DELETE_EVENT:
- g_free (o_data);
- gtk_widget_destroy (GTK_WIDGET (dialog));
- break;
-
- default:
- break;
- }
-}
-
-
void
dlg_open_with (FrWindow *window,
GList *file_list)
{
OpenData *o_data;
- GtkWidget *app_chooser;
+ char *uri;
+ GList *scan;
+ GError *error = NULL;

o_data = g_new0 (OpenData, 1);
o_data->window = window;
o_data->file_list = file_list;

- app_chooser = gtk_app_chooser_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL,
- G_FILE (file_list->data));
- g_signal_connect (app_chooser,
- "response",
- G_CALLBACK (app_chooser_response_cb),
- o_data);
- gtk_widget_show (app_chooser);
+ for (scan = file_list; scan; scan = scan->next) {
+ uri = g_file_get_uri (G_FILE (scan->data));
+ if (!gtk_show_uri_on_window (GTK_WINDOW (window), uri, GDK_CURRENT_TIME, &error)) {
+ _gtk_error_dialog_run (GTK_WINDOW (window),
+ _("Could not perform the operation"),
+ "%s",
+ error->message);
+ g_clear_error (&error);
+ }
+ }
}


--
GitLab

8 changes: 8 additions & 0 deletions org.gnome.FileRoller.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@
{
"type": "patch",
"path": "fr-application-prefers-color-scheme.patch"
},
{
"type": "patch",
"path": "msandova:show-uri-on-window.patch"
},
{
"type": "patch",
"path": "fr-remove-open-with.patch"
}
]
},
Expand Down