added gimp_help_id_quark() which is G_GNUC_CONST and a new macro

2004-05-03  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimphelpui.[ch]: added gimp_help_id_quark()
	which is G_GNUC_CONST and a new macro GIMP_HELP_ID as shortcut.

	* app/widgets/gimpactiongroup.c (gimp_action_group_add_*_actions):
	attach the help ID to the action using the new quark key. Call
	gtk_action_group_add_action() instead of the _with_accel() variant
	if the accel is the empty string (== if we explicitely want no
	accel even if the stock item specifies one). Fixes warning flood
	with GTK+ 2.4.1.
This commit is contained in:
Michael Natterer 2004-05-03 15:54:54 +00:00 committed by Michael Natterer
parent 311f033d34
commit 6e35e2333f
4 changed files with 115 additions and 20 deletions

View File

@ -1,3 +1,15 @@
2004-05-03 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.[ch]: added gimp_help_id_quark()
which is G_GNUC_CONST and a new macro GIMP_HELP_ID as shortcut.
* app/widgets/gimpactiongroup.c (gimp_action_group_add_*_actions):
attach the help ID to the action using the new quark key. Call
gtk_action_group_add_action() instead of the _with_accel() variant
if the accel is the empty string (== if we explicitely want no
accel even if the stock item specifies one). Fixes warning flood
with GTK+ 2.4.1.
2004-05-03 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpframe.c: if the label_widget is a button, set

View File

@ -308,9 +308,18 @@ gimp_action_group_add_actions (GimpActionGroup *group,
entries[i].callback,
group->user_data);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
action,
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group), action);
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
action,
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
}
@ -343,9 +352,19 @@ gimp_action_group_add_toggle_actions (GimpActionGroup *group,
entries[i].callback,
group->user_data);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
}
@ -385,9 +404,19 @@ gimp_action_group_add_radio_actions (GimpActionGroup *group,
if (value == entries[i].value)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
@ -425,9 +454,19 @@ gimp_action_group_add_enum_actions (GimpActionGroup *group,
callback,
group->user_data);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
}
@ -460,9 +499,19 @@ gimp_action_group_add_string_actions (GimpActionGroup *group,
callback,
group->user_data);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
}
@ -492,9 +541,19 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
callback,
group->user_data);
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].accelerator && ! entries[i].accelerator[0])
gtk_action_group_add_action (GTK_ACTION_GROUP (group),
GTK_ACTION (action));
else
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
g_strdup (entries[i].help_id),
(GDestroyNotify) g_free);
g_object_unref (action);
}
}

View File

@ -210,7 +210,7 @@ gimp_help_set_help_data (GtkWidget *widget,
if (tooltip)
gtk_tooltips_set_tip (tool_tips, widget, tooltip, help_id);
else
g_object_set_data (G_OBJECT (widget), "gimp-help-id", (gpointer) help_id);
g_object_set_qdata (G_OBJECT (widget), GIMP_HELP_ID, (gpointer) help_id);
}
/**
@ -236,6 +236,25 @@ gimp_context_help (GtkWidget *widget)
gimp_help_callback (widget, GTK_WIDGET_HELP_WHATS_THIS, NULL);
}
/**
* gimp_help_id_quark:
*
* This function returns the #GQuark which should be used as key when
* attachind help IDs to widgets and objects.
*
* Return value: The #GQuark.
**/
GQuark
gimp_help_id_quark (void)
{
static GQuark quark = 0;
if (! quark)
quark = g_quark_from_static_string ("gimp-help-id");
return quark;
}
/* private functions */
@ -255,7 +274,7 @@ gimp_help_get_help_data (GtkWidget *widget,
if (tooltips_data && tooltips_data->tip_private)
help_id = tooltips_data->tip_private;
else
help_id = g_object_get_data (G_OBJECT (widget), "gimp-help-id");
help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID);
help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");

View File

@ -53,6 +53,11 @@ void gimp_help_set_help_data (GtkWidget *widget,
void gimp_context_help (GtkWidget *widget);
#define GIMP_HELP_ID (gimp_help_id_quark ())
GQuark gimp_help_id_quark (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GIMP_HELP_UI_H__ */