1
1

1998-12-08 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there
	for reference purposes.

	* gmetadata.c: Removed the gmeta_get_icon_for_file() function, as
	it is obsoleted by gicon_get_icon_for_file().

	* gdesktop.c (desktop_icon_info_new): Made it use
	gicon_get_icon_for_file().

	* gdesktop-icon.c (set_icon): Now we handle things internally
	using an imlib image, not a filename.
	(desktop_icon_new): Now takes an imlib image for the icon instead
	of a filename.
	(desktop_icon_set_icon): Likewise.
Этот коммит содержится в:
Miguel de Icaza 1998-12-09 17:23:38 +00:00
родитель b3876e6f41
Коммит 44a1b32eeb
7 изменённых файлов: 1527 добавлений и 1558 удалений

Просмотреть файл

@ -1,3 +1,20 @@
1998-12-08 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c: Moved the old DnD cruft to olddnd.c to keep it there
for reference purposes.
* gmetadata.c: Removed the gmeta_get_icon_for_file() function, as
it is obsoleted by gicon_get_icon_for_file().
* gdesktop.c (desktop_icon_info_new): Made it use
gicon_get_icon_for_file().
* gdesktop-icon.c (set_icon): Now we handle things internally
using an imlib image, not a filename.
(desktop_icon_new): Now takes an imlib image for the icon instead
of a filename.
(desktop_icon_set_icon): Likewise.
1998-12-08 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-12-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtkdtree.c (gtk_dtree_new): Use imlib's visual and colormap. * gtkdtree.c (gtk_dtree_new): Use imlib's visual and colormap.

Просмотреть файл

@ -180,24 +180,15 @@ desktop_icon_realize (GtkWidget *widget)
NULL); NULL);
} }
/* Sets the icon from the specified image file. Does not re-create the window shape for the desktop /* Sets the icon from the specified image. Does not re-create the window shape for the desktop
* icon. * icon.
*/ */
static void static void
set_icon (DesktopIcon *dicon, char *image_file) set_icon (DesktopIcon *dicon, GdkImlibImage *im)
{ {
GdkImlibImage *im, *old_im; GdkImlibImage *old_im;
GtkArg arg; GtkArg arg;
/* Load the new image */
if (!g_file_exists (image_file))
return;
im = gdk_imlib_load_image (image_file);
if (!im)
return;
/* Destroy the old image if it exists */ /* Destroy the old image if it exists */
arg.name = "image"; arg.name = "image";
@ -242,7 +233,7 @@ set_text (DesktopIcon *dicon, char *text)
/** /**
* desktop_icon_new * desktop_icon_new
* @image_file: Name of the image file that contains the icon. * @image: Imlib image with the icon.
* @text: Text to use for the icon. * @text: Text to use for the icon.
* *
* Creates a new desktop icon widget with the specified icon image and text. The icon has to be * Creates a new desktop icon widget with the specified icon image and text. The icon has to be
@ -251,16 +242,16 @@ set_text (DesktopIcon *dicon, char *text)
* Returns the newly-created desktop icon widget. * Returns the newly-created desktop icon widget.
*/ */
GtkWidget * GtkWidget *
desktop_icon_new (char *image_file, char *text) desktop_icon_new (GdkImlibImage *image, char *text)
{ {
DesktopIcon *dicon; DesktopIcon *dicon;
g_return_val_if_fail (image_file != NULL, NULL); g_return_val_if_fail (image != NULL, NULL);
g_return_val_if_fail (text != NULL, NULL); g_return_val_if_fail (text != NULL, NULL);
dicon = gtk_type_new (desktop_icon_get_type ()); dicon = gtk_type_new (desktop_icon_get_type ());
set_icon (dicon, image_file); set_icon (dicon, image);
set_text (dicon, text); set_text (dicon, text);
desktop_icon_reshape (dicon); desktop_icon_reshape (dicon);
@ -270,18 +261,18 @@ desktop_icon_new (char *image_file, char *text)
/** /**
* desktop_icon_set_icon * desktop_icon_set_icon
* @dicon: The desktop icon to set the icon for * @dicon: The desktop icon to set the icon for
* @image_file: Name of the image file that contains the icon * @image: Imlib image with the icon.
* *
* Sets a new icon for an existing desktop icon. If the file does not exist, it does nothing. * Sets a new icon for an existing desktop icon.
*/ */
void void
desktop_icon_set_icon (DesktopIcon *dicon, char *image_file) desktop_icon_set_icon (DesktopIcon *dicon, GdkImlibImage *image)
{ {
g_return_if_fail (dicon != NULL); g_return_if_fail (dicon != NULL);
g_return_if_fail (IS_DESKTOP_ICON (dicon)); g_return_if_fail (IS_DESKTOP_ICON (dicon));
g_return_if_fail (image_file != NULL); g_return_if_fail (image != NULL);
set_icon (dicon, image_file); set_icon (dicon, image);
desktop_icon_reshape (dicon); desktop_icon_reshape (dicon);
} }

Просмотреть файл

@ -52,11 +52,11 @@ struct _DesktopIconClass {
/* Standard Gtk function */ /* Standard Gtk function */
GtkType desktop_icon_get_type (void); GtkType desktop_icon_get_type (void);
/* Creates a new desktop icon from the specified image file, and with the specified title */ /* Creates a new desktop icon from the specified image, and with the specified title */
GtkWidget *desktop_icon_new (char *image_file, char *text); GtkWidget *desktop_icon_new (GdkImlibImage *image, char *text);
/* Sets the icon from the specified file name */ /* Sets the icon from the specified image */
void desktop_icon_set_icon (DesktopIcon *dicon, char *image_file); void desktop_icon_set_icon (DesktopIcon *dicon, GdkImlibImage *image);
/* Sets the icon's text */ /* Sets the icon's text */
void desktop_icon_set_text (DesktopIcon *dicon, char *text); void desktop_icon_set_text (DesktopIcon *dicon, char *text);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,44 +13,9 @@
#include "../vfs/vfs.h" #include "../vfs/vfs.h"
#define ICON_FILENAME "icon-filename"
#define ICON_POSITION "icon-position" #define ICON_POSITION "icon-position"
/**
* gmeta_get_icon_for_file
* @filename: The name of the file to get the icon for.
*
* Computes the name of the file that holds the icon for the specified file. The
* resulting string is guaranteed to be non-NULL. You have to free this string
* on your own.
*
* Returns the icon's file name.
*/
char *
gmeta_get_icon_for_file (char *filename)
{
int size;
char *buf;
struct stat s;
int retval;
g_return_val_if_fail (filename != NULL, NULL);
if (gnome_metadata_get (filename, ICON_FILENAME, &size, &buf) != 0) {
/* Return a default icon */
retval = mc_stat (filename, &s);
if (!retval && S_ISDIR (s.st_mode))
return gnome_unconditional_pixmap_file ("gnome-folder.png");
else
return gnome_unconditional_pixmap_file ("gnome-unknown.png");
}
return buf;
}
/** /**
* gmeta_get_icon_pos * gmeta_get_icon_pos
* @filename: The file under ~/desktop for which to get the icon position * @filename: The file under ~/desktop for which to get the icon position

Просмотреть файл

@ -9,9 +9,6 @@
#define GMETADATA_H #define GMETADATA_H
/* Returns the icon filename for the specified file. You must free the name. */
char *gmeta_get_icon_for_file (char *filename);
/* Returns the coordinates of the icon corresponding to the specified file. If no position /* Returns the coordinates of the icon corresponding to the specified file. If no position
* has been set, returns FALSE. Else it returns TRUE and sets the *x and *y values. * has been set, returns FALSE. Else it returns TRUE and sets the *x and *y values.
*/ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу