1999-02-17 Miguel de Icaza <miguel@nuclecu.unam.mx>

* gdesktop.c (reload_desktop_icons): Load the information provided
	on the .desktop file for the desktop icon information: icon
	filename and text to be displayed.
This commit is contained in:
Miguel de Icaza 1999-02-17 19:58:24 +00:00
parent 9f9da99b3d
commit 6eb9a08b29
2 changed files with 35 additions and 2 deletions

View File

@ -1,9 +1,13 @@
1999-02-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdesktop.c (reload_desktop_icons): Load the information provided
on the .desktop file for the desktop icon information: icon
filename and text to be displayed.
* gpopup.c (create_actions): Add ejectable
* gdesktop.c (do_eject): Add eject command.
1999-02-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gpopup.c (create_actions): Add support for mountable icons.

View File

@ -368,6 +368,7 @@ reload_desktop_icons (int user_pos, int xpos, int ypos)
GSList *need_position_list, *sl;
GList *all_icons, *l;
char *desktop_url, *caption;
const char *mime;
int orig_xpos, orig_ypos;
dir = mc_opendir (desktop_directory);
@ -502,6 +503,33 @@ reload_desktop_icons (int user_pos, int xpos, int ypos)
get_icon_auto_pos (&xpos, &ypos);
}
/*
* If the file dropped was a .desktop file, pull the suggested
* title and icon from there
*/
mime = gnome_mime_type_or_default (fau->filename, NULL);
if (mime && strcmp (mime, "application/x-gnome-app-info") == 0){
GnomeDesktopEntry *entry;
char *fullname = g_concat_dir_and_file (desktop_directory, fau->filename);
entry = gnome_desktop_entry_load (fullname);
if (entry){
if (entry->name){
if (fau->caption)
g_free (fau->caption);
fau->caption = g_strdup (entry->name);
gnome_metadata_set (fullname, "icon-caption",
strlen (fau->caption)+1, fau->caption);
}
if (entry->icon){
gnome_metadata_set (fullname, "icon-filename",
strlen (entry->icon)+1, entry->icon);
}
gnome_desktop_entry_free (entry);
}
g_free (fullname);
}
dii = desktop_icon_info_new (fau->filename, fau->url, fau->caption, xpos, ypos);
gtk_widget_show (dii->dicon);
@ -1587,7 +1615,8 @@ desktop_icon_info_new (char *filename, char *url, char *caption, int xpos, int y
caption = url;
} else {
dii->url = NULL;
caption = filename;
if (caption == NULL)
caption = filename;
}
icon_im = gicon_get_icon_for_file (desktop_directory, fe, FALSE);