]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkfilechooserutils.c
filechooserbutton: Do not propagate state from the dialog unless it is active
[~andy/gtk] / gtk / gtkfilechooserutils.c
index 9458abdaba3ddd174f9badb745fd85ad0f1ea437..43148aa9c34654a9f33749f6b70978e18d213d51 100644 (file)
@@ -14,9 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -416,3 +414,30 @@ _gtk_file_chooser_extract_recent_folders (GList *infos)
 
   return result;
 }
+
+GSettings *
+_gtk_file_chooser_get_settings_for_widget (GtkWidget *widget)
+{
+  static GQuark file_chooser_settings_quark = 0;
+  GtkSettings *gtksettings;
+  GSettings *settings;
+
+  if (G_UNLIKELY (file_chooser_settings_quark == 0))
+    file_chooser_settings_quark = g_quark_from_static_string ("-gtk-file-chooser-settings");
+
+  gtksettings = gtk_widget_get_settings (widget);
+  settings = g_object_get_qdata (G_OBJECT (gtksettings), file_chooser_settings_quark);
+
+  if (G_UNLIKELY (settings == NULL))
+    {
+      settings = g_settings_new ("org.gtk.Settings.FileChooser");
+      g_settings_delay (settings);
+
+      g_object_set_qdata_full (G_OBJECT (gtksettings),
+                               file_chooser_settings_quark,
+                               settings,
+                               g_object_unref);
+    }
+
+  return settings;
+}