Marco Diego Aurélio Mesquita
2010-12-22 04:38:28 UTC
I've been talking to Tristan on IRC about how glade-previewer should
behave in the case of an update. This is what was decided:
(01:27:55) tristan: ok, in *the case that the toplevel is GtkWindow*:
(01:28:00) tristan: a.) build new window
(01:28:05) tristan: b.) ref window child
(01:28:11) tristan: c.) remove window child
(01:28:28) tristan: d.) gtk_widget_destroy the *running preview's* window child
(01:28:51) tristan: e.) apply properties from the new window to the
old window (using GObject apis)
(01:29:05) tristan: f.) add new preview's window child to the old
preview's window
(01:29:21) tristan: g.) unref the newly added child (which we added
a ref to before)
(01:29:25) tristan: that's about it.
(01:29:41) Marco: hum...
(01:29:57) tristan: in the case the toplevel is not a GtkWindow, we
anyway just have to reparent the new hierarchy into the preview
toplevel
(01:30:00) Marco: is it enough to check with GTK_IS_WINDOW?
(01:30:08) tristan: yes
(01:30:11) Marco: ok
(01:30:21) tristan: we can stick to pure GTK+/GObject apis
(01:30:29) tristan: no need to fool with the xml data etc
(01:30:39) tristan: there's one more special case
(01:30:49) tristan: from the GladePreview side of things
(01:30:56) Marco: which case?
(01:31:04) tristan: we need to temporarily force the toplevel's
visibility to be FALSE
(01:31:11) tristan: with glade_widget_property_set()
(01:31:13) Marco: why?
(01:31:21) tristan: and then restore it to the original value after
dumping the xml
(01:31:31) Marco: why?
(01:31:37) tristan: ... because GtkBuilder will *show* the new window
by itself if it's visible
(01:31:43) tristan: causing uglyness
(01:32:00) Marco: and wont it cause the window do appear and disappear?
(01:32:26) tristan: not if we force the toplevel's visibility to be
FALSE in advance
(01:32:39) tristan: i.e. ensure visible="False" in the xml given to the preview
(01:32:42) tristan: for a toplevel
(01:32:55) tristan: err s/toplevel/GtkWindow
(01:33:00) Marco: sure? the window will not jump around the screen if
we do that?
(01:33:08) tristan: exactly
(01:33:27) Marco: nor will it disappear and reappear?
(01:33:38) tristan: if we force the visibility to be FALSE then
gtkbuilder will just build the window but not show it
(01:33:53) Marco: ok
(01:33:55) tristan: we just reparent the hierarchy from glade-preview
and do our magic
(01:34:09) tristan: also, the resize should be decently ok
(01:34:27) tristan: i.e. from glade_previewer() synchronous code runs
that destroys the old child and adds the new one
_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
behave in the case of an update. This is what was decided:
(01:27:55) tristan: ok, in *the case that the toplevel is GtkWindow*:
(01:28:00) tristan: a.) build new window
(01:28:05) tristan: b.) ref window child
(01:28:11) tristan: c.) remove window child
(01:28:28) tristan: d.) gtk_widget_destroy the *running preview's* window child
(01:28:51) tristan: e.) apply properties from the new window to the
old window (using GObject apis)
(01:29:05) tristan: f.) add new preview's window child to the old
preview's window
(01:29:21) tristan: g.) unref the newly added child (which we added
a ref to before)
(01:29:25) tristan: that's about it.
(01:29:41) Marco: hum...
(01:29:57) tristan: in the case the toplevel is not a GtkWindow, we
anyway just have to reparent the new hierarchy into the preview
toplevel
(01:30:00) Marco: is it enough to check with GTK_IS_WINDOW?
(01:30:08) tristan: yes
(01:30:11) Marco: ok
(01:30:21) tristan: we can stick to pure GTK+/GObject apis
(01:30:29) tristan: no need to fool with the xml data etc
(01:30:39) tristan: there's one more special case
(01:30:49) tristan: from the GladePreview side of things
(01:30:56) Marco: which case?
(01:31:04) tristan: we need to temporarily force the toplevel's
visibility to be FALSE
(01:31:11) tristan: with glade_widget_property_set()
(01:31:13) Marco: why?
(01:31:21) tristan: and then restore it to the original value after
dumping the xml
(01:31:31) Marco: why?
(01:31:37) tristan: ... because GtkBuilder will *show* the new window
by itself if it's visible
(01:31:43) tristan: causing uglyness
(01:32:00) Marco: and wont it cause the window do appear and disappear?
(01:32:26) tristan: not if we force the toplevel's visibility to be
FALSE in advance
(01:32:39) tristan: i.e. ensure visible="False" in the xml given to the preview
(01:32:42) tristan: for a toplevel
(01:32:55) tristan: err s/toplevel/GtkWindow
(01:33:00) Marco: sure? the window will not jump around the screen if
we do that?
(01:33:08) tristan: exactly
(01:33:27) Marco: nor will it disappear and reappear?
(01:33:38) tristan: if we force the visibility to be FALSE then
gtkbuilder will just build the window but not show it
(01:33:53) Marco: ok
(01:33:55) tristan: we just reparent the hierarchy from glade-preview
and do our magic
(01:34:09) tristan: also, the resize should be decently ok
(01:34:27) tristan: i.e. from glade_previewer() synchronous code runs
that destroys the old child and adds the new one
_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel