[gtk+/filechooserentry: 9/53] filechooserentry: Make the filesystem a construct-only argument



commit a60ccee3a52593b74e66e2e3a5facfb3896a589c
Author: Benjamin Otte <otte redhat com>
Date:   Thu Nov 3 15:12:17 2011 +0100

    filechooserentry: Make the filesystem a construct-only argument
    
    This allows simplifications in the code.

 gtk/gtkfilechooserdefault.c |    4 +---
 gtk/gtkfilechooserentry.c   |   30 ++++++------------------------
 gtk/gtkfilechooserentry.h   |    5 ++---
 3 files changed, 9 insertions(+), 30 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index f4b099f..2a5ba7c 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -4562,10 +4562,8 @@ static void
 location_entry_create (GtkFileChooserDefault *impl)
 {
   if (!impl->location_entry)
-    impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+    impl->location_entry = _gtk_file_chooser_entry_new (impl->file_system, TRUE);
 
-  _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
-					   impl->file_system);
   _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
   _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
   gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index ec5e58a..6e74130 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -1746,6 +1746,7 @@ delete_text_callback (GtkFileChooserEntry *chooser_entry,
 
 /**
  * _gtk_file_chooser_entry_new:
+ * @filesystem: The #GtkFileSystem to use
  * @eat_tabs: If %FALSE, allow focus navigation with the tab key.
  *
  * Creates a new #GtkFileChooserEntry object. #GtkFileChooserEntry
@@ -1756,40 +1757,21 @@ delete_text_callback (GtkFileChooserEntry *chooser_entry,
  * Return value: the newly created #GtkFileChooserEntry
  **/
 GtkWidget *
-_gtk_file_chooser_entry_new (gboolean eat_tabs)
+_gtk_file_chooser_entry_new (GtkFileSystem *file_system,
+                             gboolean       eat_tabs)
 {
   GtkFileChooserEntry *chooser_entry;
 
+  g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), NULL);
+
   chooser_entry = g_object_new (GTK_TYPE_FILE_CHOOSER_ENTRY, NULL);
+  chooser_entry->file_system = g_object_ref (file_system);
   chooser_entry->eat_tabs = (eat_tabs != FALSE);
 
   return GTK_WIDGET (chooser_entry);
 }
 
 /**
- * _gtk_file_chooser_entry_set_file_system:
- * @chooser_entry: a #GtkFileChooser
- * @file_system: an object implementing #GtkFileSystem
- *
- * Sets the file system for @chooser_entry.
- **/
-void
-_gtk_file_chooser_entry_set_file_system (GtkFileChooserEntry *chooser_entry,
-					 GtkFileSystem       *file_system)
-{
-  g_return_if_fail (GTK_IS_FILE_CHOOSER_ENTRY (chooser_entry));
-  g_return_if_fail (GTK_IS_FILE_SYSTEM (file_system));
-
-  if (file_system != chooser_entry->file_system)
-    {
-      if (chooser_entry->file_system)
-	g_object_unref (chooser_entry->file_system);
-
-      chooser_entry->file_system = g_object_ref (file_system);
-    }
-}
-
-/**
  * _gtk_file_chooser_entry_set_base_folder:
  * @chooser_entry: a #GtkFileChooserEntry
  * @file: file for a folder in the chooser entries current file system.
diff --git a/gtk/gtkfilechooserentry.h b/gtk/gtkfilechooserentry.h
index a9c9f83..0c812d3 100644
--- a/gtk/gtkfilechooserentry.h
+++ b/gtk/gtkfilechooserentry.h
@@ -33,12 +33,11 @@ G_BEGIN_DECLS
 typedef struct _GtkFileChooserEntry      GtkFileChooserEntry;
 
 GType              _gtk_file_chooser_entry_get_type           (void) G_GNUC_CONST;
-GtkWidget *        _gtk_file_chooser_entry_new                (gboolean eat_tab);
+GtkWidget *        _gtk_file_chooser_entry_new                (GtkFileSystem       *file_system,
+                                                               gboolean             eat_tab);
 void               _gtk_file_chooser_entry_set_action         (GtkFileChooserEntry *chooser_entry,
 							       GtkFileChooserAction action);
 GtkFileChooserAction _gtk_file_chooser_entry_get_action       (GtkFileChooserEntry *chooser_entry);
-void               _gtk_file_chooser_entry_set_file_system    (GtkFileChooserEntry *chooser_entry,
-							       GtkFileSystem       *file_system);
 void               _gtk_file_chooser_entry_set_base_folder    (GtkFileChooserEntry *chooser_entry,
 							       GFile               *folder);
 void               _gtk_file_chooser_entry_set_file_part      (GtkFileChooserEntry *chooser_entry,



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