resize window according to the image dimensions (Fixes bug #323204). Also,

2005-01-07  Lucas Rocha  <lucasr@gnome.org>

        * shell/eog-window.c: resize window according to the
        image dimensions (Fixes bug #323204). Also, now there's a
        "minimal" window size that will be used if the image is
        smaller than that.
This commit is contained in:
Lucas Rocha 2006-01-07 04:10:59 +00:00 committed by Lucas Almeida Rocha
parent 7fd797076d
commit e9a9b4fd4b
3 changed files with 37 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2005-01-07 Lucas Rocha <lucasr@gnome.org>
* shell/eog-window.c: resize window according to the
image dimensions (Fixes bug #323204). Also, now there's a
"minimal" window size that will be used if the image is
smaller than that.
2005-12-28 Abel Cheung <maddog@linuxhall.org>
* configure.in: Added "zh_HK" to ALL_LINGUAS.

View file

@ -84,8 +84,8 @@
/* Default size for windows */
#define DEFAULT_WINDOW_WIDTH 310
#define DEFAULT_WINDOW_HEIGHT 280
#define DEFAULT_WINDOW_WIDTH 615
#define DEFAULT_WINDOW_HEIGHT 450
#define RECENT_FILES_GROUP "Eye of Gnome"
#define EOG_WINDOW_DND_POPUP_PATH "/popups/dragndrop"
@ -96,7 +96,7 @@
#define EOG_STOCK_FLIP_HORIZONTAL "eog-stock-flip-horizontal"
#define EOG_STOCK_FLIP_VERTICAL "eog-stock-flip-vertical"
#define NO_DEBUG
#define DEBUG
#define SAVE_DEBUG
/* Private part of the Window structure */
@ -2698,21 +2698,25 @@ obtain_desired_size (EogWindow *window, int screen_width,
list = window->priv->image_list;
if (list != NULL && eog_image_list_length (list) == 1) {
if (list != NULL && eog_image_list_length (list) >= 1) {
int img_width, img_height;
int deco_width = 0, deco_height = 0;
img = eog_image_list_get_img_by_pos (list, 0);
img = eog_image_list_get_img_by_pos (list,
eog_image_list_get_initial_pos (list));
g_assert (EOG_IS_IMAGE (img));
eog_image_get_size (img, &img_width, &img_height);
get_window_decoration_size (window, &deco_width, &deco_height);
if (img_width > 0 && (img_height > 0)) {
if (img_width > 0 && img_height > 0) {
if ((img_width + deco_width > screen_width) ||
(img_height + deco_height > screen_height))
(img_height + deco_height > screen_height))
{
double factor;
if (img_width > img_height) {
factor = (screen_width * 0.75 - deco_width) / (double) img_width;
}
@ -2724,12 +2728,12 @@ obtain_desired_size (EogWindow *window, int screen_width,
}
/* determine size of whole window */
*width = img_width + deco_width;
*height = img_height + deco_height;
*width = MAX (DEFAULT_WINDOW_WIDTH, img_width + deco_width);
*height = MAX (DEFAULT_WINDOW_HEIGHT, img_height + deco_height);
#ifdef GDK_WINDOWING_X11
*x11_flags = *x11_flags | WidthValue | HeightValue;
#endif
finished = TRUE;
finished = TRUE;
}
g_object_unref (img);

View file

@ -382,10 +382,24 @@ static void
job_prepare_model_do (EogJob *job, gpointer data, GError **error)
{
LoadContext *ctx = (LoadContext*) data;
int initial_pos;
ctx->img_list = eog_image_list_new ();
/* prepare the image list */
eog_image_list_add_uris (ctx->img_list, ctx->uri_list);
initial_pos = eog_image_list_get_initial_pos (ctx->img_list);
if (initial_pos != -1) {
EogImage *img;
img = eog_image_list_get_img_by_pos (ctx->img_list, initial_pos);
if (EOG_IS_IMAGE (img)) {
eog_image_load (img, EOG_IMAGE_DATA_ALL, job, error);
g_object_unref (img);
}
}
}
static void