gtk_filesel patch: Retaining filenames
- From: Lars Clausen <lrclause cs uiuc edu>
- To: gtk-devel-list gnome org
- Subject: gtk_filesel patch: Retaining filenames
- Date: 18 Oct 2000 16:09:03 -0500
Attached is a patch to gtk_filesel.c that makes the file selector retain
the filename when traversing directories. This is much preferable to the
current behaviour, especially when saving files. More will be forthcoming.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause) | Hårdgrim of Numenor
"I do not agree with a word that you say, but I | Retainer of Sir Kegg
will defend to the death your right to say it." | of Westfield
--Evelyn Beatrice Hall paraphrasing Voltaire | Chaos Berserker of Khorne
===File ~/src/GTK/gtk_filesel_keep_filename.diff===
diff -bBur gtk+-1.2.8-orig/gtk/gtkfilesel.c gtk+-1.2.8/gtk/gtkfilesel.c
--- gtk+-1.2.8-orig/gtk/gtkfilesel.c Wed Oct 18 15:05:25 2000
+++ gtk+-1.2.8/gtk/gtkfilesel.c Wed Oct 18 15:05:15 2000
@@ -1281,11 +1281,16 @@
break;
default:
+ /*
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ */
break;
}
else
+ gtk_file_selection_populate (fs, filename, FALSE);
+ /*
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ */
g_free (filename);
}
@@ -1431,8 +1436,22 @@
}
else
{
+ if (fs->selection_entry) {
+ gchar * basename;
+ basename = g_basename(gtk_entry_get_text(GTK_ENTRY(fs->selection_entry)));
+ if (basename == NULL) {
+ g_print("NULL basename");
+ } else if (basename != gtk_entry_get_text(GTK_ENTRY(fs->selection_entry))) {
+ basename = strdup(basename);
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), basename);
+ g_free(basename);
+ }
+ }
+
+ /*
if (fs->selection_entry)
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
+ */
}
if (!did_recurse)
diff -bBur gtk+-1.2.8-orig/gtk/gtkfilesel.c.orig gtk+-1.2.8/gtk/gtkfilesel.c.orig
--- gtk+-1.2.8-orig/gtk/gtkfilesel.c.orig Wed Oct 18 15:04:43 2000
+++ gtk+-1.2.8/gtk/gtkfilesel.c.orig Tue Oct 17 15:55:37 2000
@@ -1320,11 +1320,16 @@
break;
default:
+ /*
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ */
break;
}
else
+ gtk_file_selection_populate (fs, filename, FALSE);
+ /*
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
+ */
g_free (filename);
}
@@ -1470,8 +1475,22 @@
}
else
{
+ if (fs->selection_entry) {
+ gchar * basename;
+ basename = g_basename(gtk_entry_get_text(GTK_ENTRY(fs->selection_entry)));
+ if (basename == NULL) {
+ g_print("NULL basename");
+ } else if (basename != gtk_entry_get_text(GTK_ENTRY(fs->selection_entry))) {
+ basename = strdup(basename);
+ gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), basename);
+ g_free(basename);
+ }
+ }
+
+ /*
if (fs->selection_entry)
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
+ */
}
if (!did_recurse)
============================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]