[gtk/wip/ebassi/filechooser-new: 49/55] Remove overwrite confirmation machinery from GtkFileChooser



commit 063ad28b1a06328e14ed72cc4b99cd4684efed12
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Feb 21 15:52:47 2020 +0000

    Remove overwrite confirmation machinery from GtkFileChooser
    
    Overwrite confirmation should not be optional, and it should not loop
    into application code to create their own dialog and user response.

 demos/node-editor/node-editor-window.c |   2 -
 docs/reference/gtk/gtk4-sections.txt   |   2 -
 gtk/gtkfilechooser.c                   | 157 ---------------------------------
 gtk/gtkfilechooser.h                   |  28 ------
 gtk/gtkfilechooserbutton.c             |   2 -
 gtk/gtkfilechooserdialog.c             |   2 -
 gtk/gtkfilechoosernative.c             |   3 -
 gtk/gtkfilechoosernativequartz.c       |   5 --
 gtk/gtkfilechoosernativewin32.c        |   9 +-
 gtk/gtkfilechooserprivate.h            |   1 -
 gtk/gtkfilechooserutils.c              |  17 ----
 gtk/gtkfilechooserutils.h              |   1 -
 gtk/gtkfilechooserwidget.c             |  65 +++-----------
 gtk/gtkprinteroptionwidget.c           |   3 -
 gtk/inspector/css-editor.c             |   1 -
 gtk/inspector/recorder.c               |   1 -
 tests/testfilechooser.c                |  51 -----------
 tests/testgtk.c                        |  13 ---
 18 files changed, 15 insertions(+), 348 deletions(-)
---
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index 3bb2318654..491b956c41 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -461,7 +461,6 @@ save_cb (GtkWidget        *button,
 
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
 
   GFile *cwd = g_file_new_for_path (".");
   gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
@@ -583,7 +582,6 @@ export_image_cb (GtkWidget        *button,
 
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
   g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture);
   gtk_widget_show (dialog);
 }
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 59c45962a7..8c543b8461 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1134,8 +1134,6 @@ gtk_file_chooser_set_select_multiple
 gtk_file_chooser_get_select_multiple
 gtk_file_chooser_set_show_hidden
 gtk_file_chooser_get_show_hidden
-gtk_file_chooser_set_do_overwrite_confirmation
-gtk_file_chooser_get_do_overwrite_confirmation
 gtk_file_chooser_set_create_folders
 gtk_file_chooser_get_create_folders
 gtk_file_chooser_set_current_name
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c
index bf1544509f..1ed35dcfdc 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -132,22 +132,6 @@
 typedef GtkFileChooserIface GtkFileChooserInterface;
 G_DEFINE_INTERFACE (GtkFileChooser, gtk_file_chooser, G_TYPE_OBJECT);
 
-static gboolean
-confirm_overwrite_accumulator (GSignalInvocationHint *ihint,
-                               GValue                *return_accu,
-                               const GValue          *handler_return,
-                               gpointer               dummy)
-{
-  gboolean continue_emission;
-  GtkFileChooserConfirmation conf;
-
-  conf = g_value_get_enum (handler_return);
-  g_value_set_enum (return_accu, conf);
-  continue_emission = (conf == GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM);
-
-  return continue_emission;
-}
-
 static void
 gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
 {
@@ -253,84 +237,6 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
                 NULL,
                 G_TYPE_NONE, 0);
 
-  /**
-   * GtkFileChooser::confirm-overwrite:
-   * @chooser: the object which received the signal.
-   *
-   * This signal gets emitted whenever it is appropriate to present a
-   * confirmation dialog when the user has selected a file name that
-   * already exists.  The signal only gets emitted when the file
-   * chooser is in %GTK_FILE_CHOOSER_ACTION_SAVE mode.
-   *
-   * Most applications just need to turn on the
-   * #GtkFileChooser:do-overwrite-confirmation property (or call the
-   * gtk_file_chooser_set_do_overwrite_confirmation() function), and
-   * they will automatically get a standard confirmation dialog.
-   * Applications which need to customize this behavior should do
-   * that, and also connect to the #GtkFileChooser::confirm-overwrite
-   * signal.
-   *
-   * A signal handler for this signal must return a
-   * #GtkFileChooserConfirmation value, which indicates the action to
-   * take.  If the handler determines that the user wants to select a
-   * different filename, it should return
-   * %GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN.  If it determines
-   * that the user is satisfied with his choice of file name, it
-   * should return %GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME.
-   * On the other hand, if it determines that the standard confirmation
-   * dialog should be used, it should return
-   * %GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example
-   * illustrates this.
-   *
-   * ## Custom confirmation ## {#gtkfilechooser-confirmation}
-   *
-   * |[<!-- language="C" -->
-   * static GtkFileChooserConfirmation
-   * confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data)
-   * {
-   *   g_autoptr(GFile) file = gtk_file_chooser_get_file (chooser);
-   *
-   *   // file_is_read_only() is defined elsewhere
-   *   if (file_is_read_only (file))
-   *     {
-   *       // user_wants_to_replace_read_only_file() is defined elsewhere
-   *       if (user_wants_to_replace_read_only_file (file))
-   *         return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
-   *       else
-   *         return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
-   *     }
-   *   else
-   *     {
-   *       // fall back to the default dialog
-   *       return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM;
-   *     }
-   * }
-   *
-   * ...
-   *
-   * chooser = gtk_file_chooser_dialog_new (...);
-   *
-   * gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
-   * g_signal_connect (chooser, "confirm-overwrite",
-   *                   G_CALLBACK (confirm_overwrite_callback), NULL);
-   *
-   * if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
-   *   save_to_file (gtk_file_chooser_get_file (GTK_FILE_CHOOSER (chooser));
-   *
-   * gtk_widget_destroy (chooser);
-   * ]|
-   *
-   * Returns: a #GtkFileChooserConfirmation value that indicates which
-   *  action to take after emitting the signal.
-   */
-  g_signal_new (I_("confirm-overwrite"),
-                iface_type,
-                G_SIGNAL_RUN_LAST,
-                G_STRUCT_OFFSET (GtkFileChooserIface, confirm_overwrite),
-                confirm_overwrite_accumulator, NULL,
-                _gtk_marshal_ENUM__VOID,
-                GTK_TYPE_FILE_CHOOSER_CONFIRMATION, 0);
-  
   g_object_interface_install_property (iface,
                                        g_param_spec_enum ("action",
                                                           P_("Action"),
@@ -382,21 +288,6 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
                                                              FALSE,
                                                              GTK_PARAM_READWRITE));
 
-  /**
-   * GtkFileChooser:do-overwrite-confirmation:
-   * 
-   * Whether a file chooser in %GTK_FILE_CHOOSER_ACTION_SAVE mode
-   * will present an overwrite confirmation dialog if the user
-   * selects a file name that already exists.
-   */
-  g_object_interface_install_property (iface,
-                                       g_param_spec_boolean ("do-overwrite-confirmation",
-                                                             P_("Do overwrite confirmation"),
-                                                             P_("Whether a file chooser in save mode "
-                                                                "will present an overwrite confirmation 
dialog "
-                                                                "if necessary."),
-                                                             FALSE,
-                                                             GTK_PARAM_READWRITE));
 
   /**
    * GtkFileChooser:create-folders:
@@ -1241,54 +1132,6 @@ gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser)
   return show_hidden;
 }
 
-/**
- * gtk_file_chooser_set_do_overwrite_confirmation:
- * @chooser: a #GtkFileChooser
- * @do_overwrite_confirmation: whether to confirm overwriting in save mode
- * 
- * Sets whether a file chooser in %GTK_FILE_CHOOSER_ACTION_SAVE mode will present
- * a confirmation dialog if the user types a file name that already exists.  This
- * is %FALSE by default.
- *
- * If set to %TRUE, the @chooser will emit the
- * #GtkFileChooser::confirm-overwrite signal when appropriate.
- *
- * If all you need is the standard confirmation dialog, set this property to %TRUE.
- * You can override the way confirmation is done by actually handling the
- * #GtkFileChooser::confirm-overwrite signal; please refer to its documentation
- * for the details.
- **/
-void
-gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser,
-                                                gboolean        do_overwrite_confirmation)
-{
-  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
-
-  g_object_set (chooser, "do-overwrite-confirmation", do_overwrite_confirmation, NULL);
-}
-
-/**
- * gtk_file_chooser_get_do_overwrite_confirmation:
- * @chooser: a #GtkFileChooser
- * 
- * Queries whether a file chooser is set to confirm for overwriting when the user
- * types a file name that already exists.
- * 
- * Returns: %TRUE if the file chooser will present a confirmation dialog;
- * %FALSE otherwise.
- **/
-gboolean
-gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser)
-{
-  gboolean do_overwrite_confirmation;
-
-  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
-
-  g_object_get (chooser, "do-overwrite-confirmation", &do_overwrite_confirmation, NULL);
-
-  return do_overwrite_confirmation;
-}
-
 /**
  * gtk_file_chooser_add_choice:
  * @chooser: a #GtkFileChooser
diff --git a/gtk/gtkfilechooser.h b/gtk/gtkfilechooser.h
index ea684d6715..f0ae6e48de 100644
--- a/gtk/gtkfilechooser.h
+++ b/gtk/gtkfilechooser.h
@@ -59,28 +59,6 @@ typedef enum
   GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
 } GtkFileChooserAction;
 
-/**
- * GtkFileChooserConfirmation:
- * @GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM: The file chooser will present
- *  its stock dialog to confirm about overwriting an existing file.
- * @GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME: The file chooser will
- *  terminate and accept the user’s choice of a file name.
- * @GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN: The file chooser will
- *  continue running, so as to let the user select another file name.
- *
- * Used as a return value of handlers for the
- * #GtkFileChooser::confirm-overwrite signal of a #GtkFileChooser. This
- * value determines whether the file chooser will present the stock
- * confirmation dialog, accept the user’s choice of a filename, or
- * let the user choose another filename.
- */
-typedef enum
-{
-  GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM,
-  GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME,
-  GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN
-} GtkFileChooserConfirmation;
-
 GDK_AVAILABLE_IN_ALL
 GType gtk_file_chooser_get_type (void) G_GNUC_CONST;
 
@@ -136,12 +114,6 @@ void                 gtk_file_chooser_set_show_hidden     (GtkFileChooser
 GDK_AVAILABLE_IN_ALL
 gboolean             gtk_file_chooser_get_show_hidden     (GtkFileChooser       *chooser);
 
-GDK_AVAILABLE_IN_ALL
-void                 gtk_file_chooser_set_do_overwrite_confirmation (GtkFileChooser *chooser,
-                                                                    gboolean        
do_overwrite_confirmation);
-GDK_AVAILABLE_IN_ALL
-gboolean             gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser);
-
 GDK_AVAILABLE_IN_ALL
 void                 gtk_file_chooser_set_create_folders  (GtkFileChooser       *chooser,
                                                          gboolean               create_folders);
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 03e46ab791..457ed148d3 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -926,7 +926,6 @@ gtk_file_chooser_button_set_property (GObject      *object,
     case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
     case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
     case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
-    case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       g_object_set_property (G_OBJECT (priv->chooser), pspec->name, value);
       break;
@@ -972,7 +971,6 @@ gtk_file_chooser_button_get_property (GObject    *object,
     case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
     case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
     case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
-    case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       g_object_get_property (G_OBJECT (priv->chooser), pspec->name, value);
       break;
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 729ae82668..3cee274628 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -111,8 +111,6 @@
  *                                       NULL);
  * chooser = GTK_FILE_CHOOSER (dialog);
  *
- * gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
- *
  * if (user_edited_a_new_document)
  *   gtk_file_chooser_set_current_name (chooser, _("Untitled document"));
  * else
diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c
index c08c84fd54..7a94813802 100644
--- a/gtk/gtkfilechoosernative.c
+++ b/gtk/gtkfilechoosernative.c
@@ -105,8 +105,6 @@
  *                                       "_Cancel");
  * chooser = GTK_FILE_CHOOSER (native);
  *
- * gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
- *
  * if (user_edited_a_new_document)
  *   gtk_file_chooser_set_current_name (chooser,
  *                                      _("Untitled document"));
@@ -147,7 +145,6 @@
  * * #GtkFileChooser::current-folder-changed
  * * #GtkFileChooser::selection-changed
  * * #GtkFileChooser::file-activated
- * * #GtkFileChooser::confirm-overwrite
  *
  * You can also not use the methods that directly control user navigation:
  * * gtk_file_chooser_unselect_filename()
diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c
index cb2e071a26..8e4c4c819e 100644
--- a/gtk/gtkfilechoosernativequartz.c
+++ b/gtk/gtkfilechoosernativequartz.c
@@ -54,7 +54,6 @@ typedef struct {
   gboolean folder;
   gboolean create_folders;
   gboolean modal;
-  gboolean overwrite_confirmation;
   gboolean select_multiple;
   gboolean show_hidden;
   gboolean running;
@@ -507,10 +506,6 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
       gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (self->dialog)))
     data->select_multiple = TRUE;
 
-  // overwrite confirmation appears to be always on
-  if (gtk_file_chooser_get_do_overwrite_confirmation (GTK_FILE_CHOOSER (self->dialog)))
-    data->overwrite_confirmation = TRUE;
-
   if (gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (self->dialog)))
     data->show_hidden = TRUE;
 
diff --git a/gtk/gtkfilechoosernativewin32.c b/gtk/gtkfilechoosernativewin32.c
index c368f84269..75e9c56ca0 100644
--- a/gtk/gtkfilechoosernativewin32.c
+++ b/gtk/gtkfilechoosernativewin32.c
@@ -61,7 +61,6 @@ typedef struct {
   gboolean save;
   gboolean folder;
   gboolean modal;
-  gboolean overwrite_confirmation;
   gboolean select_multiple;
   gboolean show_hidden;
 
@@ -500,10 +499,7 @@ filechooser_win32_thread (gpointer _data)
   if (data->show_hidden)
     flags |= FOS_FORCESHOWHIDDEN;
 
-  if (data->overwrite_confirmation)
-    flags |= FOS_OVERWRITEPROMPT;
-  else
-    flags &= ~(FOS_OVERWRITEPROMPT);
+  flags |= FOS_OVERWRITEPROMPT;
 
   hr = IFileDialog_SetOptions (pfd, flags);
   if (FAILED (hr))
@@ -927,9 +923,6 @@ gtk_file_chooser_native_win32_show (GtkFileChooserNative *self)
       gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (self->dialog)))
     data->select_multiple = TRUE;
 
-  if (gtk_file_chooser_get_do_overwrite_confirmation (GTK_FILE_CHOOSER (self->dialog)))
-    data->overwrite_confirmation = TRUE;
-
   if (gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (self->dialog)))
     data->show_hidden = TRUE;
 
diff --git a/gtk/gtkfilechooserprivate.h b/gtk/gtkfilechooserprivate.h
index a19b1f6495..c0eeb9f9a0 100644
--- a/gtk/gtkfilechooserprivate.h
+++ b/gtk/gtkfilechooserprivate.h
@@ -94,7 +94,6 @@ struct _GtkFileChooserIface
   void (*selection_changed)      (GtkFileChooser *chooser);
   void (*update_preview)         (GtkFileChooser *chooser);
   void (*file_activated)         (GtkFileChooser *chooser);
-  GtkFileChooserConfirmation (*confirm_overwrite) (GtkFileChooser *chooser);
 
   /* 3.22 additions */
   void           (*add_choice)    (GtkFileChooser *chooser,
diff --git a/gtk/gtkfilechooserutils.c b/gtk/gtkfilechooserutils.c
index 7d39368729..cf9caff887 100644
--- a/gtk/gtkfilechooserutils.c
+++ b/gtk/gtkfilechooserutils.c
@@ -66,8 +66,6 @@ static void           delegate_update_preview         (GtkFileChooser    *choose
 static void           delegate_file_activated         (GtkFileChooser    *chooser,
                                                       gpointer           data);
 
-static GtkFileChooserConfirmation delegate_confirm_overwrite (GtkFileChooser    *chooser,
-                                                             gpointer           data);
 static void           delegate_add_choice             (GtkFileChooser  *chooser,
                                                        const char      *id,
                                                        const char      *label,
@@ -120,9 +118,6 @@ _gtk_file_chooser_install_properties (GObjectClass *klass)
   g_object_class_override_property (klass,
                                    GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,
                                    "show-hidden");
-  g_object_class_override_property (klass,
-                                   GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION,
-                                   "do-overwrite-confirmation");
   g_object_class_override_property (klass,
                                    GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
                                    "create-folders");
@@ -194,8 +189,6 @@ _gtk_file_chooser_set_delegate (GtkFileChooser *receiver,
                    G_CALLBACK (delegate_update_preview), receiver);
   g_signal_connect (delegate, "file-activated",
                    G_CALLBACK (delegate_file_activated), receiver);
-  g_signal_connect (delegate, "confirm-overwrite",
-                   G_CALLBACK (delegate_confirm_overwrite), receiver);
 }
 
 GQuark
@@ -371,16 +364,6 @@ delegate_file_activated (GtkFileChooser    *chooser,
   g_signal_emit_by_name (data, "file-activated");
 }
 
-static GtkFileChooserConfirmation
-delegate_confirm_overwrite (GtkFileChooser    *chooser,
-                           gpointer           data)
-{
-  GtkFileChooserConfirmation conf;
-
-  g_signal_emit_by_name (data, "confirm-overwrite", &conf);
-  return conf;
-}
-
 GSettings *
 _gtk_file_chooser_get_settings_for_widget (GtkWidget *widget)
 {
diff --git a/gtk/gtkfilechooserutils.h b/gtk/gtkfilechooserutils.h
index 9a4e4cbb14..3cb8fcde7d 100644
--- a/gtk/gtkfilechooserutils.h
+++ b/gtk/gtkfilechooserutils.h
@@ -36,7 +36,6 @@ typedef enum {
   GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL,
   GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
   GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,
-  GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION,
   GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
   GTK_FILE_CHOOSER_PROP_LAST                   = GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS
 } GtkFileChooserProp;
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 225c502ba3..1c3bb32b97 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -367,7 +367,6 @@ struct _GtkFileChooserWidgetPrivate {
   guint show_hidden_set : 1;
   guint sort_directories_first : 1;
   guint show_time : 1;
-  guint do_overwrite_confirmation : 1;
   guint list_sort_ascending : 1;
   guint shortcuts_current_folder_active : 1;
   guint show_size_column : 1;
@@ -3337,13 +3336,6 @@ gtk_file_chooser_widget_set_property (GObject      *object,
       set_show_hidden (impl, g_value_get_boolean (value));
       break;
 
-    case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
-      {
-        gboolean do_overwrite_confirmation = g_value_get_boolean (value);
-        priv->do_overwrite_confirmation = do_overwrite_confirmation;
-      }
-      break;
-
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       {
         gboolean create_folders = g_value_get_boolean (value);
@@ -3409,10 +3401,6 @@ gtk_file_chooser_widget_get_property (GObject    *object,
       g_value_set_boolean (value, priv->show_hidden);
       break;
 
-    case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
-      g_value_set_boolean (value, priv->do_overwrite_confirmation);
-      break;
-
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       g_value_set_boolean (value, priv->create_folders);
       break;
@@ -6296,49 +6284,24 @@ should_respond_after_confirm_overwrite (GtkFileChooserWidget *impl,
                                         GFile                *parent_file)
 {
   GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
-  GtkFileChooserConfirmation conf;
-
-  if (!priv->do_overwrite_confirmation)
-    return TRUE;
-
-  conf = GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM;
-
-  g_signal_emit_by_name (impl, "confirm-overwrite", &conf);
-
-  switch (conf)
-    {
-    case GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM:
-      {
-        struct GetDisplayNameData *data;
-
-        g_assert (file_part != NULL);
+  struct GetDisplayNameData *data;
 
-        data = g_new0 (struct GetDisplayNameData, 1);
-        data->impl = g_object_ref (impl);
-        data->file_part = g_strdup (file_part);
+  g_assert (file_part != NULL);
 
-        if (priv->should_respond_get_info_cancellable)
-          g_cancellable_cancel (priv->should_respond_get_info_cancellable);
-
-        priv->should_respond_get_info_cancellable =
-          _gtk_file_system_get_info (priv->file_system, parent_file,
-                                     "standard::display-name",
-                                     confirmation_confirm_get_info_cb,
-                                     data);
-        set_busy_cursor (data->impl, TRUE);
-        return FALSE;
-      }
-
-    case GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME:
-      return TRUE;
+  data = g_new0 (struct GetDisplayNameData, 1);
+  data->impl = g_object_ref (impl);
+  data->file_part = g_strdup (file_part);
 
-    case GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN:
-      return FALSE;
+  if (priv->should_respond_get_info_cancellable)
+    g_cancellable_cancel (priv->should_respond_get_info_cancellable);
 
-    default:
-      g_assert_not_reached ();
-      return FALSE;
-    }
+  priv->should_respond_get_info_cancellable =
+    _gtk_file_system_get_info (priv->file_system, parent_file,
+                               "standard::display-name",
+                               confirmation_confirm_get_info_cb,
+                               data);
+  set_busy_cursor (data->impl, TRUE);
+  return FALSE;
 }
 
 static void
diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c
index 1897e44f24..cdf434bc75 100644
--- a/gtk/gtkprinteroptionwidget.c
+++ b/gtk/gtkprinteroptionwidget.c
@@ -552,9 +552,6 @@ filesave_choose_cb (GtkWidget              *button,
                                         _("_Select"), GTK_RESPONSE_ACCEPT,
                                         NULL);
 
-  /* The confirmation dialog will appear, when the user clicks print */
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), FALSE);
-
   /* select the current filename in the dialog */
   if (priv->source != NULL && priv->source->value != NULL)
     {
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index b0b7ae6997..85028fc7e7 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -251,7 +251,6 @@ save_clicked (GtkButton             *button,
   gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), "custom.css");
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
   g_signal_connect (dialog, "response", G_CALLBACK (save_response), ce);
   gtk_widget_show (dialog);
 }
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index a5412cc8ab..ac8e8d2380 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -1033,7 +1033,6 @@ render_node_save (GtkButton            *button,
   g_free (filename);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
   g_signal_connect (dialog, "response", G_CALLBACK (render_node_save_response), node);
   gtk_widget_show (dialog);
 }
diff --git a/tests/testfilechooser.c b/tests/testfilechooser.c
index cdcffc213d..c1c7b53d9a 100644
--- a/tests/testfilechooser.c
+++ b/tests/testfilechooser.c
@@ -490,55 +490,6 @@ notify_multiple_cb (GtkWidget  *dialog,
   gtk_widget_set_sensitive (button, multiple);
 }
 
-static GtkFileChooserConfirmation
-confirm_overwrite_cb (GtkFileChooser *chooser,
-                     gpointer        data)
-{
-  GtkWidget *dialog;
-  GtkWidget *button;
-  int response;
-  GtkFileChooserConfirmation conf;
-
-  dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (chooser))),
-                                  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                  GTK_MESSAGE_QUESTION,
-                                  GTK_BUTTONS_NONE,
-                                  "What do you want to do?");
-
-  button = gtk_button_new_with_label ("Use the stock confirmation dialog");
-  gtk_widget_show (button);
-  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 1);
-
-  button = gtk_button_new_with_label ("Type a new file name");
-  gtk_widget_show (button);
-  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 2);
-
-  button = gtk_button_new_with_label ("Accept the file name");
-  gtk_widget_show (button);
-  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 3);
-
-  response = gtk_dialog_run (GTK_DIALOG (dialog));
-
-  switch (response)
-    {
-    case 1:
-      conf = GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM;
-      break;
-
-    case 3:
-      conf = GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
-      break;
-
-    default:
-      conf = GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
-      break;
-    }
-
-  gtk_widget_destroy (dialog);
-
-  return conf;
-}
-
 int
 main (int argc, char **argv)
 {
@@ -642,8 +593,6 @@ main (int argc, char **argv)
                    G_CALLBACK (print_current_folder), NULL);
   g_signal_connect (dialog, "response",
                    G_CALLBACK (response_cb), &done);
-  g_signal_connect (dialog, "confirm-overwrite",
-                   G_CALLBACK (confirm_overwrite_cb), NULL);
 
   /* Filters */
   filter = gtk_file_filter_new ();
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 98ee51798c..5e355f2b7b 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5778,14 +5778,6 @@ native_multi_select_toggle (GtkWidget *checkbutton,
                                         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton)));
 }
 
-static void
-native_overwrite_confirmation_toggle (GtkWidget *checkbutton,
-                                      GtkFileChooserNative *native)
-{
-  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (native),
-                                                  gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON(checkbutton)));
-}
-
 static void
 native_visible_notify_show (GObject    *object,
                             GParamSpec *pspec,
@@ -6004,11 +5996,6 @@ create_native_dialogs (GtkWidget *widget)
                         G_CALLBACK (native_multi_select_toggle), native);
       gtk_container_add (GTK_CONTAINER (box), check_button);
 
-      check_button = gtk_check_button_new_with_label ("Confirm overwrite");
-      g_signal_connect (check_button, "toggled",
-                        G_CALLBACK (native_overwrite_confirmation_toggle), native);
-      gtk_container_add (GTK_CONTAINER (box), check_button);
-
       show_button = gtk_button_new_with_label ("Show");
       hide_button = gtk_button_new_with_label ("Hide");
       gtk_widget_set_sensitive (hide_button, FALSE);


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