/** * gimp_window_set_transient: * @window: the #GtkWindow that should become transient * * Indicates to the window manager that @window is a transient dialog * associated with the GIMP window that the plug-in has been * started from. See also gimp_window_set_transient_for_display(). * * Since: GIMP 2.4 */ void gimp_window_set_transient (GtkWindow *window) { g_return_if_fail (gimp_ui_initialized); g_return_if_fail (GTK_IS_WINDOW (window)); gimp_window_set_transient_for (window, gimp_ui_get_progress_window ()); }
/** * gimp_window_set_transient_for_display: * @window: the #GtkWindow that should become transient * @gdisp_ID: display ID of the image window that should become the parent * * Indicates to the window manager that @window is a transient dialog * associated with the GIMP image window that is identified by it's * display ID. See gdk_window_set_transient_for () for more information. * * Most of the time you will want to use the convenience function * gimp_window_set_transient(). * * Since: GIMP 2.4 */ void gimp_window_set_transient_for_display (GtkWindow *window, guint32 gdisp_ID) { g_return_if_fail (gimp_ui_initialized); g_return_if_fail (GTK_IS_WINDOW (window)); gimp_window_set_transient_for (window, gimp_ui_get_display_window (gdisp_ID)); }
static GtkWidget * progress_error_dialog (GimpProgress *progress) { GtkWidget *dialog; g_return_val_if_fail (GIMP_IS_PROGRESS (progress), NULL); dialog = g_object_get_data (G_OBJECT (progress), "gimp-error-dialog"); if (! dialog) { dialog = gimp_error_dialog_new (_("GIMP Message")); g_object_set_data (G_OBJECT (progress), "gimp-error-dialog", dialog); g_signal_connect_object (dialog, "destroy", G_CALLBACK (progress_error_dialog_unset), progress, G_CONNECT_SWAPPED); if (GTK_IS_WIDGET (progress)) { GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (progress)); if (GTK_IS_WINDOW (toplevel)) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel)); } else { guint32 window = gimp_progress_get_window (progress); if (window) gimp_window_set_transient_for (GTK_WINDOW (dialog), window); } } return dialog; }
static gboolean gui_pdb_dialog_new (Gimp *gimp, GimpContext *context, GimpProgress *progress, GimpContainer *container, const gchar *title, const gchar *callback_name, const gchar *object_name, va_list args) { GType dialog_type = G_TYPE_NONE; const gchar *dialog_role = NULL; const gchar *help_id = NULL; if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH) { dialog_type = GIMP_TYPE_BRUSH_SELECT; dialog_role = "gimp-brush-selection"; help_id = GIMP_HELP_BRUSH_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT) { dialog_type = GIMP_TYPE_FONT_SELECT; dialog_role = "gimp-font-selection"; help_id = GIMP_HELP_FONT_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT) { dialog_type = GIMP_TYPE_GRADIENT_SELECT; dialog_role = "gimp-gradient-selection"; help_id = GIMP_HELP_GRADIENT_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE) { dialog_type = GIMP_TYPE_PALETTE_SELECT; dialog_role = "gimp-palette-selection"; help_id = GIMP_HELP_PALETTE_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN) { dialog_type = GIMP_TYPE_PATTERN_SELECT; dialog_role = "gimp-pattern-selection"; help_id = GIMP_HELP_PATTERN_DIALOG; } if (dialog_type != G_TYPE_NONE) { GimpObject *object = NULL; if (object_name && strlen (object_name)) object = gimp_container_get_child_by_name (container, object_name); if (! object) object = gimp_context_get_by_type (context, gimp_container_get_children_type (container)); if (object) { GParameter *params = NULL; gint n_params = 0; GtkWidget *dialog; GtkWidget *view; params = gimp_parameters_append (dialog_type, params, &n_params, "title", title, "role", dialog_role, "help-func", gimp_standard_help_func, "help-id", help_id, "pdb", gimp->pdb, "context", context, "select-type", gimp_container_get_children_type (container), "initial-object", object, "callback-name", callback_name, "menu-factory", global_menu_factory, NULL); params = gimp_parameters_append_valist (dialog_type, params, &n_params, args); dialog = g_object_newv (dialog_type, n_params, params); gimp_parameters_free (params, n_params); view = GIMP_PDB_DIALOG (dialog)->view; if (view) gimp_docked_set_show_button_bar (GIMP_DOCKED (view), FALSE); if (progress) { guint32 window_id = gimp_progress_get_window_id (progress); if (window_id) gimp_window_set_transient_for (GTK_WINDOW (dialog), window_id); } gtk_widget_show (dialog); /* workaround for bug #360106 */ { GSource *source = g_timeout_source_new (100); GClosure *closure; closure = g_cclosure_new_object (G_CALLBACK (gui_pdb_dialog_present), G_OBJECT (dialog)); g_source_set_closure (source, closure); g_source_attach (source, NULL); g_source_unref (source); } return TRUE; } } return FALSE; }