Common widget for choosing file formats



Quoting myself from Bug 440431[1]:

Applications supporting multiple file formats needs a file-format
chooser in
their file saving dialog. Several GNOME apps implement very similiar
file-format choosers - so it makes sense to me, to add this widget to GTK+.

The widget would be used like this:

    GtkWidget *format_chooser = egg_file_format_chooser_new();
    gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog),
format_chooser);

    EggFileFormat *format;

    format = egg_file_format_new (_("Scalable Vector Graphics (SVG)"), "svg",
NULL);
    egg_file_format_chooser_add_format(EGG_FILE_FORMAT_CHOOSER(format_chooser),
format);

    format = egg_file_format_new (_("Compiliertes Layout (C-Header)"), "h",
NULL);
    egg_file_format_chooser_add_format(EGG_FILE_FORMAT_CHOOSER(format_chooser),
format);

    ...

    if (GTK_RESPONSE_ACCEPT == gtk_dialog_run (file_chooser))
      {
        EggFileFormat *format = egg_file_format_chooser_get_format
(format_chooser);
        gchar *filename = gtk_file_chooser_get_filename (chooser);

        if (NULL == format)
          format = egg_file_format_chooser_guess_by_extension (format_chooser,
filename);

        app_file_format_save (APP_FILE_FORMAT (format), filename);
        g_free (filename);
      }

Suggested API:
http://bugzilla.gnome.org/attachment.cgi?id=88596&action=view
http://bugzilla.gnome.org/attachment.cgi?id=88598&action=view

Is it OK, to commit this to GTK+? Should I add it to libegg first?
Ideas? Suggestions?

[1] http://bugzilla.gnome.org/show_bug.cgi?id=440431
-- 
Mathias Hasselmann <mathias hasselmann gmx de>
http://taschenorakel.de/

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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