[gimp] Create the new display ID in set_property() not in gimp_display_new()
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Create the new display ID in set_property() not in gimp_display_new()
- Date: Sun, 4 Oct 2009 20:00:30 +0000 (UTC)
commit 161f1346db29cda9545ad2934d838ff1fe0657a4
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 4 21:58:12 2009 +0200
Create the new display ID in set_property() not in gimp_display_new()
Make the ID a read-only property and set it when the "gimp"
construct-only property gets set. Removes code from gimp_display_new()
where it doesn't belong.
app/display/gimpdisplay.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index c32a5aa..92e029a 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -121,8 +121,7 @@ gimp_display_class_init (GimpDisplayClass *klass)
g_param_spec_int ("id",
NULL, NULL,
0, G_MAXINT, 0,
- GIMP_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
+ GIMP_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_GIMP,
g_param_spec_object ("gimp",
@@ -183,15 +182,27 @@ gimp_display_set_property (GObject *object,
switch (property_id)
{
- case PROP_ID:
- display->ID = g_value_get_int (value);
- break;
-
case PROP_GIMP:
- display->gimp = g_value_get_object (value); /* don't ref the gimp */
- display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
+ {
+ gint ID;
+
+ display->gimp = g_value_get_object (value); /* don't ref the gimp */
+ display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
+
+ do
+ {
+ ID = display->gimp->next_display_ID++;
+
+ if (display->gimp->next_display_ID == G_MAXINT)
+ display->gimp->next_display_ID = 1;
+ }
+ while (gimp_display_get_by_ID (display->gimp, ID));
+
+ display->ID = ID;
+ }
break;
+ case PROP_ID:
case PROP_IMAGE:
case PROP_SHELL:
g_assert_not_reached ();
@@ -358,7 +369,6 @@ gimp_display_new (Gimp *gimp,
GimpDisplay *display;
GimpImageWindow *window = NULL;
GimpDisplayShell *shell;
- gint ID;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
@@ -367,17 +377,7 @@ gimp_display_new (Gimp *gimp,
if (gimp->no_interface)
return NULL;
- do
- {
- ID = gimp->next_display_ID++;
-
- if (gimp->next_display_ID == G_MAXINT)
- gimp->next_display_ID = 1;
- }
- while (gimp_display_get_by_ID (gimp, ID));
-
display = g_object_new (GIMP_TYPE_DISPLAY,
- "id", ID,
"gimp", gimp,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]