Better tests of entry->icon , fix a trap test if entry->icon[0] = 0 : if there is nothing after the Icon= in the desktop file. test if entry->icon is a DIR test if entry->icon is still NULL after all the try to choose an icon. -- Jean Schurger fr alcove com - Free Software Engineer Alcove - (+33) 149 226 800 - http://www.alcove.com jschurger schurger org - (+33) 661 415 920 PGP Fingerprint : E6487B18CAD0810469E98869790D563DEBA1535
diff -uNr old/gnome-control-center/control-center/ChangeLog new/gnome-control-center/control-center/ChangeLog --- old/gnome-control-center/control-center/ChangeLog Thu Jan 3 22:25:24 2002 +++ new/gnome-control-center/control-center/ChangeLog Wed Jan 9 12:42:17 2002 @@ -1,3 +1,10 @@ +2002-01-09 Jean Schurger <jschurger schurger org> + + * capplet-dir.c (capplet_new): Check for entry->icon[0] != 0 + if (Icon =) in the desktop file. + if entry->icon is a DIR + If entry->icon[0] still NULL. + 2002-01-03 Richard Hestilow <hestilow ximian com> * capplet-dir.c (capplet_new): Check for ditem::icon != NULL diff -uNr old/gnome-control-center/control-center/capplet-dir.c new/gnome-control-center/control-center/capplet-dir.c --- old/gnome-control-center/control-center/capplet-dir.c Thu Jan 3 22:25:24 2002 +++ new/gnome-control-center/control-center/capplet-dir.c Wed Jan 9 12:36:08 2002 @@ -99,34 +99,44 @@ entry->label = g_strdup (gnome_desktop_item_get_string (dentry, GNOME_DESKTOP_ITEM_NAME)); entry->icon = g_strdup (gnome_desktop_item_get_string (dentry, GNOME_DESKTOP_ITEM_ICON)); - if (entry->icon && entry->icon[0] != '/') - { - gchar *old = entry->icon; - entry->icon = g_concat_dir_and_file (PIXMAPS_DIR, old); - g_free (old); - } - if (!g_file_exists (entry->icon)) - { - const gchar *icon; - g_free (entry->icon); - icon = gnome_desktop_item_get_string (dentry, GNOME_DESKTOP_ITEM_ICON); - if (icon) - entry->icon = gnome_pixmap_file (icon); - if (!entry->icon) - entry->icon = gnome_pixmap_file ("gnome-unknown.png"); + if (entry->icon[0] == 0) { + g_free(entry->icon); + entry->icon = NULL; } - entry->path = g_strdup (gnome_desktop_item_get_location (dentry)); - - entry->exec = vec; - entry->dir = dir; - - if (entry->icon == NULL) + + if (entry->icon) { + if (entry->icon[0] != '/') + { + gchar *old = entry->icon; + entry->icon = g_concat_dir_and_file (PIXMAPS_DIR, old); + g_free (old); + } + if (!g_file_exists (entry->icon) || g_file_test(entry->icon, G_FILE_TEST_IS_DIR)) + { + const gchar *icon; + g_free (entry->icon); + icon = gnome_desktop_item_get_string (dentry, GNOME_DESKTOP_ITEM_ICON); + if (icon) + entry->icon = gnome_pixmap_file (icon); + + if (!entry->icon) + entry->icon = gnome_pixmap_file ("gnome-unknown.png"); + } + } else { entry->icon = gnome_program_locate_file (gnome_program_get (), GNOME_FILE_DOMAIN_APP_PIXMAP, "control-center.png", TRUE, NULL); + } + + if (!entry->icon) { /* if entry->icon still NULL */ + entry->icon = gnome_pixmap_file ("gnome-unknown.png"); + } entry->pb = gdk_pixbuf_new_from_file (entry->icon, NULL); + entry->path = g_strdup (gnome_desktop_item_get_location (dentry)); + entry->exec = vec; + entry->dir = dir; g_hash_table_insert (capplet_hash, g_strdup (desktop_path), entry);
Attachment:
pgpVWmpberXnK.pgp
Description: PGP signature