From 66eb02ef0861891685cfebc7e0e5bfefdf894c5c Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 18 Jan 1999 18:04:41 +0000 Subject: [PATCH] 1999-01-17 Miguel de Icaza * gpageprop.c (item_properties): Use the metadata information for this. (item_properties): Set the icon-filename metadata bit --- gnome/ChangeLog | 5 +++++ gnome/gpageprop.c | 27 +++++++++++++++++++-------- gnome/gprop.c | 4 +++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 018c4b868..5c84f4601 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,8 @@ +1999-01-17 Miguel de Icaza + + * gpageprop.c (item_properties): Use the metadata information for this. + (item_properties): Set the icon-filename metadata bit + 1999-01-15 Miguel de Icaza * glayout.c (create_new_menu_from): Handle both the system dir and diff --git a/gnome/gpageprop.c b/gnome/gpageprop.c index 1c6a47304..073492cda 100644 --- a/gnome/gpageprop.c +++ b/gnome/gpageprop.c @@ -66,6 +66,9 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii) char *new_title; char *new_name; char *base; + char *icon_filename; + int size; + struct stat s; int retval = 0; @@ -84,15 +87,15 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii) /* Create the property widgets */ mc_stat (fname, &s); - base = x_basename (fname); vbox = gtk_vbox_new (FALSE, 6); name = gprop_filename_new (fname, base); gtk_box_pack_start (GTK_BOX (vbox), name->top, FALSE, FALSE, 0); if (dii) { - gene = gprop_general_new(fname, base); - gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0); + gnome_metadata_get (fname, "icon-filename", &size, &icon_filename); + gene = gprop_general_new(fname, icon_filename); + gtk_box_pack_start (GTK_BOX (vbox), gene->top, FALSE, FALSE, 0); } perm = gprop_perm_new (s.st_mode, get_owner (s.st_uid), get_group (s.st_gid)); @@ -133,6 +136,7 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii) if (prop_dialog_result != 0) { gtk_widget_destroy (GTK_WIDGET (toplevel)); + g_free (icon_filename); return 0; /* nothing changed */ } @@ -218,17 +222,24 @@ item_properties (GtkWidget *parent, char *fname, DesktopIconInfo *dii) retval |= GPROP_FILENAME; } - + /* Check and change title and icon -- change is handled by caller */ if (dii) { - gprop_general_get_data (gene, &new_title, NULL); - desktop_icon_set_text(DESKTOP_ICON(dii->dicon), new_title); - g_free(new_title); + char *new_icon; - retval |= GPROP_TITLE; + gprop_general_get_data (gene, &new_title, &new_icon); + + if (strcmp (new_icon, icon_filename) != 0) + gnome_metadata_set (fname, "icon-filename", strlen (new_icon)+1, new_icon); + + desktop_icon_set_text(DESKTOP_ICON(dii->dicon), new_title); + g_free(new_title); + + retval |= GPROP_TITLE; } gtk_widget_destroy (GTK_WIDGET (toplevel)); + g_free (icon_filename); return retval; } diff --git a/gnome/gprop.c b/gnome/gprop.c index 376f34e9c..be25cdf01 100644 --- a/gnome/gprop.c +++ b/gnome/gprop.c @@ -483,8 +483,10 @@ gprop_general_new (char *title, char *icon_filename) GtkWidget *entry; g_return_val_if_fail (title != NULL, NULL); - g_return_val_if_fail (icon_filename != NULL, NULL); + if (!icon_filename) + icon_filename = ICONDIR "i-regular.png"; + gp = g_new (GpropGeneral, 1); gp->top = gtk_vbox_new (FALSE, 6);