diff options
-rw-r--r-- | docs/reference/gio/gio-sections.txt | 5 | ||||
-rw-r--r-- | gio/gdrive.c | 30 | ||||
-rw-r--r-- | gio/gdrive.h | 4 | ||||
-rw-r--r-- | gio/gio.symbols | 5 | ||||
-rw-r--r-- | gio/gmount.c | 32 | ||||
-rw-r--r-- | gio/gmount.h | 3 | ||||
-rw-r--r-- | gio/gunixmount.c | 12 | ||||
-rw-r--r-- | gio/gunixmounts.c | 71 | ||||
-rw-r--r-- | gio/gunixmounts.h | 4 | ||||
-rw-r--r-- | gio/gunixvolume.c | 11 | ||||
-rw-r--r-- | gio/gvolume.c | 32 | ||||
-rw-r--r-- | gio/gvolume.h | 3 | ||||
-rw-r--r-- | gio/gwin32mount.c | 35 |
13 files changed, 217 insertions, 30 deletions
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt index 0fc8576d1..bb0e29561 100644 --- a/docs/reference/gio/gio-sections.txt +++ b/docs/reference/gio/gio-sections.txt @@ -1047,6 +1047,7 @@ GMountIface g_mount_get_name g_mount_get_uuid g_mount_get_icon +g_mount_get_symbolic_icon g_mount_get_drive g_mount_get_root g_mount_get_volume @@ -1089,6 +1090,7 @@ GVolumeIface g_volume_get_name g_volume_get_uuid g_volume_get_icon +g_volume_get_symbolic_icon g_volume_get_drive g_volume_get_mount g_volume_can_mount @@ -1128,6 +1130,7 @@ GDriveStartFlags GDriveStartStopType g_drive_get_name g_drive_get_icon +g_drive_get_symbolic_icon g_drive_has_volumes g_drive_get_volumes g_drive_can_eject @@ -1426,6 +1429,7 @@ g_unix_mount_get_fs_type g_unix_mount_is_readonly g_unix_mount_is_system_internal g_unix_mount_guess_icon +g_unix_mount_guess_symbolic_icon g_unix_mount_guess_name g_unix_mount_guess_can_eject g_unix_mount_guess_should_display @@ -1439,6 +1443,7 @@ g_unix_mount_point_is_readonly g_unix_mount_point_is_user_mountable g_unix_mount_point_is_loopback g_unix_mount_point_guess_icon +g_unix_mount_point_guess_symbolic_icon g_unix_mount_point_guess_name g_unix_mount_point_guess_can_eject g_unix_mount_points_get diff --git a/gio/gdrive.c b/gio/gdrive.c index 0e8c8efb7..c41490f54 100644 --- a/gio/gdrive.c +++ b/gio/gdrive.c @@ -24,6 +24,7 @@ #include "config.h" #include "gdrive.h" #include "gsimpleasyncresult.h" +#include "gthemedicon.h" #include "gasyncresult.h" #include "gioerror.h" #include "glibintl.h" @@ -175,6 +176,35 @@ g_drive_get_icon (GDrive *drive) } /** + * g_drive_get_symbolic_icon: + * @drive: a #GDrive. + * + * Gets the icon for @drive. + * + * Returns: (transfer full): symbolic #GIcon for the @drive. + * Free the returned object with g_object_unref(). + * + * Since: 2.34 + **/ +GIcon * +g_drive_get_symbolic_icon (GDrive *drive) +{ + GDriveIface *iface; + GIcon *ret; + + g_return_val_if_fail (G_IS_DRIVE (drive), NULL); + + iface = G_DRIVE_GET_IFACE (drive); + + if (iface->get_symbolic_icon != NULL) + ret = iface->get_symbolic_icon (drive); + else + ret = g_themed_icon_new_with_default_fallbacks ("drive-removable-media-symbolic"); + + return ret; +} + +/** * g_drive_has_volumes: * @drive: a #GDrive. * diff --git a/gio/gdrive.h b/gio/gdrive.h index 25ed4f4ea..d42b0b700 100644 --- a/gio/gdrive.h +++ b/gio/gdrive.h @@ -72,6 +72,7 @@ G_BEGIN_DECLS * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34. * * Interface for creating #GDrive implementations. */ @@ -154,12 +155,15 @@ struct _GDriveIface GError **error); const gchar * (* get_sort_key) (GDrive *drive); + GIcon * (* get_symbolic_icon) (GDrive *drive); + }; GType g_drive_get_type (void) G_GNUC_CONST; char * g_drive_get_name (GDrive *drive); GIcon * g_drive_get_icon (GDrive *drive); +GIcon * g_drive_get_symbolic_icon (GDrive *drive); gboolean g_drive_has_volumes (GDrive *drive); GList * g_drive_get_volumes (GDrive *drive); gboolean g_drive_is_media_removable (GDrive *drive); diff --git a/gio/gio.symbols b/gio/gio.symbols index 05b6bfc03..f06e5e085 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -219,6 +219,7 @@ g_data_output_stream_put_string g_drive_get_type g_drive_get_name g_drive_get_icon +g_drive_get_symbolic_icon g_drive_has_volumes g_drive_get_volumes g_drive_is_media_removable @@ -654,6 +655,7 @@ g_unix_mount_guess_can_eject g_unix_mount_guess_should_display g_unix_mount_guess_name g_unix_mount_guess_icon +g_unix_mount_guess_symbolic_icon g_unix_mount_point_compare g_unix_mount_point_get_mount_path g_unix_mount_point_get_device_path @@ -665,6 +667,7 @@ g_unix_mount_point_is_loopback g_unix_mount_point_guess_can_eject g_unix_mount_point_guess_name g_unix_mount_point_guess_icon +g_unix_mount_point_guess_symbolic_icon g_unix_mount_points_get g_unix_mounts_get g_unix_mount_at @@ -707,6 +710,7 @@ g_mount_get_type g_mount_get_root g_mount_get_name g_mount_get_icon +g_mount_get_symbolic_icon g_mount_get_uuid g_mount_get_volume g_mount_get_drive @@ -733,6 +737,7 @@ g_mount_get_sort_key g_volume_get_type g_volume_get_name g_volume_get_icon +g_volume_get_symbolic_icon g_volume_get_uuid g_volume_get_drive g_volume_get_mount diff --git a/gio/gmount.c b/gio/gmount.c index fca17f5e5..c7ff94341 100644 --- a/gio/gmount.c +++ b/gio/gmount.c @@ -29,6 +29,7 @@ #include "gmount.h" #include "gmountprivate.h" +#include "gthemedicon.h" #include "gasyncresult.h" #include "gsimpleasyncresult.h" #include "gioerror.h" @@ -213,6 +214,37 @@ g_mount_get_icon (GMount *mount) return (* iface->get_icon) (mount); } + +/** + * g_mount_get_symbolic_icon: + * @mount: a #GMount. + * + * Gets the symbolic icon for @mount. + * + * Returns: (transfer full): a #GIcon. + * The returned object should be unreffed with + * g_object_unref() when no longer needed. + * + * Since: 2.34 + **/ +GIcon * +g_mount_get_symbolic_icon (GMount *mount) +{ + GMountIface *iface; + GIcon *ret; + + g_return_val_if_fail (G_IS_MOUNT (mount), NULL); + + iface = G_MOUNT_GET_IFACE (mount); + + if (iface->get_symbolic_icon != NULL) + ret = iface->get_symbolic_icon (mount); + else + ret = g_themed_icon_new_with_default_fallbacks ("folder-remote-symbolic"); + + return ret; +} + /** * g_mount_get_uuid: * @mount: a #GMount. diff --git a/gio/gmount.h b/gio/gmount.h index 131d45156..337289202 100644 --- a/gio/gmount.h +++ b/gio/gmount.h @@ -70,6 +70,7 @@ typedef struct _GMountIface GMountIface; * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24. * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34. * * Interface for implementing operations for mounts. **/ @@ -159,6 +160,7 @@ struct _GMountIface GFile * (* get_default_location) (GMount *mount); const gchar * (* get_sort_key) (GMount *mount); + GIcon * (* get_symbolic_icon) (GMount *mount); }; GType g_mount_get_type (void) G_GNUC_CONST; @@ -167,6 +169,7 @@ GFile * g_mount_get_root (GMount *mount); GFile * g_mount_get_default_location (GMount *mount); char * g_mount_get_name (GMount *mount); GIcon * g_mount_get_icon (GMount *mount); +GIcon * g_mount_get_symbolic_icon (GMount *mount); char * g_mount_get_uuid (GMount *mount); GVolume * g_mount_get_volume (GMount *mount); GDrive * g_mount_get_drive (GMount *mount); diff --git a/gio/gunixmount.c b/gio/gunixmount.c index d2eca7c18..f2e67c61f 100644 --- a/gio/gunixmount.c +++ b/gio/gunixmount.c @@ -55,6 +55,7 @@ struct _GUnixMount { char *name; GIcon *icon; + GIcon *symbolic_icon; char *device_path; char *mount_path; @@ -84,6 +85,7 @@ g_unix_mount_finalize (GObject *object) /* TODO: g_warn_if_fail (volume->volume == NULL); */ g_object_unref (mount->icon); + g_object_unref (mount->symbolic_icon); g_free (mount->name); g_free (mount->device_path); g_free (mount->mount_path); @@ -123,6 +125,7 @@ _g_unix_mount_new (GVolumeMonitor *volume_monitor, mount->name = g_unix_mount_guess_name (mount_entry); mount->icon = g_unix_mount_guess_icon (mount_entry); + mount->symbolic_icon = g_unix_mount_guess_symbolic_icon (mount_entry); /* need to do this last */ mount->volume = volume; @@ -175,6 +178,14 @@ g_unix_mount_get_icon (GMount *mount) return g_object_ref (unix_mount->icon); } +static GIcon * +g_unix_mount_get_symbolic_icon (GMount *mount) +{ + GUnixMount *unix_mount = G_UNIX_MOUNT (mount); + + return g_object_ref (unix_mount->symbolic_icon); +} + static char * g_unix_mount_get_uuid (GMount *mount) { @@ -473,6 +484,7 @@ g_unix_mount_mount_iface_init (GMountIface *iface) iface->get_root = g_unix_mount_get_root; iface->get_name = g_unix_mount_get_name; iface->get_icon = g_unix_mount_get_icon; + iface->get_symbolic_icon = g_unix_mount_get_symbolic_icon; iface->get_uuid = g_unix_mount_get_uuid; iface->get_drive = g_unix_mount_get_drive; iface->get_volume = g_unix_mount_get_volume; diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index e288e0624..2822ff9ad 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -1901,7 +1901,7 @@ g_unix_mount_point_guess_type (GUnixMountPoint *mount_point) } static const char * -type_to_icon (GUnixMountType type, gboolean is_mount_point) +type_to_icon (GUnixMountType type, gboolean is_mount_point, gboolean use_symbolic) { const char *icon_name; @@ -1909,55 +1909,51 @@ type_to_icon (GUnixMountType type, gboolean is_mount_point) { case G_UNIX_MOUNT_TYPE_HD: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "drive-harddisk"; + icon_name = use_symbolic ? "drive-harddisk-symbolic" : "drive-harddisk"; break; case G_UNIX_MOUNT_TYPE_FLOPPY: case G_UNIX_MOUNT_TYPE_ZIP: case G_UNIX_MOUNT_TYPE_JAZ: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "media-floppy"; + icon_name = use_symbolic ? "media-removable-symbolic" : "media-floppy"; break; case G_UNIX_MOUNT_TYPE_CDROM: if (is_mount_point) - icon_name = "drive-optical"; + icon_name = use_symbolic ? "drive-optical-symbolic" : "drive-optical"; else - icon_name = "media-optical"; + icon_name = use_symbolic ? "media-optical-symbolic" : "media-optical"; break; case G_UNIX_MOUNT_TYPE_NFS: - /* TODO: Would like a better icon here... */ - if (is_mount_point) - icon_name = "drive-removable-media"; - else - icon_name = "drive-harddisk"; + icon_name = use_symbolic ? "folder-remote-symbolic" : "folder-remote"; break; case G_UNIX_MOUNT_TYPE_MEMSTICK: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "media-flash"; + icon_name = use_symbolic ? "media-removable-symbolic" : "media-flash"; break; case G_UNIX_MOUNT_TYPE_CAMERA: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "camera-photo"; + icon_name = use_symbolic ? "camera-photo-symbolic" : "camera-photo"; break; case G_UNIX_MOUNT_TYPE_IPOD: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "multimedia-player"; + icon_name = use_symbolic ? "multimedia-player-symbolic" : "multimedia-player"; break; case G_UNIX_MOUNT_TYPE_UNKNOWN: default: if (is_mount_point) - icon_name = "drive-removable-media"; + icon_name = use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; else - icon_name = "drive-harddisk"; + icon_name = use_symbolic ? "drive-harddisk-symbolic" : "drive-harddisk"; break; } @@ -1998,7 +1994,23 @@ g_unix_mount_guess_name (GUnixMountEntry *mount_entry) GIcon * g_unix_mount_guess_icon (GUnixMountEntry *mount_entry) { - return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_guess_type (mount_entry), FALSE)); + return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_guess_type (mount_entry), FALSE, FALSE)); +} + +/** + * g_unix_mount_guess_symbolic_icon: + * @mount_entry: a #GUnixMountEntry + * + * Guesses the symbolic icon of a Unix mount. + * + * Returns: (transfer full): a #GIcon + * + * Since: 2.34 + */ +GIcon * +g_unix_mount_guess_symbolic_icon (GUnixMountEntry *mount_entry) +{ + return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_guess_type (mount_entry), FALSE, TRUE)); } /** @@ -2035,7 +2047,22 @@ g_unix_mount_point_guess_name (GUnixMountPoint *mount_point) GIcon * g_unix_mount_point_guess_icon (GUnixMountPoint *mount_point) { - return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_point_guess_type (mount_point), TRUE)); + return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_point_guess_type (mount_point), TRUE, FALSE)); +} + +/** + * g_unix_mount_point_guess_symbolic_icon: + * + * Guesses the symbolic icon of a Unix mount point. + * + * Returns: (transfer full): a #GIcon + * + * Since: 2.34 + */ +GIcon * +g_unix_mount_point_guess_symbolic_icon (GUnixMountPoint *mount_point) +{ + return g_themed_icon_new_with_default_fallbacks (type_to_icon (g_unix_mount_point_guess_type (mount_point), TRUE, TRUE)); } /** diff --git a/gio/gunixmounts.h b/gio/gunixmounts.h index 5bcc1acfa..15515cfbf 100644 --- a/gio/gunixmounts.h +++ b/gio/gunixmounts.h @@ -70,6 +70,8 @@ gboolean g_unix_mount_guess_can_eject (GUnixMountEntry *mount_e gboolean g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry); char * g_unix_mount_guess_name (GUnixMountEntry *mount_entry); GIcon * g_unix_mount_guess_icon (GUnixMountEntry *mount_entry); +GIcon * g_unix_mount_guess_symbolic_icon (GUnixMountEntry *mount_entry); + gint g_unix_mount_point_compare (GUnixMountPoint *mount1, GUnixMountPoint *mount2); @@ -84,6 +86,8 @@ gboolean g_unix_mount_point_is_loopback (GUnixMountPoint *mount_p gboolean g_unix_mount_point_guess_can_eject (GUnixMountPoint *mount_point); char * g_unix_mount_point_guess_name (GUnixMountPoint *mount_point); GIcon * g_unix_mount_point_guess_icon (GUnixMountPoint *mount_point); +GIcon * g_unix_mount_point_guess_symbolic_icon (GUnixMountPoint *mount_point); + GList * g_unix_mount_points_get (guint64 *time_read); GList * g_unix_mounts_get (guint64 *time_read); diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c index 1dc840b22..f559ca937 100644 --- a/gio/gunixvolume.c +++ b/gio/gunixvolume.c @@ -58,6 +58,7 @@ struct _GUnixVolume { char *name; GIcon *icon; + GIcon *symbolic_icon; }; static void g_unix_volume_volume_iface_init (GVolumeIface *iface); @@ -81,6 +82,7 @@ g_unix_volume_finalize (GObject *object) _g_unix_mount_unset_volume (volume->mount, volume); g_object_unref (volume->icon); + g_object_unref (volume->symbolic_icon); g_free (volume->name); g_free (volume->mount_path); g_free (volume->device_path); @@ -122,6 +124,7 @@ _g_unix_volume_new (GVolumeMonitor *volume_monitor, volume->name = g_unix_mount_point_guess_name (mountpoint); volume->icon = g_unix_mount_point_guess_icon (mountpoint); + volume->symbolic_icon = g_unix_mount_point_guess_symbolic_icon (mountpoint); if (strcmp (g_unix_mount_point_get_fs_type (mountpoint), "nfs") == 0) @@ -197,6 +200,13 @@ g_unix_volume_get_icon (GVolume *volume) return g_object_ref (unix_volume->icon); } +static GIcon * +g_unix_volume_get_symbolic_icon (GVolume *volume) +{ + GUnixVolume *unix_volume = G_UNIX_VOLUME (volume); + return g_object_ref (unix_volume->symbolic_icon); +} + static char * g_unix_volume_get_name (GVolume *volume) { @@ -517,6 +527,7 @@ g_unix_volume_volume_iface_init (GVolumeIface *iface) { iface->get_name = g_unix_volume_get_name; iface->get_icon = g_unix_volume_get_icon; + iface->get_symbolic_icon = g_unix_volume_get_symbolic_icon; iface->get_uuid = g_unix_volume_get_uuid; iface->get_drive = g_unix_volume_get_drive; iface->get_mount = g_unix_volume_get_mount; diff --git a/gio/gvolume.c b/gio/gvolume.c index fb157d44e..8338329db 100644 --- a/gio/gvolume.c +++ b/gio/gvolume.c @@ -24,6 +24,7 @@ #include "config.h" #include "gmount.h" #include "gvolume.h" +#include "gthemedicon.h" #include "gasyncresult.h" #include "gsimpleasyncresult.h" #include "gioerror.h" @@ -157,6 +158,37 @@ g_volume_get_icon (GVolume *volume) } /** + * g_volume_get_symbolic_icon: + * @volume: a #GVolume. + * + * Gets the symbolic icon for @volume. + * + * Returns: (transfer full): a #GIcon. + * The returned object should be unreffed with g_object_unref() + * when no longer needed. + * + * Since: 2.34 + **/ +GIcon * +g_volume_get_symbolic_icon (GVolume *volume) +{ + GVolumeIface *iface; + GIcon *ret; + + g_return_val_if_fail (G_IS_VOLUME (volume), NULL); + + iface = G_VOLUME_GET_IFACE (volume); + + if (iface->get_symbolic_icon != NULL) + ret = iface->get_symbolic_icon (volume); + else + ret = g_themed_icon_new_with_default_fallbacks ("folder-remote-symbolic"); + + return ret; + +} + +/** * g_volume_get_uuid: * @volume: a #GVolume. * diff --git a/gio/gvolume.h b/gio/gvolume.h index dffab7acf..b0d862e79 100644 --- a/gio/gvolume.h +++ b/gio/gvolume.h @@ -120,6 +120,7 @@ G_BEGIN_DECLS * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22. * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. * @get_sort_key: Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Gets a symbolic #GIcon for the #GVolume. Since 2.34. * * Interface for implementing operations for mountable volumes. **/ @@ -180,12 +181,14 @@ struct _GVolumeIface GError **error); const gchar * (* get_sort_key) (GVolume *volume); + GIcon * (* get_symbolic_icon) (GVolume *volume); }; GType g_volume_get_type (void) G_GNUC_CONST; char * g_volume_get_name (GVolume *volume); GIcon * g_volume_get_icon (GVolume *volume); +GIcon * g_volume_get_symbolic_icon (GVolume *volume); char * g_volume_get_uuid (GVolume *volume); GDrive * g_volume_get_drive (GVolume *volume); GMount * g_volume_get_mount (GVolume *volume); diff --git a/gio/gwin32mount.c b/gio/gwin32mount.c index cb1855c64..3b9f616ae 100644 --- a/gio/gwin32mount.c +++ b/gio/gwin32mount.c @@ -52,6 +52,7 @@ struct _GWin32Mount { /* why does all this stuff need to be duplicated? It is in volume already! */ char *name; GIcon *icon; + GIcon *symbolic_icon; char *mount_path; gboolean can_eject; @@ -82,6 +83,8 @@ g_win32_mount_finalize (GObject *object) if (mount->icon != NULL) g_object_unref (mount->icon); + if (mount->symbolic_icon != NULL) + g_object_unref (mount->symbolic_icon); g_free (mount->name); g_free (mount->mount_path); @@ -192,15 +195,15 @@ g_win32_mount_get_root (GMount *mount) } const char * -_win32_drive_type_to_icon (int type) +_win32_drive_type_to_icon (int type, gboolean use_symbolic) { switch (type) { - case DRIVE_REMOVABLE : return "gtk-floppy"; - case DRIVE_FIXED : return "gtk-harddisk"; - case DRIVE_REMOTE : return "gtk-network"; - case DRIVE_CDROM : return "gtk-cdrom"; - default : return "gtk-directory"; + case DRIVE_REMOVABLE : return use_symbolic ? "drive-removable-media-symbolic" : "drive-removable-media"; + case DRIVE_FIXED : return use_symbolic ? "drive-harddisk-symbolic" : "drive-harddisk"; + case DRIVE_REMOTE : return use_symbolic ? "folder-remote-symbolic" : "folder-remote"; + case DRIVE_CDROM : return use_symbolic ? "drive-optical-symbolic" : "drive-optical"; + default : return use_symbolic ? "folder-symbolic" : "folder"; } } @@ -227,14 +230,29 @@ g_win32_mount_get_icon (GMount *mount) } else { - win32_mount->icon = g_themed_icon_new_with_default_fallbacks ( - _win32_drive_type_to_icon (win32_mount->drive_type)); + win32_mount->icon = g_themed_icon_new_with_default_fallbacks (_win32_drive_type_to_icon (win32_mount->drive_type, FALSE); } } return g_object_ref (win32_mount->icon); } +static GIcon * +g_win32_mount_get_symbolic_icon (GMount *mount) +{ + GWin32Mount *win32_mount = G_WIN32_MOUNT (mount); + + g_return_val_if_fail (win32_mount->mount_path != NULL, NULL); + + /* lazy creation */ + if (!win32_mount->symbolic_icon) + { + win32_mount->symbolic_icon = g_themed_icon_new_with_default_fallbacks (_win32_drive_type_to_icon (win32_mount->drive_type, TRUE); + } + + return g_object_ref (win32_mount->symbolic_icon); +} + static char * g_win32_mount_get_uuid (GMount *mount) { @@ -336,6 +354,7 @@ g_win32_mount_mount_iface_init (GMountIface *iface) iface->get_root = g_win32_mount_get_root; iface->get_name = g_win32_mount_get_name; iface->get_icon = g_win32_mount_get_icon; + iface->get_symbolic_icon = g_win32_mount_get_symbolic_icon; iface->get_uuid = g_win32_mount_get_uuid; iface->get_drive = g_win32_mount_get_drive; iface->get_volume = g_win32_mount_get_volume; |