saving and restoring dock layout

Kevin Finn kevinfinn@mediaone.net
Sat, 21 Apr 2001 02:57:21 -0500


This is a multi-part message in MIME format.
--------------B1FC8F808FEAA40DBA011235
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

     I was looking into the question of why the saved summarybar
position isn't restored, and I think I know what's going on.  What seems
to happen is:

gnome_app_add_docked(GNOME_APP(app), summarybar, "Summary Bar", ...
   gnome_app_add_dock_item
      gtk_signal_emit_by_name ( ... "layout_changed" ...)

When layout_changed is called, it calls gnome_dock_get_layout before
writing the layout config to a file.  At this point the layout hasn't
been read from the file yet.  gnome_dock_get_layout creates a new layout
and returns it, rather than loading it from the file, and so at this
point the "default" dock layout has been written to the config file,
destroying the layout that was saved the last time you exited GnuCash. 
When gnome_app_show is eventually called, it finally reads the config
file and creates the old (default) layout.

     It seems to me that the problem is writing the layout before ever
reading it (see debugging output below as well).  So I just replaced the
gnome_app_add_docked call for the summarybar with a simplified version
of that function and gnome_app_add_dock_item that doesn't emit
layout_changed.  Since layout_changed seems to get called again a couple
times before the gnome_app_show, the layout changes are still displayed
correctly.  The attached patch also flags the summary bar to be
NEVER_VERTICAL, because it's pretty ugly if you're dragging it around
and it snaps to be a vertical toolbar.  With these changes, the
summarybar will remain at the bottom of the app window (or wherever else
you put it I assume) after you exit and restart GnuCash.

     The only remaining problem is that if you have multiple windows
(for example, an accounts list window and the new "welcome" report), and
you have the summarybar in different spots in the two windows, when you
restart they are both in the same position in the two different
windows.  This is kind of weird, since the ~/.gnome/GnuCash file does
list the different layouts for each app window.  I have to look at this
some more.

     Kevin     

P.S. OK, the fact that dragging around the various toolbars is really
slow and jerky is a problem too, but not a GnuCash-specific one I
assume.  gedit seems to have the same problem, for example.  At the best
of times, grabbing a toolbar by the handle and shaking it is
considerably slower than grabbing an xterm by the WM handle and shaking
it, and at the worst of times GnuCash actually freezes for several
seconds if I grab a toolbar handle and quickly drag down across the
desktop.  
      

libgnomeui debugging output (before the attached fix):

This is a development version. It may or may not work.
Report bugs and other problems to gnucash-devel@gnucash.org.
The last stable version was gnucash-1.4.11.
The next stable version will be gnucash-1.6.0.

libgnomeui:gnome_app_init: enable_layout_config is now -1
libgnomeui:gnome_app_enable_layout_config: enable_layout_config is now
-1
libgnomeui:layout_changed: writing layout config
libgnomeui:gnome_app_show: reading layout config
libgnomeui:layout_changed: writing layout config
libgnomeui:layout_changed: writing layout config
libgnomeui:gnome_app_show: writing layout config
libgnomeui:layout_changed: writing layout config
libgnomeui:layout_changed: writing layout config

-- 

Kevin Finn
kevinfinn@mediaone.net
--------------B1FC8F808FEAA40DBA011235
Content-Type: application/octet-stream;
 name="gnucash-20010421-023829-kevin.diff.gz"
Content-Transfer-Encoding: x-uuencode
Content-Disposition: attachment;
 filename="gnucash-20010421-023829-kevin.diff.gz"

begin 664 gnucash-20010421-023829-kevin.diff.gz
M'XL("%DYX3H"`V=N=6-A<V@M,C`P,3`T,C$M,#(S.#(Y+6ME=FEN+F1I9F8`
MM5S[5^,V%OYY^2MTR@_`$.?%S/#HZ9[2-,.R98"%S.RV34^.8BNV&]OR6#()
M?>S?OE>R\TZ:*R7+8<A@W^^[3UW)LO$AZ02A(/!-24JE&Y`!SXB?Y"X5@9-F
MH9!APHCD)$\]*AD)I?JE%#@X)/#=X82F:?1*I*+2+%=P^+G3?B2-*](*O#!3
M(!DP(GB>N8S`$>9*GKU6)X+-*_*4)UKF2+-IGB.29MS/:$Q&H0SF%)!!&#%"
MP?(DS26P`,_M@+SRG'B<)%R2@+XL4E64[1J?2<('A:J8#ME$$W6'U&=`)`,J
M-95+$S)@6EW&8XUH\3C-6,`2$0+_(\LB<IVY@?KEGLD1SX;*]T#*]*I6&XU&
MU11$JBZ/:ZW'Z_L:S67`,U'[)P]HTOL,K#01M:D5SKCZ6I4TJ_J_*8>*>-`^
M!_9/3W<5<C0^(B+@>>21/B--`KD*0C]@61&!-9G0@>.YU$RY8,KS^:CLEJF-
M25I-#WR1=N(I_8\9HW$?!-3!@^+4HS862HQ"!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