mirror of https://github.com/MidnightCommander/mc
1998-03-31 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gcache.c: Added an Image cache for all of the imlib-loaded images to avoid destroying/reloading the images. * gdesktop.c, gtrans.c: Use the image cache.
This commit is contained in:
parent
175f488cb8
commit
0842a5390c
|
@ -1,3 +1,10 @@
|
|||
1998-03-31 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gcache.c: Added an Image cache for all of the imlib-loaded
|
||||
images to avoid destroying/reloading the images.
|
||||
|
||||
* gdesktop.c, gtrans.c: Use the image cache.
|
||||
|
||||
1998-03-24 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gscreen.c (x_create_panel): Show the GnomeApp when we are done
|
||||
|
|
|
@ -32,7 +32,8 @@ GNOMESRCS = \
|
|||
gprop.c \
|
||||
gmc-chargrid.c \
|
||||
gpageprop.c \
|
||||
gcliplabel.c
|
||||
gcliplabel.c \
|
||||
gcache.c
|
||||
|
||||
GNOMEHDRS = \
|
||||
gmain.h \
|
||||
|
@ -44,7 +45,8 @@ GNOMEHDRS = \
|
|||
gprop.h \
|
||||
gpageprop.h \
|
||||
gmc-chargrid.h \
|
||||
gcliplabel.h
|
||||
gcliplabel.h \
|
||||
gcache.h
|
||||
|
||||
ICONS = \
|
||||
$(srcdir)/directory-ok.xpm \
|
||||
|
@ -86,7 +88,8 @@ OBJS = $(LOBJS) $(OOBJS) \
|
|||
gview.o \
|
||||
gprop.o \
|
||||
gpageprop.o \
|
||||
gcliplabel.o
|
||||
gcliplabel.o \
|
||||
gcache.o
|
||||
|
||||
#
|
||||
# Distribution variables
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Simple Image cache for images
|
||||
* Copyright (C) 1998 the Free Software Foundation
|
||||
*
|
||||
* Author: Miguel de Icaza (miguel@kernel.org)
|
||||
*/
|
||||
#include <gnome.h>
|
||||
#include <string.h>
|
||||
#include "gcache.h"
|
||||
static GHashTable *image_cache;
|
||||
|
||||
static void
|
||||
destroy_image_callback (gpointer key, gpointer data, gpointer user_data)
|
||||
{
|
||||
gdk_imlib_destroy_image (data);
|
||||
}
|
||||
|
||||
void
|
||||
image_cache_destroy ()
|
||||
{
|
||||
g_hash_table_foreach (image_cache, destroy_image_callback, NULL);
|
||||
g_hash_table_destroy (image_cache);
|
||||
}
|
||||
|
||||
GdkImlibImage *
|
||||
image_cache_load_image (char *file)
|
||||
{
|
||||
void *data;
|
||||
|
||||
if (!image_cache)
|
||||
image_cache = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
data = g_hash_table_lookup (image_cache, file);
|
||||
if (data)
|
||||
return data;
|
||||
|
||||
data = gdk_imlib_load_image (file);
|
||||
if (data){
|
||||
g_hash_table_insert (image_cache, file, data);
|
||||
}
|
||||
return data;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef GCACHE_H
|
||||
#define GCACHE_H
|
||||
|
||||
void image_cache_destroy ();
|
||||
GdkImlibImage *image_cache_load_image (char *file);
|
||||
|
||||
#endif
|
|
@ -1083,4 +1083,5 @@ stop_desktop (void)
|
|||
|
||||
desktop_release_desktop_icon_t (di);
|
||||
}
|
||||
image_cache_destroy ();
|
||||
}
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
All:
|
||||
- It crashes
|
||||
|
||||
- It leaks objects.
|
||||
- argp handling.
|
||||
- Session management
|
||||
|
||||
Desktop:
|
||||
|
||||
- Add special destkop entries ("Network neighborhood")
|
||||
|
||||
Panels:
|
||||
|
||||
- Global bindings (some shortcuts are not implemented)
|
||||
- Add a nifty toolbar
|
||||
- Add a nifty toolbar:
|
||||
- Back/Forward/History buttons are trivial to implement
|
||||
with the new history code from Paul Sheer.
|
||||
- Split view.
|
||||
- External panelize hangs
|
||||
|
||||
|
||||
Viewer:
|
||||
|
||||
- Toolbar
|
||||
|
@ -23,9 +28,11 @@ Viewer:
|
|||
- Debug monitor
|
||||
|
||||
Widgets:
|
||||
|
||||
- Push history
|
||||
- Use Gnome File Entry where possible.
|
||||
|
||||
DND:
|
||||
|
||||
- Get sopwith to fix the random motion of his dnd icons.
|
||||
- Check the purify stuff.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <gnome.h>
|
||||
#include <string.h>
|
||||
#include "gdesktop.h"
|
||||
#include "gcache.h"
|
||||
#include <gdk/gdkx.h>
|
||||
/* The spacing between the cute little icon and the text */
|
||||
#define SPACING 2
|
||||
|
@ -249,11 +250,12 @@ create_transparent_text_window (char *file, char *text, int extra_events)
|
|||
GtkWidget *window;
|
||||
GdkImlibImage *im;
|
||||
static GdkCursor *cursor;
|
||||
|
||||
|
||||
if (!g_file_exists (file))
|
||||
return NULL;
|
||||
|
||||
im = gdk_imlib_load_image (file);
|
||||
|
||||
|
||||
im = image_cache_load_image (file);
|
||||
if (!im)
|
||||
return NULL;
|
||||
|
||||
|
@ -272,8 +274,6 @@ create_transparent_text_window (char *file, char *text, int extra_events)
|
|||
|
||||
set_window_text (window, im, text);
|
||||
|
||||
gdk_imlib_destroy_image (im);
|
||||
|
||||
if (!cursor)
|
||||
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW); /* FIXME: this is never freed */
|
||||
|
||||
|
@ -292,7 +292,7 @@ make_transparent_window (char *file)
|
|||
if (!g_file_exists (file))
|
||||
return NULL;
|
||||
|
||||
im = gdk_imlib_load_image (file);
|
||||
im = image_cache_load_image (file);
|
||||
if (!im)
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue