|
|
|
|
@ -546,41 +546,49 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
|
|
|
|
|
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
|
|
|
|
|
|
|
|
|
/* Get the window coordinates, etc. */
|
|
|
|
|
pos = g_key_file_get_integer_list(data->key_file, window_group,
|
|
|
|
|
WINDOW_POSITION, &length, &error);
|
|
|
|
|
geom = g_key_file_get_integer_list(data->key_file, window_group,
|
|
|
|
|
WINDOW_GEOMETRY, &length, &error);
|
|
|
|
|
if (error) {
|
|
|
|
|
g_warning("error reading group %s key %s: %s",
|
|
|
|
|
window_group, WINDOW_POSITION, error->message);
|
|
|
|
|
window_group, WINDOW_GEOMETRY, error->message);
|
|
|
|
|
g_error_free(error);
|
|
|
|
|
error = NULL;
|
|
|
|
|
} else if (length != 2) {
|
|
|
|
|
g_warning("invalid number of values for group %s key %s",
|
|
|
|
|
window_group, WINDOW_POSITION);
|
|
|
|
|
window_group, WINDOW_GEOMETRY);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);
|
|
|
|
|
DEBUG("window (%p) position %dx%d", window, pos[0], pos[1]);
|
|
|
|
|
}
|
|
|
|
|
if (pos) {
|
|
|
|
|
g_free(pos);
|
|
|
|
|
gtk_window_resize(GTK_WINDOW(window), geom[0], geom[1]);
|
|
|
|
|
DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]);
|
|
|
|
|
}
|
|
|
|
|
/* keep the geometry for a test whether the windows position
|
|
|
|
|
is offscreen */
|
|
|
|
|
|
|
|
|
|
geom = g_key_file_get_integer_list(data->key_file, window_group,
|
|
|
|
|
WINDOW_GEOMETRY, &length, &error);
|
|
|
|
|
pos = g_key_file_get_integer_list(data->key_file, window_group,
|
|
|
|
|
WINDOW_POSITION, &length, &error);
|
|
|
|
|
if (error) {
|
|
|
|
|
g_warning("error reading group %s key %s: %s",
|
|
|
|
|
window_group, WINDOW_GEOMETRY, error->message);
|
|
|
|
|
window_group, WINDOW_POSITION, error->message);
|
|
|
|
|
g_error_free(error);
|
|
|
|
|
error = NULL;
|
|
|
|
|
} else if (length != 2) {
|
|
|
|
|
g_warning("invalid number of values for group %s key %s",
|
|
|
|
|
window_group, WINDOW_GEOMETRY);
|
|
|
|
|
window_group, WINDOW_POSITION);
|
|
|
|
|
} else if ((pos[0] + (geom ? geom[0] : 0) < 0) ||
|
|
|
|
|
(pos[0] > gdk_screen_width()) ||
|
|
|
|
|
(pos[1] + (geom ? geom[1] : 0) < 0) ||
|
|
|
|
|
(pos[1] > gdk_screen_height())) {
|
|
|
|
|
g_debug("position %dx%d, size%dx%d is offscreen; will not move",
|
|
|
|
|
pos[0], pos[1], geom[0], geom[1]);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_window_resize(GTK_WINDOW(window), geom[0], geom[1]);
|
|
|
|
|
DEBUG("window (%p) size %dx%d", window, geom[0], geom[1]);
|
|
|
|
|
gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);
|
|
|
|
|
DEBUG("window (%p) position %dx%d", window, pos[0], pos[1]);
|
|
|
|
|
}
|
|
|
|
|
if (geom) {
|
|
|
|
|
g_free(geom);
|
|
|
|
|
}
|
|
|
|
|
if (pos) {
|
|
|
|
|
g_free(pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
max = g_key_file_get_boolean(data->key_file, window_group,
|
|
|
|
|
WINDOW_MAXIMIZED, &error);
|
|
|
|
|
|