[libgda] GdaBrowser: remember last visited directory
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] GdaBrowser: remember last visited directory
- Date: Fri, 18 Sep 2009 18:38:52 +0000 (UTC)
commit e64326e6fa8f8e3f807ba3570d6218eeac3cdd20
Author: Vivien Malerba <malerba gnome-db org>
Date: Tue Sep 15 20:00:39 2009 +0200
GdaBrowser: remember last visited directory
when loading or saving blob data
libgda-ui/data-entries/common-bin.c | 18 ++++++++++++++++--
libgda-ui/data-entries/common-bin.h | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/libgda-ui/data-entries/common-bin.c b/libgda-ui/data-entries/common-bin.c
index b92540a..29561e3 100644
--- a/libgda-ui/data-entries/common-bin.c
+++ b/libgda-ui/data-entries/common-bin.c
@@ -41,6 +41,9 @@ file_load_cb (GtkWidget *button, BinMenu *menu)
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
+ if (menu->current_folder)
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg), menu->current_folder);
+
if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_ACCEPT) {
char *filename;
gsize length;
@@ -89,8 +92,11 @@ file_load_cb (GtkWidget *button, BinMenu *menu)
g_free (filename);
}
- if (dlg)
+ if (dlg) {
+ g_free (menu->current_folder);
+ menu->current_folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dlg));
gtk_widget_destroy (dlg);
+ }
}
static void
@@ -106,6 +112,9 @@ file_save_cb (GtkWidget *button, BinMenu *menu)
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
+ if (menu->current_folder)
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlg), menu->current_folder);
+
if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_ACCEPT) {
char *filename;
gboolean allok = TRUE;
@@ -156,8 +165,12 @@ file_save_cb (GtkWidget *button, BinMenu *menu)
g_free (filename);
}
- if (dlg)
+ if (dlg) {
+ g_free (menu->current_folder);
+ menu->current_folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (dlg));
gtk_widget_destroy (dlg);
+
+ }
}
void
@@ -341,6 +354,7 @@ common_bin_reset (BinMenu *binmenu)
gda_value_free (binmenu->tmpvalue);
if (binmenu->popup)
gtk_widget_destroy (binmenu->popup);
+ g_free (binmenu->current_folder);
memset (binmenu, 0, sizeof (BinMenu));
}
diff --git a/libgda-ui/data-entries/common-bin.h b/libgda-ui/data-entries/common-bin.h
index 2784bea..ec818ce 100644
--- a/libgda-ui/data-entries/common-bin.h
+++ b/libgda-ui/data-entries/common-bin.h
@@ -28,6 +28,7 @@ typedef struct {
GtkWidget *popup; /* PopupContainer popup window */
GtkWidget *load_button;
GtkWidget *save_button;
+ gchar *current_folder;
GtkWidget *props_label;
GType entry_type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]