1999-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gdesktop.c (update_url): Made static.
	(desktop_reload_icons): Call update_url() when updating an
	existing icon.

	* gpopup2.c (handle_properties): Do not update the icon url here.
This commit is contained in:
Miguel de Icaza 1999-03-11 03:18:48 +00:00
parent 4663c905a2
commit 0bd0f7dac2
4 changed files with 35 additions and 43 deletions

View File

@ -1,3 +1,11 @@
1999-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdesktop.c (update_url): Made static.
(desktop_reload_icons): Call update_url() when updating an
existing icon.
* gpopup2.c (handle_properties): Do not update the icon url here.
1999-03-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
This is a semi-big slew of changes to integrate the DESKTOP_BRANCH

View File

@ -364,6 +364,31 @@ icon_exists_in_list (GList *list, char *filename)
return NULL;
}
/* Loads from the metadata updated versions of the caption and the url */
static void
update_url (DesktopIconInfo *dii)
{
char *fullname = g_concat_dir_and_file (desktop_directory, dii->filename);
char *caption = NULL;
char *url = NULL;
int size;
gnome_metadata_get (fullname, "icon-caption", &size, &caption);
if (caption){
desktop_icon_set_text (DESKTOP_ICON (dii->dicon), caption);
g_free (caption);
}
gnome_metadata_get (fullname, "desktop-url", &size, &url);
if (url){
if (dii->url)
g_free (dii->url);
dii->url = url;
}
g_free (fullname);
}
typedef struct {
char *filename;
char *url;
@ -437,6 +462,8 @@ desktop_reload_icons (int user_pos, int xpos, int ypos)
dii = l->data;
desktop_icon_set_icon (DESKTOP_ICON (dii->dicon), im);
update_url (dii);
/* Leave the icon in the desktop by removing it from the list */
all_icons = g_list_remove_link (all_icons, l);
@ -1958,37 +1985,6 @@ desktop_icon_info_new (char *filename, char *url, char *caption, int xpos, int y
return dii;
}
/**
* desktop_icon_update_url:
* @dii: the desktop icon
*
* Loads from the metadata updated versions of the caption
* and the url
*/
void
desktop_icon_update_url (DesktopIconInfo *dii)
{
char *fullname = g_concat_dir_and_file (desktop_directory, dii->filename);
char *caption = NULL;
char *url = NULL;
int size;
gnome_metadata_get (fullname, "icon-caption", &size, &caption);
if (caption){
desktop_icon_set_text (DESKTOP_ICON (dii->dicon), caption);
g_free (caption);
}
gnome_metadata_get (fullname, "desktop-url", &size, &url);
if (url){
if (dii->url)
g_free (dii->url);
dii->url = url;
}
g_free (fullname);
}
/* Creates the layout information array */
static void
create_layout_info (void)

View File

@ -102,12 +102,6 @@ dicon_properties (GtkWidget *widget, DesktopIconInfo *dii)
if (gnome_dialog_run (GNOME_DIALOG (dlg)) == 0)
retval = gnome_file_property_dialog_make_changes (GNOME_FILE_PROPERTY_DIALOG (dlg));
/*
* Apply: desktop icon name change and url change
*/
if (dii->url)
desktop_icon_update_url (dii);
gtk_widget_destroy (dlg);
g_free(path);

View File

@ -687,12 +687,6 @@ handle_properties (GtkWidget *widget, WPanel *panel)
retval = gnome_file_property_dialog_make_changes (
GNOME_FILE_PROPERTY_DIALOG (dialog));
if (is_a_desktop_panel (panel)) {
dii = desktop_icon_info_get_by_filename (selection (panel)->fname);
g_assert (dii != NULL);
desktop_icon_update_url (dii);
}
gtk_widget_destroy (dialog);
g_free (full_name);
if (retval && !is_a_desktop_panel (panel))