Commit 788ae2fd authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed "role" property because GtkWindow has an equivalent property now.

2004-07-08  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpdialog.c: removed "role" property because
	GtkWindow has an equivalent property now. Added "help-func" and
	"help-id" construct properties.

	* app/widgets/gimptexteditor.c
	* app/widgets/gimptooldialog.c
	* app/widgets/gimpviewabledialog.c: removed calls to
	gimp_help_connect() and pass help_func and help_id to
	g_object_new().
parent bb8a795e
2004-07-08 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpdialog.c: removed "role" property because
GtkWindow has an equivalent property now. Added "help-func" and
"help-id" construct properties.
* app/widgets/gimptexteditor.c
* app/widgets/gimptooldialog.c
* app/widgets/gimpviewabledialog.c: removed calls to
gimp_help_connect() and pass help_func and help_id to
g_object_new().
2004-07-08 Michael Natterer <mitch@gimp.org> 2004-07-08 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.c (gimp_context_help): fixed typo in * libgimpwidgets/gimphelpui.c (gimp_context_help): fixed typo in
......
...@@ -161,13 +161,12 @@ gimp_text_editor_new (const gchar *title) ...@@ -161,13 +161,12 @@ gimp_text_editor_new (const gchar *title)
g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (title != NULL, NULL);
editor = g_object_new (GIMP_TYPE_TEXT_EDITOR, editor = g_object_new (GIMP_TYPE_TEXT_EDITOR,
"title", title, "title", title,
"role", "gimp-text-editor", "role", "gimp-text-editor",
"help-func", gimp_standard_help_func,
"help-id", GIMP_HELP_TEXT_EDITOR_DIALOG,
NULL); NULL);
gimp_help_connect (GTK_WIDGET (editor), gimp_standard_help_func,
GIMP_HELP_TEXT_EDITOR_DIALOG, NULL);
gtk_dialog_add_button (GTK_DIALOG (editor), gtk_dialog_add_button (GTK_DIALOG (editor),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
......
...@@ -97,14 +97,13 @@ gimp_tool_dialog_new (GimpToolInfo *tool_info, ...@@ -97,14 +97,13 @@ gimp_tool_dialog_new (GimpToolInfo *tool_info,
dialog = g_object_new (GIMP_TYPE_TOOL_DIALOG, dialog = g_object_new (GIMP_TYPE_TOOL_DIALOG,
"title", tool_info->blurb, "title", tool_info->blurb,
"role", GIMP_OBJECT (tool_info)->name, "role", GIMP_OBJECT (tool_info)->name,
"stock_id", stock_id, "help-func", gimp_standard_help_func,
"help-id", tool_info->help_id,
"stock-id", stock_id,
"description", desc ? desc : tool_info->help, "description", desc ? desc : tool_info->help,
"parent", parent, "parent", parent,
NULL); NULL);
gimp_help_connect (GTK_WIDGET (dialog),
gimp_standard_help_func, tool_info->help_id, dialog);
va_start (args, desc); va_start (args, desc);
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
va_end (args); va_end (args);
......
...@@ -249,15 +249,13 @@ gimp_viewable_dialog_new (GimpViewable *viewable, ...@@ -249,15 +249,13 @@ gimp_viewable_dialog_new (GimpViewable *viewable,
dialog = g_object_new (GIMP_TYPE_VIEWABLE_DIALOG, dialog = g_object_new (GIMP_TYPE_VIEWABLE_DIALOG,
"title", title, "title", title,
"role", role, "role", role,
"stock_id", stock_id, "help-func", help_func,
"help-id", help_id,
"stock-id", stock_id,
"description", desc, "description", desc,
"parent", parent, "parent", parent,
NULL); NULL);
if (help_func)
gimp_help_connect (GTK_WIDGET (dialog), help_func, help_id, dialog);
va_start (args, help_id); va_start (args, help_id);
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
va_end (args); va_end (args);
......
...@@ -33,13 +33,17 @@ ...@@ -33,13 +33,17 @@
enum enum
{ {
PROP_0, PROP_0,
PROP_ROLE PROP_HELP_FUNC,
PROP_HELP_ID
}; };
static void gimp_dialog_class_init (GimpDialogClass *klass); static void gimp_dialog_class_init (GimpDialogClass *klass);
static void gimp_dialog_init (GimpDialog *dialog); static void gimp_dialog_init (GimpDialog *dialog);
static GObject * gimp_dialog_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_dialog_set_property (GObject *object, static void gimp_dialog_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
...@@ -78,8 +82,8 @@ gimp_dialog_get_type (void) ...@@ -78,8 +82,8 @@ gimp_dialog_get_type (void)
}; };
dialog_type = g_type_register_static (GTK_TYPE_DIALOG, dialog_type = g_type_register_static (GTK_TYPE_DIALOG,
"GimpDialog", "GimpDialog",
&dialog_info, 0); &dialog_info, 0);
} }
return dialog_type; return dialog_type;
...@@ -88,16 +92,13 @@ gimp_dialog_get_type (void) ...@@ -88,16 +92,13 @@ gimp_dialog_get_type (void)
static void static void
gimp_dialog_class_init (GimpDialogClass *klass) gimp_dialog_class_init (GimpDialogClass *klass)
{ {
GObjectClass *object_class; GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkDialogClass *dialog_class; GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
dialog_class = GTK_DIALOG_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
object_class->constructor = gimp_dialog_constructor;
object_class->set_property = gimp_dialog_set_property; object_class->set_property = gimp_dialog_set_property;
object_class->get_property = gimp_dialog_get_property; object_class->get_property = gimp_dialog_get_property;
...@@ -105,10 +106,36 @@ gimp_dialog_class_init (GimpDialogClass *klass) ...@@ -105,10 +106,36 @@ gimp_dialog_class_init (GimpDialogClass *klass)
dialog_class->close = gimp_dialog_close; dialog_class->close = gimp_dialog_close;
g_object_class_install_property (object_class, PROP_ROLE, g_object_class_install_property (object_class, PROP_HELP_FUNC,
g_param_spec_string ("role", NULL, NULL, g_param_spec_pointer ("help-func", NULL, NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_HELP_ID,
g_param_spec_string ("help-id", NULL, NULL,
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
static GObject *
gimp_dialog_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GimpHelpFunc help_func;
const gchar *help_id;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
help_func = g_object_get_data (object, "gimp-dialog-help-func");
help_id = g_object_get_data (object, "gimp-dialog-help-id");
if (help_func)
gimp_help_connect (GTK_WIDGET (object), help_func, help_id, object);
return object;
} }
static void static void
...@@ -119,8 +146,14 @@ gimp_dialog_set_property (GObject *object, ...@@ -119,8 +146,14 @@ gimp_dialog_set_property (GObject *object,
{ {
switch (property_id) switch (property_id)
{ {
case PROP_ROLE: case PROP_HELP_FUNC:
gtk_window_set_role (GTK_WINDOW (object), g_value_get_string (value)); g_object_set_data (object, "gimp-dialog-help-func",
g_value_get_pointer (value));
break;
case PROP_HELP_ID:
g_object_set_data_full (object, "gimp-dialog-help-id",
g_value_dup_string (value),
(GDestroyNotify) g_free);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
...@@ -136,8 +169,13 @@ gimp_dialog_get_property (GObject *object, ...@@ -136,8 +169,13 @@ gimp_dialog_get_property (GObject *object,
{ {
switch (property_id) switch (property_id)
{ {
case PROP_ROLE: case PROP_HELP_FUNC:
g_value_set_string (value, gtk_window_get_role (GTK_WINDOW (object))); g_value_set_pointer (value, g_object_get_data (object,
"gimp-dialog-help-func"));
break;
case PROP_HELP_ID:
g_value_set_string (value, g_object_get_data (object,
"gimp-dialog-help-id"));
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
...@@ -267,9 +305,11 @@ gimp_dialog_new_valist (const gchar *title, ...@@ -267,9 +305,11 @@ gimp_dialog_new_valist (const gchar *title,
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL); g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
dialog = g_object_new (GIMP_TYPE_DIALOG, dialog = g_object_new (GIMP_TYPE_DIALOG,
"title", title, "title", title,
"role", role, "role", role,
"modal", (flags & GTK_DIALOG_MODAL), "modal", (flags & GTK_DIALOG_MODAL),
"help-func", help_func,
"help-id", help_id,
NULL); NULL);
if (parent) if (parent)
...@@ -291,9 +331,6 @@ gimp_dialog_new_valist (const gchar *title, ...@@ -291,9 +331,6 @@ gimp_dialog_new_valist (const gchar *title,
dialog, G_CONNECT_SWAPPED); dialog, G_CONNECT_SWAPPED);
} }
if (help_func)
gimp_help_connect (dialog, help_func, help_id, dialog);
gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args); gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
return dialog; return dialog;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment