[xdg-desktop-portal-gnome] Revert non-interactive screenshot commits



commit 4d37c707e680f0c778e28bd0fb5eb6a68fd1cba1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Aug 8 17:20:45 2022 -0300

    Revert non-interactive screenshot commits

 src/screenshot.c       | 31 +------------------------------
 src/screenshotdialog.c | 28 ++++++----------------------
 src/screenshotdialog.h |  1 -
 3 files changed, 7 insertions(+), 53 deletions(-)
---
diff --git a/src/screenshot.c b/src/screenshot.c
index 1dca27d..73314b6 100644
--- a/src/screenshot.c
+++ b/src/screenshot.c
@@ -39,8 +39,6 @@ typedef struct {
   const char *retval;
 } ScreenshotDialogHandle;
 
-static uint32_t screenshot_portal_version = 0;
-
 static void
 screenshot_dialog_handle_free (gpointer data)
 {
@@ -192,10 +190,7 @@ handle_screenshot (XdpImplScreenshot *object,
                               NULL);
   g_object_ref_sink (fake_parent);
 
-  dialog = GTK_WINDOW (screenshot_dialog_new (arg_app_id,
-                                              screenshot_portal_version,
-                                              interactive,
-                                              shell));
+  dialog = GTK_WINDOW (screenshot_dialog_new (arg_app_id, interactive, shell));
   gtk_window_set_transient_for (dialog, GTK_WINDOW (fake_parent));
   gtk_window_set_modal (dialog, modal);
 
@@ -299,8 +294,6 @@ gboolean
 screenshot_init (GDBusConnection *bus,
                  GError **error)
 {
-  g_autoptr(GVariant) version_variant = NULL;
-  g_autoptr(GVariant) result = NULL;
   GDBusInterfaceSkeleton *helper;
 
   helper = G_DBUS_INTERFACE_SKELETON (xdp_impl_screenshot_skeleton_new ());
@@ -323,28 +316,6 @@ screenshot_init (GDBusConnection *bus,
   if (shell == NULL)
     return FALSE;
 
-  result = g_dbus_connection_call_sync (bus,
-                                        "org.freedesktop.portal.Desktop",
-                                        "/org/freedesktop/portal/desktop",
-                                        "org.freedesktop.DBus.Properties",
-                                        "Get",
-                                        g_variant_new ("(ss)", "org.freedesktop.portal.Screenshot", 
"version"),
-                                        G_VARIANT_TYPE ("(v)"),
-                                        G_DBUS_CALL_FLAGS_NO_AUTO_START,
-                                        -1,
-                                        NULL,
-                                        error);
-
-  version_variant = g_variant_get_child_value (result, 0);
-
-  if (!version_variant)
-    return FALSE;
-
-  g_variant_get_child (version_variant, 0, "u", &screenshot_portal_version);
-
-  if (screenshot_portal_version == 0)
-    return FALSE;
-
   g_debug ("providing %s", g_dbus_interface_skeleton_get_info (helper)->name);
 
   return TRUE;
diff --git a/src/screenshotdialog.c b/src/screenshotdialog.c
index b42251c..6dd6790 100644
--- a/src/screenshotdialog.c
+++ b/src/screenshotdialog.c
@@ -32,7 +32,6 @@ struct _ScreenshotDialog {
 
   OrgGnomeShellScreenshot *shell;
   GCancellable *cancellable;
-  gboolean skip_dialog;
 };
 
 struct _ScreenshotDialogClass {
@@ -137,22 +136,6 @@ show_screenshot (ScreenshotDialog *dialog,
   gtk_stack_set_visible_child_name (GTK_STACK (dialog->header_stack), "screenshot");
 }
 
-static void
-maybe_show_screenshot (ScreenshotDialog *dialog,
-                       const char       *filename)
-{
-  if (dialog->skip_dialog)
-    {
-      gtk_widget_hide (GTK_WIDGET (dialog));
-      g_signal_emit (dialog, signals[DONE], 0, GTK_RESPONSE_OK, filename);
-    }
-  else
-    {
-      show_screenshot (dialog, filename);
-      gtk_widget_show (GTK_WIDGET (dialog));
-    }
-}
-
 static void
 screenshot_done (GObject *source,
                  GAsyncResult *result,
@@ -173,7 +156,8 @@ screenshot_done (GObject *source,
       return;
     }
 
-  maybe_show_screenshot (dialog, filename);
+  show_screenshot (dialog, filename);
+  gtk_widget_show (GTK_WIDGET (dialog));
 }
 
 static void
@@ -196,7 +180,8 @@ screenshot_window_done (GObject *source,
       return;
     }
 
-  maybe_show_screenshot (dialog, filename);
+  show_screenshot (dialog, filename);
+  gtk_widget_show (GTK_WIDGET (dialog));
 }
 
 static void
@@ -219,7 +204,8 @@ screenshot_area_done (GObject *source,
       return;
     }
 
-  maybe_show_screenshot (dialog, filename);
+  show_screenshot (dialog, filename);
+  gtk_widget_show (GTK_WIDGET (dialog));
 }
 
 
@@ -416,7 +402,6 @@ screenshot_dialog_class_init (ScreenshotDialogClass *class)
 
 ScreenshotDialog *
 screenshot_dialog_new (const char *app_id,
-                       uint32_t screenshot_portal_version,
                        gboolean interactive,
                        OrgGnomeShellScreenshot *shell)
 {
@@ -441,7 +426,6 @@ screenshot_dialog_new (const char *app_id,
   gtk_label_set_label (GTK_LABEL (dialog->heading), heading);
 
   dialog->shell = g_object_ref (shell);
-  dialog->skip_dialog = screenshot_portal_version >= 3 && !interactive;
 
   if (interactive)
     show_options (dialog);
diff --git a/src/screenshotdialog.h b/src/screenshotdialog.h
index 98b336c..9cf7a8f 100644
--- a/src/screenshotdialog.h
+++ b/src/screenshotdialog.h
@@ -8,6 +8,5 @@ typedef struct _ScreenshotDialog ScreenshotDialog;
 typedef struct _ScreenshotDialogClass ScreenshotDialogClass;
 
 ScreenshotDialog * screenshot_dialog_new (const char *app_id,
-                                          uint32_t screenshot_portal_version,
                                           gboolean interactive,
                                           OrgGnomeShellScreenshot *shell);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]