patch to remember user theme directory



This patch to gdmsetup.c lets the Graphical Greeter tab remember where
the user last installed a theme from (just for one session). When
installing lots of themes I was annoyed that the file chooser always
went back to the cwd, not the last one selected.

I'm a virgin GTK user so I'm not sure if GTK file chooser has an option
for this already, so the patch just stores the last directory in a
global user_theme_dir.

the patch is attached.

timbo.

--- gdm-2.6.0.5.clean/gui/gdmsetup.c	2004-08-18 20:27:40.000000000 +0100
+++ gdm-2.6.0.5/gui/gdmsetup.c	2004-09-18 08:42:16.903129928 +0100
@@ -58,6 +58,8 @@
 
 static GList *timeout_widgets = NULL;
 
+static gchar *user_theme_dir = NULL;
+
 static void
 simple_spawn_sync (char **argv)
 {
@@ -1915,6 +1917,11 @@
 	theme_dir = get_theme_dir ();
 
 	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+
+	if (user_theme_dir)
+		g_free (user_theme_dir);
+	user_theme_dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (chooser));
+	
 	if (filename == NULL) {
 		GtkWidget *dlg =
 			ve_hig_dialog_new (GTK_WINDOW (chooser),
@@ -2114,6 +2121,9 @@
 	g_signal_connect (G_OBJECT (chooser), "response",
 			  G_CALLBACK (install_response), store);
 
+	if (user_theme_dir)
+		gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), user_theme_dir);
+
 	gtk_widget_show (chooser);
 }
 


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