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

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