libgimpwidgets: new function gimp_dialog_get_native_handle().

This commit is contained in:
Jehan 2023-08-15 00:09:08 +02:00
parent 9a57ab54e9
commit d6a2deb305
3 changed files with 29 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
@ -29,6 +30,7 @@
#include "gimpdialog.h"
#include "gimphelpui.h"
#include "gimpwidgetsutils.h"
#include "libgimp/libgimp-intl.h"
@ -58,6 +60,8 @@ struct _GimpDialogPrivate
GimpHelpFunc help_func;
gchar *help_id;
GtkWidget *help_button;
GBytes *window_handle;
};
#define GET_PRIVATE(obj) (((GimpDialog *) (obj))->priv)
@ -177,6 +181,8 @@ gimp_dialog_constructed (GObject *object)
_("_Help"),
GTK_RESPONSE_HELP);
}
gimp_widget_set_native_handle (GTK_WIDGET (object), &private->window_handle);
}
static void
@ -711,6 +717,26 @@ gimp_dialog_set_alternative_button_order_from_array (GimpDialog *dialog,
G_GNUC_END_IGNORE_DEPRECATIONS;
}
/**
* gimp_dialog_get_native_handle:
* @dialog: The #GimpDialog
*
* Returns an opaque data handle representing the window in the currently
* running platform. You should not try to use this directly. Usually this is to
* be used in functions such as [func@Gimp.brushes_popup] which will allow the
* core process to set this [class@Dialog] as parent to the newly created popup.
*
* Returns: (transfer none): an opaque [struct@GLib.Bytes] identifying this
* window.
*
* Since: 3.0
**/
GBytes *
gimp_dialog_get_native_handle (GimpDialog *dialog)
{
return dialog->priv->window_handle;
}
/**
* gimp_dialogs_show_help_button: (skip)
* @show: whether a help button should be added when creating a GimpDialog

View File

@ -98,6 +98,8 @@ void gimp_dialog_set_alternative_button_order_from_array
gint n_buttons,
gint *order);
GBytes * gimp_dialog_get_native_handle (GimpDialog *dialog);
/* for internal use only! */
void gimp_dialogs_show_help_button (gboolean show);

View File

@ -158,6 +158,7 @@ EXPORTS
gimp_dialog_add_button
gimp_dialog_add_buttons
gimp_dialog_add_buttons_valist
gimp_dialog_get_native_handle
gimp_dialog_get_type
gimp_dialog_new
gimp_dialog_new_valist