diff options
author | Shi Pu <shi.pu@sun.com> | 2006-04-30 11:24:52 +0800 |
---|---|---|
committer | Irene Huang <ireneh@src.gnome.org> | 2006-04-30 11:24:52 +0800 |
commit | b1cb5ad05f1ad24b1621e5fc5c56752f91671614 (patch) | |
tree | da76a6d65672756091a5c91b083fecaa885b530b /filter/filter-file.c | |
parent | 46ad39abe500461d0e6017e202c209d8531a0d61 (diff) | |
download | gsoc2013-evolution-b1cb5ad05f1ad24b1621e5fc5c56752f91671614.tar.gz gsoc2013-evolution-b1cb5ad05f1ad24b1621e5fc5c56752f91671614.tar.zst gsoc2013-evolution-b1cb5ad05f1ad24b1621e5fc5c56752f91671614.zip |
** Fixes Bug #323853
2006-02-24 Shi Pu <shi.pu@sun.com>
** Fixes Bug #323853
* filter-file.c: (filename_changed), (get_widget):
Replace GnomeFileEntry by GtkFileChooserButton.
svn path=/trunk/; revision=31932
Diffstat (limited to 'filter/filter-file.c')
-rw-r--r-- | filter/filter-file.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/filter/filter-file.c b/filter/filter-file.c index a385d3330b..13ba95cc03 100644 --- a/filter/filter-file.c +++ b/filter/filter-file.c @@ -31,7 +31,7 @@ #include <gtk/gtk.h> #include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-file-entry.h> +#include <gtk/gtkfilechooserbutton.h> #include <libedataserver/e-sexp.h> @@ -269,13 +269,16 @@ xml_decode (FilterElement *fe, xmlNodePtr node) } static void -entry_changed (GtkEntry *entry, FilterElement *fe) +filename_changed (GtkWidget *widget, FilterElement *fe) { FilterFile *file = (FilterFile *) fe; const char *new; - new = gtk_entry_get_text (entry); - +#ifdef USE_GTKFILECHOOSER + new = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); +#else + new = gtk_entry_get_text (GTK_ENTRY (widget)); +#endif g_free (file->path); file->path = g_strdup (new); } @@ -284,19 +287,26 @@ static GtkWidget * get_widget (FilterElement *fe) { FilterFile *file = (FilterFile *) fe; - GtkWidget *fileentry, *entry; - - fileentry = gnome_file_entry_new (NULL, _("Choose a file")); - g_object_set (G_OBJECT (fileentry), "use_filechooser", TRUE, NULL); - gnome_file_entry_set_default_path (GNOME_FILE_ENTRY (fileentry), file->path); - gnome_file_entry_set_modal (GNOME_FILE_ENTRY (fileentry), TRUE); - - entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (fileentry)); + GtkWidget *filewidget, *entry; + +#ifdef USE_GTKFILECHOOSER + filewidget = (GtkWidget *) gtk_file_chooser_button_new (_("Choose a file"), GTK_FILE_CHOOSER_ACTION_OPEN); + g_object_set (G_OBJECT (filewidget), "use_filechooser", TRUE, NULL); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewidget), file->path); + g_signal_connect (GTK_FILE_CHOOSER_BUTTON (filewidget), "selection-changed", + G_CALLBACK (filename_changed), fe); +#else + filewidget = gnome_file_entry_new (NULL, _("Choose a file")); + g_object_set (G_OBJECT (filewidget), "use_filechooser", TRUE, NULL); + gnome_file_entry_set_default_path (GNOME_FILE_ENTRY (filewidget), file->path); + gnome_file_entry_set_modal (GNOME_FILE_ENTRY (filewidget), TRUE); + + entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (filewidget)); gtk_entry_set_text (GTK_ENTRY (entry), file->path); - g_signal_connect (entry, "changed", G_CALLBACK (entry_changed), fe); - - return fileentry; + g_signal_connect (entry, "changed", G_CALLBACK (filename_changed), fe); +#endif + return filewidget; } static void |