libgimpwidgets: add a GDestroyNotify for gimp_help_connect()'s user_data

This commit is contained in:
Michael Natterer 2019-08-09 13:11:30 +02:00
parent ebddecd696
commit 55940b733b
15 changed files with 41 additions and 36 deletions

View File

@ -154,7 +154,7 @@ dashboard_log_record_cmd_callback (GimpAction *action,
NULL);
gimp_help_connect (dialog, gimp_standard_help_func,
GIMP_HELP_DASHBOARD_LOG_RECORD, NULL);
GIMP_HELP_DASHBOARD_LOG_RECORD, NULL, NULL);
dialogs_attach_dialog (G_OBJECT (dashboard), LOG_RECORD_KEY, dialog);

View File

@ -129,7 +129,7 @@ error_console_save_cmd_callback (GimpAction *action,
NULL);
gimp_help_connect (dialog, gimp_standard_help_func,
GIMP_HELP_ERRORS_DIALOG, NULL);
GIMP_HELP_ERRORS_DIALOG, NULL, NULL);
}
gtk_window_present (GTK_WINDOW (console->file_dialog));

View File

@ -112,7 +112,7 @@ gradients_save_as_pov_ray_cmd_callback (GimpAction *action,
G_CONNECT_SWAPPED);
gimp_help_connect (dialog, gimp_standard_help_func,
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL);
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL, NULL);
dialogs_attach_dialog (G_OBJECT (gradient),
SAVE_AS_POV_DIALOG_KEY, dialog);

View File

@ -388,7 +388,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell);
gimp_help_connect (GTK_WIDGET (shell), gimp_standard_help_func,
GIMP_HELP_IMAGE_WINDOW, NULL);
GIMP_HELP_IMAGE_WINDOW, NULL, NULL);
}
static void

View File

@ -624,7 +624,7 @@ gimp_dockbook_new (GimpMenuFactory *menu_factory)
dockbook);
gimp_help_connect (GTK_WIDGET (dockbook), gimp_dockbook_help_func,
GIMP_HELP_DOCK, dockbook);
GIMP_HELP_DOCK, dockbook, NULL);
return GTK_WIDGET (dockbook);
}

View File

@ -453,7 +453,7 @@ gimp_dock_window_constructed (GObject *object)
NULL);
gimp_help_connect (GTK_WIDGET (dock_window), gimp_standard_help_func,
GIMP_HELP_DOCK, NULL);
GIMP_HELP_DOCK, NULL, NULL);
if (dock_window->p->auto_follow_active)
{

View File

@ -341,7 +341,8 @@ gimp_file_dialog_constructed (GObject *object)
if (dialog->help_id)
{
gimp_help_connect (GTK_WIDGET (dialog),
gimp_file_dialog_help_func, dialog->help_id, dialog);
gimp_file_dialog_help_func, dialog->help_id,
dialog, NULL);
if (GIMP_GUI_CONFIG (dialog->gimp->config)->show_help_button)
{

View File

@ -766,7 +766,7 @@ gimp_settings_box_file_dialog (GimpSettingsBox *box,
private->last_file, NULL);
gimp_help_connect (private->file_dialog, gimp_standard_help_func,
private->help_id, NULL);
private->help_id, NULL, NULL);
/* allow callbacks to add widgets to the dialog */
g_signal_emit (box, settings_box_signals[FILE_DIALOG_SETUP], 0,

View File

@ -173,7 +173,7 @@ gimp_toolbox_init (GimpToolbox *toolbox)
toolbox->p = gimp_toolbox_get_instance_private (toolbox);
gimp_help_connect (GTK_WIDGET (toolbox), gimp_standard_help_func,
GIMP_HELP_TOOLBOX, NULL);
GIMP_HELP_TOOLBOX, NULL, NULL);
}
static void

View File

@ -169,7 +169,7 @@ gimp_dialog_constructed (GObject *object)
if (private->help_func)
gimp_help_connect (GTK_WIDGET (object),
private->help_func, private->help_id,
object);
object, NULL);
if (show_help_button && private->help_func && private->help_id)
{

View File

@ -103,21 +103,23 @@ gimp_standard_help_func (const gchar *help_id,
/**
* gimp_help_connect:
* @widget: The widget you want to connect the help accelerator for. Will
* be a #GtkWindow in most cases.
* @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.
* @help_data: The @help_data pointer which will be passed to @help_func.
* @widget: The widget you want to connect the help accelerator for.
* Will be a #GtkWindow in most cases.
* @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.
* @help_data: The @help_data pointer which will be passed to @help_func.
* @help_data_destroy: Destroy function for @help_data.
*
* Note that this function is automatically called by all libgimp dialog
* constructors. You only have to call it for windows/dialogs you created
* "manually".
**/
void
gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_id,
gpointer help_data)
gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_id,
gpointer help_data,
GDestroyNotify help_data_destroy)
{
static gboolean initialized = FALSE;
@ -147,7 +149,8 @@ gimp_help_connect (GtkWidget *widget,
gimp_help_set_help_data (widget, NULL, help_id);
g_object_set_data (G_OBJECT (widget), "gimp-help-data", help_data);
g_object_set_data_full (G_OBJECT (widget), "gimp-help-data",
help_data, help_data_destroy);
g_signal_connect (widget, "show-help",
G_CALLBACK (gimp_help_callback),

View File

@ -33,27 +33,28 @@ G_BEGIN_DECLS
/* the standard gimp help function
*/
void gimp_standard_help_func (const gchar *help_id,
gpointer help_data);
void gimp_standard_help_func (const gchar *help_id,
gpointer help_data);
/* connect the help callback of a window */
void gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_id,
gpointer help_data);
void gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_id,
gpointer help_data,
GDestroyNotify help_data_destroy);
/* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_id);
void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_id);
/* set help data with markup for non-window widgets */
void gimp_help_set_help_data_with_markup (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_id);
void gimp_help_set_help_data_with_markup (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_id);
/* activate the context help inspector */
void gimp_context_help (GtkWidget *widget);
void gimp_context_help (GtkWidget *widget);
/**

View File

@ -769,7 +769,7 @@ build_dialog (gchar *imagename)
G_CALLBACK (popup_menu),
NULL);
gimp_help_connect (window, gimp_standard_help_func, PLUG_IN_PROC, NULL);
gimp_help_connect (window, gimp_standard_help_func, PLUG_IN_PROC, NULL, NULL);
ui_manager = ui_manager_new (window);

View File

@ -1224,7 +1224,7 @@ dialog(gint32 drawable_id)
gtk_window_set_resizable(GTK_WINDOW(dlg), TRUE);
main_set_title(NULL);
gimp_help_connect (dlg, gimp_standard_help_func, PLUG_IN_PROC, NULL);
gimp_help_connect (dlg, gimp_standard_help_func, PLUG_IN_PROC, NULL, NULL);
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);

View File

@ -200,7 +200,7 @@ print_page_layout_gui (PrintData *data,
G_CALLBACK (update_custom_widget),
main_hbox, 0);
gimp_help_connect (main_hbox, gimp_standard_help_func, help_id, NULL);
gimp_help_connect (main_hbox, gimp_standard_help_func, help_id, NULL, NULL);
return main_hbox;
}