[gtk/wip/ebassi/filechooser-new: 50/55] Remove GtkFileChooser:show-hidden



commit 516eab5c4374189600a19499d8f7db659d1157b2
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Feb 21 16:28:31 2020 +0000

    Remove GtkFileChooser:show-hidden
    
    This is a user setting and a user action, not something that ought to be
    programmatically set via the file selection API.

 docs/reference/gtk/gtk4-sections.txt |  2 --
 gtk/gtkfilechooser.c                 | 45 ------------------------------------
 gtk/gtkfilechooser.h                 |  6 -----
 gtk/gtkfilechooserbutton.c           |  2 --
 gtk/gtkfilechoosernativequartz.c     |  9 --------
 gtk/gtkfilechoosernativewin32.c      |  7 ------
 gtk/gtkfilechooserutils.c            |  3 ---
 gtk/gtkfilechooserutils.h            |  1 -
 gtk/gtkfilechooserwidget.c           | 17 +++-----------
 9 files changed, 3 insertions(+), 89 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 8c543b8461..726c7829f0 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -1132,8 +1132,6 @@ gtk_file_chooser_set_local_only
 gtk_file_chooser_get_local_only
 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_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 1ed35dcfdc..dc72b5b8fa 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -281,14 +281,6 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
                                                              FALSE,
                                                              GTK_PARAM_READWRITE));
 
-  g_object_interface_install_property (iface,
-                                       g_param_spec_boolean ("show-hidden",
-                                                             P_("Show Hidden"),
-                                                             P_("Whether the hidden files and folders should 
be displayed"),
-                                                             FALSE,
-                                                             GTK_PARAM_READWRITE));
-
-
   /**
    * GtkFileChooser:create-folders:
    * 
@@ -1095,43 +1087,6 @@ gtk_file_chooser_list_shortcut_folders (GtkFileChooser *chooser)
   return GTK_FILE_CHOOSER_GET_IFACE (chooser)->list_shortcut_folders (chooser);
 }
 
-/**
- * gtk_file_chooser_set_show_hidden:
- * @chooser: a #GtkFileChooser
- * @show_hidden: %TRUE if hidden files and folders should be displayed.
- * 
- * Sets whether hidden files and folders are displayed in the file selector.  
- **/
-void
-gtk_file_chooser_set_show_hidden (GtkFileChooser *chooser,
-                                  gboolean        show_hidden)
-{
-  g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
-
-  g_object_set (chooser, "show-hidden", show_hidden, NULL);
-}
-
-/**
- * gtk_file_chooser_get_show_hidden:
- * @chooser: a #GtkFileChooser
- * 
- * Gets whether hidden files and folders are displayed in the file selector.   
- * See gtk_file_chooser_set_show_hidden().
- * 
- * Returns: %TRUE if hidden files and folders are displayed.
- **/
-gboolean
-gtk_file_chooser_get_show_hidden (GtkFileChooser *chooser)
-{
-  gboolean show_hidden;
-  
-  g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
-
-  g_object_get (chooser, "show-hidden", &show_hidden, NULL);
-
-  return show_hidden;
-}
-
 /**
  * gtk_file_chooser_add_choice:
  * @chooser: a #GtkFileChooser
diff --git a/gtk/gtkfilechooser.h b/gtk/gtkfilechooser.h
index f0ae6e48de..79589ee5d4 100644
--- a/gtk/gtkfilechooser.h
+++ b/gtk/gtkfilechooser.h
@@ -108,12 +108,6 @@ void                 gtk_file_chooser_set_select_multiple (GtkFileChooser
                                                           gboolean              select_multiple);
 GDK_AVAILABLE_IN_ALL
 gboolean             gtk_file_chooser_get_select_multiple (GtkFileChooser       *chooser);
-GDK_AVAILABLE_IN_ALL
-void                 gtk_file_chooser_set_show_hidden     (GtkFileChooser       *chooser,
-                                                          gboolean              show_hidden);
-GDK_AVAILABLE_IN_ALL
-gboolean             gtk_file_chooser_get_show_hidden     (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 457ed148d3..19e29efd03 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -925,7 +925,6 @@ gtk_file_chooser_button_set_property (GObject      *object,
     case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
     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_CREATE_FOLDERS:
       g_object_set_property (G_OBJECT (priv->chooser), pspec->name, value);
       break;
@@ -970,7 +969,6 @@ gtk_file_chooser_button_get_property (GObject    *object,
     case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
     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_CREATE_FOLDERS:
       g_object_get_property (G_OBJECT (priv->chooser), pspec->name, value);
       break;
diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c
index 8e4c4c819e..168943f5c7 100644
--- a/gtk/gtkfilechoosernativequartz.c
+++ b/gtk/gtkfilechoosernativequartz.c
@@ -55,7 +55,6 @@ typedef struct {
   gboolean create_folders;
   gboolean modal;
   gboolean select_multiple;
-  gboolean show_hidden;
   gboolean running;
 
   char *accept_label;
@@ -265,11 +264,6 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
 
   [data->panel setReleasedWhenClosed:YES];
 
-  if (data->show_hidden)
-    {
-      [data->panel setShowsHiddenFiles:YES];
-    }
-
   if (data->accept_label)
     [data->panel setPrompt:[NSString stringWithUTF8String:data->accept_label]];
 
@@ -506,9 +500,6 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self)
       gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (self->dialog)))
     data->select_multiple = TRUE;
 
-  if (gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (self->dialog)))
-    data->show_hidden = TRUE;
-
   transient_for = gtk_native_dialog_get_transient_for (GTK_NATIVE_DIALOG (self));
   if (transient_for)
     {
diff --git a/gtk/gtkfilechoosernativewin32.c b/gtk/gtkfilechoosernativewin32.c
index 75e9c56ca0..5044ca498e 100644
--- a/gtk/gtkfilechoosernativewin32.c
+++ b/gtk/gtkfilechoosernativewin32.c
@@ -62,7 +62,6 @@ typedef struct {
   gboolean folder;
   gboolean modal;
   gboolean select_multiple;
-  gboolean show_hidden;
 
   char *accept_label;
   char *cancel_label;
@@ -496,9 +495,6 @@ filechooser_win32_thread (gpointer _data)
   if (data->select_multiple)
     flags |= FOS_ALLOWMULTISELECT;
 
-  if (data->show_hidden)
-    flags |= FOS_FORCESHOWHIDDEN;
-
   flags |= FOS_OVERWRITEPROMPT;
 
   hr = IFileDialog_SetOptions (pfd, flags);
@@ -923,9 +919,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_show_hidden (GTK_FILE_CHOOSER (self->dialog)))
-    data->show_hidden = TRUE;
-
   transient_for = gtk_native_dialog_get_transient_for (GTK_NATIVE_DIALOG (self));
   if (transient_for)
     {
diff --git a/gtk/gtkfilechooserutils.c b/gtk/gtkfilechooserutils.c
index cf9caff887..571a02f084 100644
--- a/gtk/gtkfilechooserutils.c
+++ b/gtk/gtkfilechooserutils.c
@@ -115,9 +115,6 @@ _gtk_file_chooser_install_properties (GObjectClass *klass)
   g_object_class_override_property (klass,
                                    GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
                                    "select-multiple");
-  g_object_class_override_property (klass,
-                                   GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,
-                                   "show-hidden");
   g_object_class_override_property (klass,
                                    GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS,
                                    "create-folders");
diff --git a/gtk/gtkfilechooserutils.h b/gtk/gtkfilechooserutils.h
index 3cb8fcde7d..4de4c6a44e 100644
--- a/gtk/gtkfilechooserutils.h
+++ b/gtk/gtkfilechooserutils.h
@@ -35,7 +35,6 @@ typedef enum {
   GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE,
   GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL,
   GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
-  GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,
   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 1c3bb32b97..fe71728ddf 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -364,7 +364,6 @@ struct _GtkFileChooserWidgetPrivate {
   guint use_preview_label : 1;
   guint select_multiple : 1;
   guint show_hidden : 1;
-  guint show_hidden_set : 1;
   guint sort_directories_first : 1;
   guint show_time : 1;
   guint list_sort_ascending : 1;
@@ -3331,11 +3330,6 @@ gtk_file_chooser_widget_set_property (GObject      *object,
       }
       break;
 
-    case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
-      priv->show_hidden_set = TRUE;
-      set_show_hidden (impl, g_value_get_boolean (value));
-      break;
-
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       {
         gboolean create_folders = g_value_get_boolean (value);
@@ -3397,10 +3391,6 @@ gtk_file_chooser_widget_get_property (GObject    *object,
       g_value_set_boolean (value, priv->select_multiple);
       break;
 
-    case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
-      g_value_set_boolean (value, priv->show_hidden);
-      break;
-
     case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
       g_value_set_boolean (value, priv->create_folders);
       break;
@@ -3651,8 +3641,8 @@ settings_load (GtkFileChooserWidget *impl)
   date_format = g_settings_get_enum (settings, SETTINGS_KEY_DATE_FORMAT);
   type_format = g_settings_get_enum (settings, SETTINGS_KEY_TYPE_FORMAT);
 
-  if (!priv->show_hidden_set)
-    set_show_hidden (impl, show_hidden);
+  set_show_hidden (impl, show_hidden);
+
   priv->show_size_column = show_size_column;
   gtk_tree_view_column_set_visible (priv->list_size_column, show_size_column);
   priv->show_type_column = show_type_column;
@@ -3694,8 +3684,7 @@ settings_save (GtkFileChooserWidget *impl)
   /* All the other state */
 
   g_settings_set_enum (settings, SETTINGS_KEY_LOCATION_MODE, priv->location_mode);
-  g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_HIDDEN,
-                          gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (impl)));
+  g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_HIDDEN, priv->show_hidden);
   g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN, priv->show_size_column);
   g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_TYPE_COLUMN, priv->show_type_column);
   g_settings_set_boolean (settings, SETTINGS_KEY_SORT_DIRECTORIES_FIRST, priv->sort_directories_first);


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