gnome-file-entry and gtk_file_selection

Hi fellow Gnomes,

I took over the task to document gnome-file-entry. 

While investigating how it works and from my own experience with ggv
(which I have been helping to develop) and other gnome applications
there is something I find particularly annoying and I'd like to
fix. let me explain.

Every time you open a gtk_file_selection dialog, if you specify a
directory it returns with the name of that directory. Fine, sometimes
you want a directory. However, most of the times I want a file, so I'd
like it to rescan the directory. If you use the mouse, it does
that. But if you use the keyboard, it does not.  Also, I'd like to be
able to specify masks in the entry box (for instance type /tmp/*.ps
and only see the files that match that).

Do people thing this is the way to go? x11amp does the rescanning.
gnumeric (0.26) crashes. 

The code at the end is something I wrote to do what I described
above. I am including it here so you see what I have in mind. It is
not a patch :) It is the callback from the file_selection dialog. It
checkes whether the file is a directory and if so, rescans.

So the question is, should this be done is gtk or gnome. If in gnome,
should we define a new widget? What about gnome_file_entry? Should it
be fixed? 

If it is fixed, what is proper procedure?  Where should it be added?
What would be the ideal API so it does not affect current code? 

This will affect many people, I am sure. And it is a feature that many
people will like, I am sure too.

static void file_open_ok_callback(GtkWidget *widget, gpointer data)
        ggv_window *ggv = (ggv_window *)data;
        gchar *file;
        gchar *baseFileName;
        char *ErrorMessage;
        struct stat StatRecord;

	file = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(ggv->file_sel)));

        /* We have to verify that this file exists */
        if (stat(file,&StatRecord) == 0) {
                if (S_ISDIR(StatRecord.st_mode)) {
                        /* This is a directory, reset window and
                           try again */
                        if (strlen(file) > 0 && file[strlen(file)-1] != '/')
        else {
                /* We have to check if there is a wildcard in the directory name
                baseFileName = g_basename(file);
                if (strchr(baseFileName, '?' ) != NULL ||
                    strchr(baseFileName, '*' ) != NULL) {
                /* FIXME:  currently , if the file does not exist,
                   the window does not close, and it does not send a
                   message. it justs does nothing.

                   If we send a message (code below), the focus does
                   not return to the File window after the user clicks
                   on it

                  ErrorMessage = g_strdup_printf(_("File does not exist %s."), file);
        ggv->file_sel = NULL;

        ggv->loaded = load_gs(ggv, file);


Daniel M. German                  "Language alone protects us from the scariness
                                   of things with no names.
   Toni Morrison ->                Language alone is meditation. "


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