libgimp: Add export dialog API
Add gimp_export_dialog_new() for creating a export dialog and gimp_export_dialog_get_content_area() for accessing the vbox where clients can put widgets.
This commit is contained in:
@ -928,3 +928,74 @@ gimp_export_image (gint32 *image_ID,
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_export_dialog_new:
|
||||
* @format_name: The short name of the image_format (e.g. JPEG or PNG).
|
||||
* @role: The dialog's @role which will be set with
|
||||
* gtk_window_set_role().
|
||||
* @help_id: The GIMP help id.
|
||||
*
|
||||
* Creates a new export dialog. All file plug-ins should use this
|
||||
* dialog to get a consistent look on the export dialogs. Use
|
||||
* gimp_export_dialog_get_content_area() to get a #GtkVBox to be
|
||||
* filled with export options. The export dialog is a wrapped
|
||||
* #GimpDialog.
|
||||
*
|
||||
* The dialog response when the user clicks on the Export button is
|
||||
* %GTK_RESPONSE_OK, and when the Cancel button is clicked it is
|
||||
* %GTK_RESPONSE_CANCEL.
|
||||
*
|
||||
* Returns: The new export dialog.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_export_dialog_new (const gchar *format_name,
|
||||
const gchar *role,
|
||||
const gchar *help_id)
|
||||
{
|
||||
GtkWidget *dialog = NULL;
|
||||
GtkWidget *button = NULL;
|
||||
gchar *title = g_strconcat (_("Export Image as "), format_name, NULL);
|
||||
|
||||
dialog = gimp_dialog_new (title, role,
|
||||
NULL, 0,
|
||||
gimp_standard_help_func, help_id,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
button = gimp_dialog_add_button (GIMP_DIALOG (dialog),
|
||||
_("_Export"), GTK_RESPONSE_OK);
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_stock (GTK_STOCK_SAVE,
|
||||
GTK_ICON_SIZE_BUTTON));
|
||||
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
gimp_window_set_transient (GTK_WINDOW (dialog));
|
||||
|
||||
g_free (title);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_export_dialog_get_content_area:
|
||||
* @dialog: A dialog created with gimp_export_dialog_new()
|
||||
*
|
||||
* Returns the #GtkVBox of the passed export dialog to be filled with
|
||||
* export options.
|
||||
*
|
||||
* Returns: The #GtkVBox to fill with export options.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_export_dialog_get_content_area (GtkWidget *dialog)
|
||||
{
|
||||
return gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
}
|
||||
|
@ -47,10 +47,14 @@ typedef enum
|
||||
GIMP_EXPORT_EXPORT
|
||||
} GimpExportReturn;
|
||||
|
||||
GimpExportReturn gimp_export_image (gint32 *image_ID,
|
||||
gint32 *drawable_ID,
|
||||
const gchar *format_name,
|
||||
GimpExportCapabilities capabilities);
|
||||
GimpExportReturn gimp_export_image (gint32 *image_ID,
|
||||
gint32 *drawable_ID,
|
||||
const gchar *format_name,
|
||||
GimpExportCapabilities capabilities);
|
||||
GtkWidget * gimp_export_dialog_new (const gchar *format_name,
|
||||
const gchar *role,
|
||||
const gchar *help_id);
|
||||
GtkWidget * gimp_export_dialog_get_content_area (GtkWidget *dialog);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -20,6 +20,8 @@ EXPORTS
|
||||
gimp_drawable_preview_get_drawable
|
||||
gimp_drawable_preview_get_type
|
||||
gimp_drawable_preview_new
|
||||
gimp_export_dialog_get_content_area
|
||||
gimp_export_dialog_new
|
||||
gimp_export_image
|
||||
gimp_font_select_button_get_font
|
||||
gimp_font_select_button_get_type
|
||||
|
Reference in New Issue
Block a user