File chooser API for formats in Save mode
- From: Federico Mena Quintero <federico ximian com>
- To: GNOME Desktop <desktop-devel-list gnome org>
- Subject: File chooser API for formats in Save mode
- Date: Mon, 23 Feb 2004 17:22:23 -0600
Hi,
Seth's new design for the file chooser calls for a combo box that
displays available formats for saving:
http://www.gnome.org/~seth/filechooser-spec/
We need an API for that. My proposed API is this:
void gtk_file_chooser_add_save_format (GtkFileChooser *chooser,
gint id,
const gchar *name,
GdkPixbuf *small_icon,
GdkPixbuf *large_icon);
void gtk_file_chooser_remove_save_format (GtkFileChooser *chooser,
gint id);
void gtk_file_chooser_set_save_format (GtkFileChooser *chooser,
gint id);
gint gtk_file_chooser_get_save_format (GtkFileChooser *chooser);
The idea is to do something like this:
chooser = gtk_file_chooser_dialog_new ("Save As",
parent_window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_file_chooser_add_save_format (chooser, 0, "Excel 2000", ...);
gtk_file_chooser_add_save_format (chooser, 1, "Gnumeric", ...);
gtk_file_chooser_add_save_format (chooser, 2, "Lotus 1-2-3", ...);
gtk_file_chooser_set_save_format (chooser, 1); /* Make Gnumeric the default */
if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
{
guint format;
char *filename;
format = gtk_file_chooser_get_save_format (chooser);
filename = gtk_file_chooser_get_filename (chooser);
save_file (filename, format);
}
The file chooser would show the large_icon as the selected item in the
combo, and the small_icons in the actual popup menu.
What do people think of this API? [Owen, you had more ideas during
today's meeting...]
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]