Andreas Köhler's patches to remember/restore maximized windows, and to

shrink the size of the close button on notebook tabs.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12167 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2005-12-20 02:06:43 +00:00
parent 39cb13a7d4
commit f3425a946e
2 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-12-19 David Hampton <hampton@employees.org>
* src/gnome-utils/gnc-main-window.c: Andreas Köhler's patches to
remember/restore maximized windows, and to shrink the size of the
close button on notebook tabs.
2005-12-18 Christian Stimming <stimming@tuhh.de> 2005-12-18 Christian Stimming <stimming@tuhh.de>
* src/report/standard-reports/*.scm: I18n string cleanup: Fix * src/report/standard-reports/*.scm: I18n string cleanup: Fix

View File

@ -366,6 +366,7 @@ static const gchar *multiple_page_actions[] = {
#define WINDOW_STRING "Window %d" #define WINDOW_STRING "Window %d"
#define WINDOW_GEOMETRY "Window Geometry" #define WINDOW_GEOMETRY "Window Geometry"
#define WINDOW_POSITION "Window Position" #define WINDOW_POSITION "Window Position"
#define WINDOW_MAXIMIZED "Window Maximized"
#define WINDOW_FIRSTPAGE "First Page" #define WINDOW_FIRSTPAGE "First Page"
#define WINDOW_PAGECOUNT "Page Count" #define WINDOW_PAGECOUNT "Page Count"
#define PAGE_TYPE "Page Type" #define PAGE_TYPE "Page Type"
@ -472,6 +473,7 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
GncMainWindowPrivate *priv; GncMainWindowPrivate *priv;
gint *pos, *geom; gint *pos, *geom;
gsize length; gsize length;
gboolean max;
gchar *window_group; gchar *window_group;
gint page_start, page_count, i; gint page_start, page_count, i;
GError *error = NULL; GError *error = NULL;
@ -513,6 +515,17 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]); DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]);
} }
max = g_key_file_get_boolean(data->key_file, window_group,
WINDOW_MAXIMIZED, &error);
if (error) {
g_warning("error reading group %s key %s: %s",
window_group, WINDOW_MAXIMIZED, error->message);
g_error_free(error);
error = NULL;
} else if (max) {
gtk_window_maximize(GTK_WINDOW(window));
}
/* Get this window's notebook info */ /* Get this window's notebook info */
page_start = g_key_file_get_integer(data->key_file, page_start = g_key_file_get_integer(data->key_file,
window_group, WINDOW_FIRSTPAGE, &error); window_group, WINDOW_FIRSTPAGE, &error);
@ -716,6 +729,7 @@ gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
{ {
GncMainWindowPrivate *priv; GncMainWindowPrivate *priv;
gint num_pages, coords[4]; gint num_pages, coords[4];
gboolean maximized;
gchar *window_group; gchar *window_group;
/* Setup */ /* Setup */
@ -727,12 +741,17 @@ gnc_main_window_save_window (GncMainWindow *window, GncMainWindowSaveData *data)
/* Save the window coordinates, etc. */ /* Save the window coordinates, etc. */
gtk_window_get_position(GTK_WINDOW(window), &coords[0], &coords[1]); gtk_window_get_position(GTK_WINDOW(window), &coords[0], &coords[1]);
gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]); gtk_window_get_size(GTK_WINDOW(window), &coords[2], &coords[3]);
maximized = (gdk_window_get_state((GTK_WIDGET(window))->window)
& GDK_WINDOW_STATE_MAXIMIZED) != 0;
g_key_file_set_integer_list(data->key_file, window_group, g_key_file_set_integer_list(data->key_file, window_group,
WINDOW_POSITION, &coords[0], 2); WINDOW_POSITION, &coords[0], 2);
g_key_file_set_integer_list(data->key_file, window_group, g_key_file_set_integer_list(data->key_file, window_group,
WINDOW_GEOMETRY, &coords[2], 2); WINDOW_GEOMETRY, &coords[2], 2);
DEBUG("window (%p) position %dx%d, size %dx%d", window, coords[0], coords[1], g_key_file_set_boolean(data->key_file, window_group,
coords[2], coords[3]); WINDOW_MAXIMIZED, maximized);
DEBUG("window (%p) position %dx%d, size %dx%d, %s", window, coords[0], coords[1],
coords[2], coords[3],
maximized ? "maximized" : "not maximized");
/* Save this window's notebook info */ /* Save this window's notebook info */
num_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook)); num_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->notebook));
@ -1963,11 +1982,16 @@ gnc_main_window_open_page (GncMainWindow *window,
/* Add close button - Not for immutable pages */ /* Add close button - Not for immutable pages */
if (!immutable) { if (!immutable) {
GtkWidget *close_image, *close_button; GtkWidget *close_image, *close_button;
GtkRequisition requisition;
close_button = gtk_button_new(); close_button = gtk_button_new();
gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE);
close_image=gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
gtk_widget_show(close_image); gtk_widget_show(close_image);
gtk_widget_size_request(close_image, &requisition);
gtk_widget_set_size_request(close_button, requisition.width + 4,
requisition.height + 2);
gtk_button_set_alignment(GTK_BUTTON(close_button), 0.5, 0.5);
gtk_container_add(GTK_CONTAINER(close_button), close_image); gtk_container_add(GTK_CONTAINER(close_button), close_image);
if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SHOW_CLOSE_BUTTON, NULL)) if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_SHOW_CLOSE_BUTTON, NULL))
gtk_widget_show (close_button); gtk_widget_show (close_button);