Dropping files on desktop icons now works.

Cheers,
Miguel.
This commit is contained in:
Miguel de Icaza 1999-01-06 04:03:15 +00:00
parent 3ad5d29db8
commit c6ccd3c3b7
5 changed files with 48 additions and 8 deletions

View File

@ -1,5 +1,11 @@
1999-01-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdesktop.c (desktop_icon_drop_uri_list): Implement
drops-on-executable.
* gmetadata.c, gaction.c, gdesktop.c, gicon.c: Use g_free instead
of free to follow the convention in gnome-metadata.c
* gtools.c (query_dialog): Fix the new version of this. It was
overwriting memory all over.

View File

@ -34,13 +34,13 @@ gmc_open_filename (char *fname, GList *args)
if (gnome_metadata_get (fname, "fm-open", &size, &buf) == 0){
gmc_execute (fname, buf);
free (buf);
g_free (buf);
return 1;
}
if (gnome_metadata_get (fname, "open", &size, &buf) == 0){
gmc_execute (fname, buf);
free (buf);
g_free (buf);
return 1;
}
@ -85,13 +85,13 @@ gmc_view (char *filename, int start_line)
if (gnome_metadata_get (filename, "fm-view", &size, &buf) == 0){
gmc_run_view (filename, buf);
free (buf);
g_free (buf);
return 1;
}
if (gnome_metadata_get (filename, "view", &size, &buf) == 0){
gmc_run_view (filename, buf);
free (buf);
g_free (buf);
return 1;
}

View File

@ -1112,7 +1112,7 @@ desktop_icon_drop_uri_list (DesktopIconInfo *dii, GdkDragContext *context, GtkSe
*/
if (gnome_metadata_get (filename, "drop-action", &size, &buf) == 0){
/*action_drop (filename, buf, context, data);*/ /* Fixme: i'm undefined */
free (buf);
g_free (buf);
goto out;
}
@ -1132,10 +1132,39 @@ desktop_icon_drop_uri_list (DesktopIconInfo *dii, GdkDragContext *context, GtkSe
}
/*
* 4. Executable. Try metadata keys for "open" and mime type for "open"
* 4. Executable. Try metadata keys for "open".
*/
if (is_exe (fe->buf.st_mode) && if_link_is_exe (fe)){
GList *names, *l;
int len, i;
char **drops;
/* Convert the list of filenames into an array of char */
names = gnome_uri_list_extract_uris (data->data);
len = g_list_length (names);
drops = (char **) g_malloc (sizeof (char *) * (len+1));
for (l = names, i = 0; i < len; i++, l = l->next){
char *text = l->data;
if (strncmp (text, "file:", 5) == 0)
text += 5;
drops [i] = text;
}
drops [i] = NULL;
if (gnome_metadata_get (filename, "open", &size, &buf) == 0){
exec_extension (filename, buf, drops, NULL, 0);
goto out2;
}
exec_extension (filename, "%f %q", drops, NULL, 0);
g_free (drops);
out2:
gnome_uri_list_free_strings (names);
g_free (buf);
}
out:

View File

@ -223,7 +223,10 @@ gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
if (fe->f.stalled_link)
return icon_view_stalled;
/* BEtter effect; do not use the symlink icon */
#if 0
return icon_view_symlink;
#endif
}
/*
@ -236,7 +239,7 @@ gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
if (gnome_metadata_get (fe->fname, "icon-inline-png", &size, &buf) == 0){
image = gdk_imlib_inlined_png_to_image (buf, size);
free (buf);
g_free (buf);
if (image)
return image;
@ -248,7 +251,7 @@ gicon_get_icon_for_file_speed (file_entry *fe, gboolean do_quick)
if (gnome_metadata_get (fe->fname, "icon-filename", &size, &buf) == 0){
image = gicon_get_by_filename (buf);
free (buf);
g_free (buf);
if (image)
return image;

View File

@ -81,6 +81,8 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
g_slist_foreach (allocated, g_free, NULL);
g_slist_free (allocated);
g_free (buttons);
return result;
}