GtkWidget * gimp_message_dialog_new (const gchar *title, const gchar *stock_id, GtkWidget *parent, GtkDialogFlags flags, GimpHelpFunc help_func, const gchar *help_id, ...) { GimpMessageDialog *dialog; va_list args; g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL); dialog = g_object_new (GIMP_TYPE_MESSAGE_DIALOG, "title", title, "role", "gimp-message-dialog", "modal", (flags & GTK_DIALOG_MODAL), "help-func", help_func, "help-id", help_id, NULL); if (parent) { if (! GTK_IS_WINDOW (parent)) parent = gtk_widget_get_toplevel (parent); if (GTK_IS_WINDOW (parent)) { gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); if (flags & GTK_DIALOG_DESTROY_WITH_PARENT) gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); } else { gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent)); } } va_start (args, help_id); gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); va_end (args); dialog->box = g_object_new (GIMP_TYPE_MESSAGE_BOX, "stock-id", stock_id, NULL); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), GTK_WIDGET (dialog->box), FALSE, FALSE, 0); gtk_widget_show (GTK_WIDGET (dialog->box)); return GTK_WIDGET (dialog); }
/** * gimp_dialog_add_buttons: * @dialog: The @dialog to add buttons to. * @Varargs: button_text-response_id pairs. * * This function is essentially the same as gtk_dialog_add_buttons() * except it calls gimp_dialog_add_button() instead of gtk_dialog_add_button() **/ void gimp_dialog_add_buttons (GimpDialog *dialog, ...) { va_list args; va_start (args, dialog); gimp_dialog_add_buttons_valist (dialog, args); va_end (args); }
/** * gimp_dialog_new_valist: * @title: The dialog's title which will be set with * gtk_window_set_title(). * @role: The dialog's @role which will be set with * gtk_window_set_role(). * @parent: The @parent widget of this dialog or %NULL. * @flags: The @flags (see the #GtkDialog documentation). * @help_func: The function which will be called if the user presses "F1". * @help_id: The help_id which will be passed to @help_func. * @args: A @va_list destribing the action_area buttons. * * Creates a new @GimpDialog widget. If a GtkWindow is specified as * @parent then the dialog will be made transient for this window. * * For a description of the format of the @va_list describing the * action_area buttons see gtk_dialog_new_with_buttons(). * * Returns: A #GimpDialog. **/ GtkWidget * gimp_dialog_new_valist (const gchar *title, const gchar *role, GtkWidget *parent, GtkDialogFlags flags, GimpHelpFunc help_func, const gchar *help_id, va_list args) { GtkWidget *dialog; g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (role != NULL, NULL); g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL); dialog = g_object_new (GIMP_TYPE_DIALOG, "title", title, "role", role, "modal", (flags & GTK_DIALOG_MODAL), "help-func", help_func, "help-id", help_id, NULL); if (parent) { if (GTK_IS_WINDOW (parent)) { gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent)); } else { gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent)); } if (flags & GTK_DIALOG_DESTROY_WITH_PARENT) g_signal_connect_object (parent, "destroy", G_CALLBACK (gimp_dialog_close), dialog, G_CONNECT_SWAPPED); } gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); return dialog; }
GtkWidget * gimp_viewable_dialog_new (GimpViewable *viewable, GimpContext *context, const gchar *title, const gchar *role, const gchar *icon_name, const gchar *desc, GtkWidget *parent, GimpHelpFunc help_func, const gchar *help_id, ...) { GimpViewableDialog *dialog; va_list args; g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), NULL); g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (role != NULL, NULL); g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL); if (! viewable) g_warning ("Use of GimpViewableDialog with a NULL viewable is depecrated!"); dialog = g_object_new (GIMP_TYPE_VIEWABLE_DIALOG, "viewable", viewable, "context", context, "title", title, "role", role, "help-func", help_func, "help-id", help_id, "icon-name", icon_name, "description", desc, "parent", parent, NULL); va_start (args, help_id); gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); va_end (args); return GTK_WIDGET (dialog); }