r15596 - gnucash/branches/2.0 - Make new windows the same size as the active one. Fix #341968.

Derek Atkins warlord at cvs.gnucash.org
Sun Feb 18 00:22:42 EST 2007


Author: warlord
Date: 2007-02-18 00:22:42 -0500 (Sun, 18 Feb 2007)
New Revision: 15596
Trac: http://svn.gnucash.org/trac/changeset/15596

Modified:
   gnucash/branches/2.0/
   gnucash/branches/2.0/ChangeLog
   gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
Log:
Make new windows the same size as the active one. Fix #341968.

New main windows appear very small, so set their size to the one of the
currently active window.  If that is in a maximized state, maximize the
new windows too.  However, do not try to position them.

Merge from r15569.



Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14161
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:14162
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282

Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog	2007-02-18 05:22:27 UTC (rev 15595)
+++ gnucash/branches/2.0/ChangeLog	2007-02-18 05:22:42 UTC (rev 15596)
@@ -1,3 +1,12 @@
+2007-02-18  Andreas Köhler  <andi5.py at gmx.net>
+
+	Make new windows the same size as the active one. Fix #341968.
+
+	New main windows appear very small, so set their size to the one
+	of the currently active window.  If that is in a maximized state,
+	maximize the new windows too.  However, do not try to position
+	them.
+
 2007-02-18  Christian Stimming <stimming at tuhh.de>
 
 	Add sanity checks when accessing GncPluginPage. Fixes #405851 and

Modified: gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c	2007-02-18 05:22:27 UTC (rev 15595)
+++ gnucash/branches/2.0/src/gnome-utils/gnc-main-window.c	2007-02-18 05:22:42 UTC (rev 15596)
@@ -1879,8 +1879,18 @@
 gnc_main_window_new (void)
 {
 	GncMainWindow *window;
+	gncUIWidget old_window;
 
 	window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL);
+	old_window = gnc_ui_get_toplevel();
+	if (old_window) {
+	  gint width, height;
+	  gtk_window_get_size (GTK_WINDOW (old_window), &width, &height);
+	  gtk_window_resize (GTK_WINDOW (window), width, height);
+	  if ((gdk_window_get_state((GTK_WIDGET(old_window))->window)
+	       & GDK_WINDOW_STATE_MAXIMIZED) != 0)
+	    gtk_window_maximize (GTK_WINDOW (window));
+	}
 	active_windows = g_list_append (active_windows, window);
 	gnc_main_window_update_all_menu_items();
 	return window;
@@ -3332,15 +3342,19 @@
  *                                                          *
  ************************************************************/
 
-/** Get a pointer to a top level window... any top level window.  This
- *  function just returns a pointer to the first window.
+/** Get a pointer to the first active top level window or NULL
+ *  if there is none.
  *
  *  @return A pointer to a GtkWindow object. */
 gncUIWidget
 gnc_ui_get_toplevel (void)
 {
-  if (active_windows)
-    return active_windows->data;
+  GList *window;
+
+  for (window=active_windows; window; window=window->next)
+    if (gtk_window_is_active (GTK_WINDOW (window->data)))
+      return window->data;
+
   return NULL;
 }
 



More information about the gnucash-changes mailing list