Default backend fileselector xsetting



This patch adds a default fileselector backend xsetting. This lets e.g.
gnome turn all fileselectors into gnome-vfs ones if installed. This will
work fine for all apps once local_only is implemented.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a leather-clad pirate cop possessed of the uncanny powers of an insect. 
She's a foxy insomniac widow married to the Mob. They fight crime! 
Index: gdk/x11/gdkevents-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
retrieving revision 1.126
diff -u -p -r1.126 gdkevents-x11.c
--- gdk/x11/gdkevents-x11.c	26 Feb 2004 22:53:50 -0000	1.126
+++ gdk/x11/gdkevents-x11.c	1 Mar 2004 16:48:44 -0000
@@ -2632,6 +2632,7 @@ static struct
   { "Net/CursorBlinkTime", "gtk-cursor-blink-time" },
   { "Net/ThemeName", "gtk-theme-name" },
   { "Net/IconThemeName", "gtk-icon-theme-name" },
+  { "Gtk/DefaultFileSelectorBackend", "gtk-default-file-selector-backend" },
   { "Gtk/ButtonImages", "gtk-button-images" },
   { "Gtk/MenuImages", "gtk-menu-images" },
   { "Xft/Antialias", "gtk-xft-antialias" },
Index: gtk/gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.91
diff -u -p -r1.91 gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c	29 Feb 2004 07:55:24 -0000	1.91
+++ gtk/gtkfilechooserdefault.c	1 Mar 2004 16:48:44 -0000
@@ -2050,6 +2050,8 @@ static void
 set_file_system_backend (GtkFileChooserDefault *impl,
 			 const char *backend)
 {
+  char *default_backend;
+  
   if (impl->file_system)
     {
       g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
@@ -2062,6 +2064,16 @@ set_file_system_backend (GtkFileChooserD
   impl->file_system = NULL;
   if (backend)
     impl->file_system = _gtk_file_system_create (backend);
+  else
+    {
+      GtkSettings *settings = gtk_settings_get_default ();
+      
+      default_backend = NULL;
+      g_object_get (settings, "gtk-default-file-selector-backend", &default_backend, NULL);
+      if (default_backend)
+	impl->file_system = _gtk_file_system_create (default_backend);
+      g_free (default_backend);
+    }
 
   if (!impl->file_system)
     {
Index: gtk/gtksettings.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v
retrieving revision 1.49
diff -u -p -r1.49 gtksettings.c
--- gtk/gtksettings.c	26 Feb 2004 20:59:00 -0000	1.49
+++ gtk/gtksettings.c	1 Mar 2004 16:48:45 -0000
@@ -57,6 +57,7 @@ enum {
   PROP_SPLIT_CURSOR,
   PROP_THEME_NAME,
   PROP_ICON_THEME_NAME,
+  PROP_DEFAULT_FILE_SELECTOR_BACKEND,
   PROP_KEY_THEME_NAME,
   PROP_MENU_BAR_ACCEL,
   PROP_DND_DRAG_THRESHOLD,
@@ -312,7 +313,17 @@ gtk_settings_class_init (GtkSettingsClas
 								  "hicolor",
 								  G_PARAM_READWRITE),
                                              NULL);
-  g_assert (result == PROP_ICON_THEME_NAME);    
+  g_assert (result == PROP_ICON_THEME_NAME);
+  
+  result = settings_install_property_parser (class,
+                                             g_param_spec_string ("gtk-default-file-selector-backend",
+								  P_("Default file selector backend"),
+								  P_("This can be used to select a desktop-global default file selector backend, for instance the gnome-vfs one"),
+								  NULL,
+								  G_PARAM_READWRITE),
+					     NULL);
+  g_assert (result == PROP_DEFAULT_FILE_SELECTOR_BACKEND);    
+  
   result = settings_install_property_parser (class,
                                              g_param_spec_string ("gtk-key-theme-name",
 								  P_("Key Theme Name"),


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