Blame SOURCES/0026-Use-GtkFileChooserNative-instead-of-GtkFileChooserDi.patch

121cca
From 41c04d1c5ee84b1f42a9fabf7623a98ff02b9bf1 Mon Sep 17 00:00:00 2001
121cca
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
121cca
Date: Fri, 10 Jul 2020 04:37:55 +0200
121cca
Subject: [PATCH 26/65] Use GtkFileChooserNative instead of
121cca
 GtkFileChooserDialog
121cca
121cca
This class allows it to work even in containers.
121cca
---
121cca
 src/gui/engine.cc | 13 ++++++-------
121cca
 1 file changed, 6 insertions(+), 7 deletions(-)
121cca
121cca
diff --git a/src/gui/engine.cc b/src/gui/engine.cc
121cca
index 2d2e58b..21e446e 100644
121cca
--- a/src/gui/engine.cc
121cca
+++ b/src/gui/engine.cc
121cca
@@ -460,7 +460,7 @@ static void redirect_cout(std::ofstream &out, bool enable = true)
121cca
 void save_as(GtkWidget *mainwindow)
121cca
 {
121cca
   struct utsname buf;
121cca
-  GtkWidget *dialog = NULL;
121cca
+  GtkFileChooserNative *dialog = NULL;
121cca
   GtkWidget *sanitize = NULL;
121cca
   GtkFileFilter *filter = NULL;
121cca
   bool proceed = true;
121cca
@@ -469,12 +469,11 @@ void save_as(GtkWidget *mainwindow)
121cca
   if(!computer)		// nothing to save
121cca
     return;
121cca
 
121cca
-  dialog = gtk_file_chooser_dialog_new ("Save hardware configuration",
121cca
+  dialog = gtk_file_chooser_native_new ("Save hardware configuration",
121cca
 				      GTK_WINDOW(mainwindow),
121cca
 				      GTK_FILE_CHOOSER_ACTION_SAVE,
121cca
-				      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
121cca
-				      GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
121cca
-				      NULL);
121cca
+				      "_Save",
121cca
+				      "_Cancel");
121cca
   //gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
121cca
   sanitize = gtk_check_button_new_with_label("Anonymize output");
121cca
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sanitize), enabled("output:sanitize")?TRUE:FALSE);
121cca
@@ -511,7 +510,7 @@ void save_as(GtkWidget *mainwindow)
121cca
   if(uname(&buf)==0)
121cca
     gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), buf.nodename);
121cca
 
121cca
-  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
121cca
+  if (gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
121cca
   {
121cca
     char *filename;
121cca
 
121cca
@@ -603,5 +602,5 @@ void save_as(GtkWidget *mainwindow)
121cca
     }
121cca
   }
121cca
 
121cca
-  gtk_widget_destroy (dialog);
121cca
+  g_object_unref (dialog);
121cca
 }
121cca
-- 
121cca
2.33.1
121cca