summaryrefslogtreecommitdiff
path: root/libeog
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@redhat.com>1999-11-22 17:21:07 +0000
committerArturo Espinosa <unammx@src.gnome.org>1999-11-22 17:21:07 +0000
commit5251e3fb947f468edc7e5e0a3de3e31f607eb73a (patch)
treebe935c262cd7e90b433d60fff203eb0ed06d0454 /libeog
parentc52231f54ec7ee15ad121e1807dd803e3d912e53 (diff)
downloadeog-5251e3fb947f468edc7e5e0a3de3e31f607eb73a.tar.gz
Do not set the window title here, especially not with a
1999-11-21 Federico Mena Quintero <federico@redhat.com> * ui-image.c (ui_image_set_image): Do not set the window title here, especially not with a gtk_widget_get_toplevel() hack. An UIImage object may not only be the content area of a toplevel window; it may appear as a little preview pane in the future as well. * window.c (window_open_image): Set the window title to the image filename here. Revert to the default title if the image could not be loaded. * image.c (image_load): Free the previous filename if it exists. Also, NULLify the filename field if the file could not be loaded.
Diffstat (limited to 'libeog')
-rw-r--r--libeog/image.c22
-rw-r--r--libeog/image.h6
-rw-r--r--libeog/ui-image.c8
3 files changed, 19 insertions, 17 deletions
diff --git a/libeog/image.c b/libeog/image.c
index 75612541..f2a07281 100644
--- a/libeog/image.c
+++ b/libeog/image.c
@@ -26,10 +26,10 @@
/**
* image_new:
- * @void:
- *
+ * @void:
+ *
* Creates a new empty image structure with a reference count of 1.
- *
+ *
* Return value: A newly-created image structure.
**/
Image *
@@ -59,7 +59,7 @@ image_new (void)
/**
* image_ref:
* @image: An image structure.
- *
+ *
* Adds a reference to an image.
**/
void
@@ -74,7 +74,7 @@ image_ref (Image *image)
/**
* image_unref:
* @image: An image structure.
- *
+ *
* Removes a reference from an image. If the reference count drops to zero,
* then the image is freed.
**/
@@ -96,7 +96,7 @@ image_unref (Image *image)
if (image->filename)
g_free (image->filename);
-
+
g_free (image);
}
}
@@ -105,9 +105,9 @@ image_unref (Image *image)
* image_load:
* @image: An image structure.
* @filename: Name of file with image data.
- *
+ *
* Loads an image from the specified file.
- *
+ *
* Return value: TRUE on success, FALSE otherwise.
**/
gboolean
@@ -121,9 +121,13 @@ image_load (Image *image, const char *filename)
image->pixbuf = gdk_pixbuf_new_from_file (filename);
+ if (image->filename)
+ g_free (image->filename);
+
if (image->pixbuf)
image->filename = g_strdup (filename);
+ else
+ image->filename = NULL;
return (image->pixbuf != NULL);
}
-
diff --git a/libeog/image.h b/libeog/image.h
index afc08df6..1f283b91 100644
--- a/libeog/image.h
+++ b/libeog/image.h
@@ -31,14 +31,14 @@ typedef struct {
/* Reference count */
guint ref_count;
+ /* Name of file this image was loaded from */
+ char *filename;
+
/* Buffer with original image data */
GdkPixbuf *pixbuf;
/* Color substitution tables */
guchar *r_lut, *g_lut, *b_lut;
-
- /* The file name this Image represents */
- char *filename;
} Image;
Image *image_new (void);
diff --git a/libeog/ui-image.c b/libeog/ui-image.c
index 6a983b84..7754438f 100644
--- a/libeog/ui-image.c
+++ b/libeog/ui-image.c
@@ -116,6 +116,9 @@ ui_image_init (UIImage *ui)
priv = g_new0 (UIImagePrivate, 1);
ui->priv = priv;
+
+ GTK_WIDGET_SET_FLAGS (ui, GTK_CAN_FOCUS);
+
priv->zoom = 1.0;
gtk_scroll_frame_set_shadow_type (GTK_SCROLL_FRAME (ui), GTK_SHADOW_IN);
@@ -360,7 +363,6 @@ void
ui_image_set_image (UIImage *ui, Image *image)
{
UIImagePrivate *priv;
- GtkWidget *toplevel;
int w, h;
g_return_if_fail (ui != NULL);
@@ -374,10 +376,6 @@ ui_image_set_image (UIImage *ui, Image *image)
if (image)
image_ref (image);
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (ui));
- if (toplevel && image->filename)
- gtk_window_set_title (GTK_WINDOW (toplevel), g_basename (image->filename));
-
if (priv->image)
image_unref (priv->image);