mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: turn GimpDialog's "parent" into a property
and remove the parent peoperty from GimpViewableDialog.
This commit is contained in:
parent
6d97fd3887
commit
c469dbb206
|
@ -44,8 +44,7 @@ enum
|
||||||
PROP_VIEWABLE,
|
PROP_VIEWABLE,
|
||||||
PROP_CONTEXT,
|
PROP_CONTEXT,
|
||||||
PROP_STOCK_ID,
|
PROP_STOCK_ID,
|
||||||
PROP_DESC,
|
PROP_DESC
|
||||||
PROP_PARENT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,25 +81,23 @@ gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass)
|
||||||
g_param_spec_object ("viewable", NULL, NULL,
|
g_param_spec_object ("viewable", NULL, NULL,
|
||||||
GIMP_TYPE_VIEWABLE,
|
GIMP_TYPE_VIEWABLE,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_CONTEXT,
|
g_object_class_install_property (object_class, PROP_CONTEXT,
|
||||||
g_param_spec_object ("context", NULL, NULL,
|
g_param_spec_object ("context", NULL, NULL,
|
||||||
GIMP_TYPE_CONTEXT,
|
GIMP_TYPE_CONTEXT,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_STOCK_ID,
|
g_object_class_install_property (object_class, PROP_STOCK_ID,
|
||||||
g_param_spec_string ("stock-id", NULL, NULL,
|
g_param_spec_string ("stock-id", NULL, NULL,
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PARAM_WRITABLE |
|
GIMP_PARAM_WRITABLE |
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_DESC,
|
g_object_class_install_property (object_class, PROP_DESC,
|
||||||
g_param_spec_string ("description", NULL, NULL,
|
g_param_spec_string ("description", NULL, NULL,
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PARAM_WRITABLE |
|
GIMP_PARAM_WRITABLE |
|
||||||
G_PARAM_CONSTRUCT));
|
G_PARAM_CONSTRUCT));
|
||||||
g_object_class_install_property (object_class, PROP_PARENT,
|
|
||||||
g_param_spec_object ("parent", NULL, NULL,
|
|
||||||
GTK_TYPE_WIDGET,
|
|
||||||
GIMP_PARAM_WRITABLE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -177,6 +174,7 @@ gimp_viewable_dialog_set_property (GObject *object,
|
||||||
g_value_get_object (value),
|
g_value_get_object (value),
|
||||||
dialog->context);
|
dialog->context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CONTEXT:
|
case PROP_CONTEXT:
|
||||||
gimp_viewable_dialog_set_viewable (dialog,
|
gimp_viewable_dialog_set_viewable (dialog,
|
||||||
dialog->view ?
|
dialog->view ?
|
||||||
|
@ -184,30 +182,18 @@ gimp_viewable_dialog_set_property (GObject *object,
|
||||||
NULL,
|
NULL,
|
||||||
g_value_get_object (value));
|
g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_STOCK_ID:
|
case PROP_STOCK_ID:
|
||||||
gtk_image_set_from_stock (GTK_IMAGE (dialog->icon),
|
gtk_image_set_from_stock (GTK_IMAGE (dialog->icon),
|
||||||
g_value_get_string (value),
|
g_value_get_string (value),
|
||||||
GTK_ICON_SIZE_LARGE_TOOLBAR);
|
GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DESC:
|
case PROP_DESC:
|
||||||
gtk_label_set_text (GTK_LABEL (dialog->desc_label),
|
gtk_label_set_text (GTK_LABEL (dialog->desc_label),
|
||||||
g_value_get_string (value));
|
g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
case PROP_PARENT:
|
|
||||||
{
|
|
||||||
GtkWidget *parent = g_value_get_object (value);
|
|
||||||
|
|
||||||
if (parent)
|
|
||||||
{
|
|
||||||
if (GTK_IS_WINDOW (parent))
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
|
||||||
GTK_WINDOW (parent));
|
|
||||||
else
|
|
||||||
gtk_window_set_screen (GTK_WINDOW (dialog),
|
|
||||||
gtk_widget_get_screen (parent));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -229,9 +215,11 @@ gimp_viewable_dialog_get_property (GObject *object,
|
||||||
dialog->view ?
|
dialog->view ?
|
||||||
GIMP_VIEW (dialog->view)->viewable : NULL);
|
GIMP_VIEW (dialog->view)->viewable : NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CONTEXT:
|
case PROP_CONTEXT:
|
||||||
g_value_set_object (value, dialog->context);
|
g_value_set_object (value, dialog->context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -44,7 +44,8 @@ enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_HELP_FUNC,
|
PROP_HELP_FUNC,
|
||||||
PROP_HELP_ID
|
PROP_HELP_ID,
|
||||||
|
PROP_PARENT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ gimp_dialog_class_init (GimpDialogClass *klass)
|
||||||
dialog_class->close = gimp_dialog_close;
|
dialog_class->close = gimp_dialog_close;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpDialog::help-func:
|
* GimpDialog:help-func:
|
||||||
*
|
*
|
||||||
* Since: GIMP 2.2
|
* Since: GIMP 2.2
|
||||||
**/
|
**/
|
||||||
|
@ -105,7 +106,7 @@ gimp_dialog_class_init (GimpDialogClass *klass)
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpDialog::help-id:
|
* GimpDialog:help-id:
|
||||||
*
|
*
|
||||||
* Since: GIMP 2.2
|
* Since: GIMP 2.2
|
||||||
**/
|
**/
|
||||||
|
@ -114,6 +115,17 @@ gimp_dialog_class_init (GimpDialogClass *klass)
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PARAM_READWRITE |
|
GIMP_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GimpDialog:parent:
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.8
|
||||||
|
**/
|
||||||
|
g_object_class_install_property (object_class, PROP_PARENT,
|
||||||
|
g_param_spec_object ("parent", NULL, NULL,
|
||||||
|
GTK_TYPE_WIDGET,
|
||||||
|
GIMP_PARAM_WRITABLE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -193,11 +205,29 @@ gimp_dialog_set_property (GObject *object,
|
||||||
g_object_set_data (object, "gimp-dialog-help-func",
|
g_object_set_data (object, "gimp-dialog-help-func",
|
||||||
g_value_get_pointer (value));
|
g_value_get_pointer (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HELP_ID:
|
case PROP_HELP_ID:
|
||||||
g_object_set_data_full (object, "gimp-dialog-help-id",
|
g_object_set_data_full (object, "gimp-dialog-help-id",
|
||||||
g_value_dup_string (value),
|
g_value_dup_string (value),
|
||||||
(GDestroyNotify) g_free);
|
(GDestroyNotify) g_free);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PARENT:
|
||||||
|
{
|
||||||
|
GtkWidget *parent = g_value_get_object (value);
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
if (GTK_IS_WINDOW (parent))
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (object),
|
||||||
|
GTK_WINDOW (parent));
|
||||||
|
else
|
||||||
|
gtk_window_set_screen (GTK_WINDOW (object),
|
||||||
|
gtk_widget_get_screen (parent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -216,10 +246,12 @@ gimp_dialog_get_property (GObject *object,
|
||||||
g_value_set_pointer (value, g_object_get_data (object,
|
g_value_set_pointer (value, g_object_get_data (object,
|
||||||
"gimp-dialog-help-func"));
|
"gimp-dialog-help-func"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_HELP_ID:
|
case PROP_HELP_ID:
|
||||||
g_value_set_string (value, g_object_get_data (object,
|
g_value_set_string (value, g_object_get_data (object,
|
||||||
"gimp-dialog-help-id"));
|
"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);
|
||||||
break;
|
break;
|
||||||
|
@ -391,21 +423,11 @@ gimp_dialog_new_valist (const gchar *title,
|
||||||
"modal", (flags & GTK_DIALOG_MODAL),
|
"modal", (flags & GTK_DIALOG_MODAL),
|
||||||
"help-func", help_func,
|
"help-func", help_func,
|
||||||
"help-id", help_id,
|
"help-id", help_id,
|
||||||
|
"parent", parent,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
if (GTK_IS_WINDOW (parent))
|
|
||||||
{
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
|
||||||
GTK_WINDOW (parent));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gtk_window_set_screen (GTK_WINDOW (dialog),
|
|
||||||
gtk_widget_get_screen (parent));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & GTK_DIALOG_DESTROY_WITH_PARENT)
|
if (flags & GTK_DIALOG_DESTROY_WITH_PARENT)
|
||||||
g_signal_connect_object (parent, "destroy",
|
g_signal_connect_object (parent, "destroy",
|
||||||
G_CALLBACK (gimp_dialog_close),
|
G_CALLBACK (gimp_dialog_close),
|
||||||
|
|
Loading…
Reference in New Issue