From 0bd0f7dac219f2a55800539b2a00df6e816eccf4 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 11 Mar 1999 03:18:48 +0000 Subject: [PATCH] 1999-03-10 Federico Mena Quintero * 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. --- gnome/ChangeLog | 8 +++++++ gnome/gdesktop.c | 58 ++++++++++++++++++++++-------------------------- gnome/gpopup.c | 6 ----- gnome/gpopup2.c | 6 ----- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 7e68517ae..e82fde76e 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,11 @@ +1999-03-10 Federico Mena Quintero + + * 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 This is a semi-big slew of changes to integrate the DESKTOP_BRANCH diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 531ed29d5..becee12bd 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -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) diff --git a/gnome/gpopup.c b/gnome/gpopup.c index cf2317389..3cb980957 100644 --- a/gnome/gpopup.c +++ b/gnome/gpopup.c @@ -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); diff --git a/gnome/gpopup2.c b/gnome/gpopup2.c index a7cd15f6e..3f0631343 100644 --- a/gnome/gpopup2.c +++ b/gnome/gpopup2.c @@ -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))