[Xfce4-commits] <xfdesktop:eric/settings-changes> More removable device icon types (Bug 4056)
Eric Koegel
noreply at xfce.org
Sat Oct 19 20:26:02 CEST 2013
Updating branch refs/heads/eric/settings-changes
to c460b0acb86791eb7ee9d954fae505589b88a68a (commit)
from 7fd36c23d7e72cec2721c5324b63ca1e57dd2fef (commit)
commit c460b0acb86791eb7ee9d954fae505589b88a68a
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Tue Oct 15 19:25:30 2013 +0300
More removable device icon types (Bug 4056)
In xfdesktop-settings the removable devices option now has an
expander allowing the user to show network shares, devices, or
unknown/other volumes (such as mtp devices).
common/xfdesktop-common.h | 9 ++
settings/main.c | 38 ++++---
src/xfdesktop-file-icon-manager.c | 218 ++++++++++++++++++++++---------------
src/xfdesktop-file-icon-manager.h | 13 ---
src/xfdesktop-file-utils.c | 131 ----------------------
src/xfdesktop-file-utils.h | 3 -
src/xfdesktop-volume-icon.c | 11 --
7 files changed, 162 insertions(+), 261 deletions(-)
diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h
index 4dcec73..88e86c5 100644
--- a/common/xfdesktop-common.h
+++ b/common/xfdesktop-common.h
@@ -53,6 +53,15 @@
#define SINGLE_WORKSPACE_MODE "/backdrop/single-workspace-mode"
#define SINGLE_WORKSPACE_NUMBER "/backdrop/single-workspace-number"
+#define DESKTOP_ICONS_SHOW_THUMBNAILS "/desktop-icons/show-thumbnails"
+#define DESKTOP_ICONS_SHOW_NETWORK_REMOVABLE "/desktop-icons/file-icons/show-network-removable"
+#define DESKTOP_ICONS_SHOW_DEVICE_REMOVABLE "/desktop-icons/file-icons/show-device-removable"
+#define DESKTOP_ICONS_SHOW_UNKNWON_REMOVABLE "/desktop-icons/file-icons/show-unknown-removable"
+#define DESKTOP_ICONS_SHOW_HOME "/desktop-icons/file-icons/show-home"
+#define DESKTOP_ICONS_SHOW_TRASH "/desktop-icons/file-icons/show-trash"
+#define DESKTOP_ICONS_SHOW_FILESYSTEM "/desktop-icons/file-icons/show-filesystem"
+#define DESKTOP_ICONS_SHOW_REMOVABLE "/desktop-icons/file-icons/show-removable"
+
/**
* File information namespaces queried for #GFileInfo objects.
*/
diff --git a/settings/main.c b/settings/main.c
index 74da46e..84340f0 100644
--- a/settings/main.c
+++ b/settings/main.c
@@ -76,12 +76,6 @@
#define DESKTOP_ICONS_FONT_SIZE_PROP "/desktop-icons/font-size"
#define DESKTOP_ICONS_CUSTOM_FONT_SIZE_PROP "/desktop-icons/use-custom-font-size"
#define DESKTOP_ICONS_SINGLE_CLICK_PROP "/desktop-icons/single-click"
-#define DESKTOP_ICONS_SHOW_THUMBNAILS_PROP "/desktop-icons/show-thumbnails"
-#define DESKTOP_ICONS_SHOW_HOME "/desktop-icons/file-icons/show-home"
-#define DESKTOP_ICONS_SHOW_TRASH "/desktop-icons/file-icons/show-trash"
-#define DESKTOP_ICONS_SHOW_FILESYSTEM "/desktop-icons/file-icons/show-filesystem"
-#define DESKTOP_ICONS_SHOW_REMOVABLE "/desktop-icons/file-icons/show-removable"
-
typedef struct
{
@@ -342,7 +336,7 @@ cb_special_icon_toggled(GtkCellRendererToggle *render, gchar *path, gpointer use
xfconf_channel_set_bool(channel, icon_property, show_icon);
- gtk_list_store_set(GTK_LIST_STORE(model), &iter,
+ gtk_tree_store_set(GTK_TREE_STORE(model), &iter,
COL_ICON_ENABLED, show_icon, -1);
gtk_tree_path_free(tree_path);
@@ -354,10 +348,10 @@ setup_special_icon_list(GtkBuilder *gxml,
XfconfChannel *channel)
{
GtkWidget *treeview;
- GtkListStore *ls;
+ GtkTreeStore *ts;
GtkTreeViewColumn *col;
GtkCellRenderer *render;
- GtkTreeIter iter;
+ GtkTreeIter iter, parent_iter, child_iter;
const struct {
const gchar *name;
const gchar *icon;
@@ -373,14 +367,21 @@ setup_special_icon_list(GtkBuilder *gxml,
DESKTOP_ICONS_SHOW_TRASH, TRUE },
{ N_("Removable Devices"), "drive-removable-media", "gnome-dev-removable",
DESKTOP_ICONS_SHOW_REMOVABLE, TRUE },
+ { N_("Network Shares"), "network_fs", "gnome-dev-network",
+ DESKTOP_ICONS_SHOW_NETWORK_REMOVABLE, TRUE },
+ { N_("Disks and Drives"), "drive-harddisk-usb", "gnome-dev-removable-usb",
+ DESKTOP_ICONS_SHOW_DEVICE_REMOVABLE, TRUE },
+ { N_("Other Items"), "phone-symbolic", "phone",
+ DESKTOP_ICONS_SHOW_UNKNWON_REMOVABLE, TRUE },
{ NULL, NULL, NULL, NULL, FALSE },
};
+ const int REMOVABLE_DEVICES = 4;
int i, w;
GtkIconTheme *itheme = gtk_icon_theme_get_default();
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &w, NULL);
- ls = gtk_list_store_new(N_ICON_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
+ ts = gtk_tree_store_new(N_ICON_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_STRING);
for(i = 0; icons[i].name; ++i) {
GdkPixbuf *pix = NULL;
@@ -390,8 +391,15 @@ setup_special_icon_list(GtkBuilder *gxml,
else
pix = gtk_icon_theme_load_icon(itheme, icons[i].icon_fallback, w, 0, NULL);
- gtk_list_store_append(ls, &iter);
- gtk_list_store_set(ls, &iter,
+ if(i < REMOVABLE_DEVICES) {
+ gtk_tree_store_append(ts, &parent_iter, NULL);
+ iter = parent_iter;
+ } else {
+ gtk_tree_store_append(ts, &child_iter, &parent_iter);
+ iter = child_iter;
+ }
+
+ gtk_tree_store_set(ts, &iter,
COL_ICON_NAME, _(icons[i].name),
COL_ICON_PIX, pix,
COL_ICON_PROPERTY, icons[i].xfconf_property,
@@ -424,8 +432,8 @@ setup_special_icon_list(GtkBuilder *gxml,
gtk_tree_view_column_pack_start(col, render, TRUE);
gtk_tree_view_column_add_attribute(col, render, "text", COL_ICON_NAME);
- gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(ls));
- g_object_unref(G_OBJECT(ls));
+ gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(ts));
+ g_object_unref(G_OBJECT(ts));
}
@@ -1730,7 +1738,7 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml,
xfconf_g_property_bind(channel, DESKTOP_ICONS_CUSTOM_FONT_SIZE_PROP,
G_TYPE_BOOLEAN, G_OBJECT(chk_custom_font_size),
"active");
- xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_THUMBNAILS_PROP,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_THUMBNAILS,
G_TYPE_BOOLEAN, G_OBJECT(chk_show_thumbnails),
"active");
xfconf_g_property_bind(channel, DESKTOP_ICONS_SINGLE_CLICK_PROP,
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index efed03a..815562f 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -79,13 +79,7 @@
#define SAVE_DELAY 7000
#define BORDER 8
-#define SETTING_SHOW_FILESYSTEM "/desktop-icons/file-icons/show-filesystem"
-#define SETTING_SHOW_HOME "/desktop-icons/file-icons/show-home"
-#define SETTING_SHOW_TRASH "/desktop-icons/file-icons/show-trash"
-#define SETTING_SHOW_REMOVABLE "/desktop-icons/file-icons/show-removable"
-#define SETTING_SHOW_THUMBNAILS "/desktop-icons/show-thumbnails"
-
-enum
+typedef enum
{
PROP0 = 0,
PROP_FOLDER,
@@ -93,8 +87,11 @@ enum
PROP_SHOW_HOME,
PROP_SHOW_TRASH,
PROP_SHOW_REMOVABLE,
+ PROP_SHOW_NETWORK_VOLUME,
+ PROP_SHOW_DEVICE_VOLUME,
+ PROP_SHOW_UNKNOWN_VOLUME,
PROP_SHOW_THUMBNAILS
-};
+} XfdesktopFileIconManagerProp;
struct _XfdesktopFileIconManagerPrivate
{
@@ -122,6 +119,9 @@ struct _XfdesktopFileIconManagerPrivate
GHashTable *special_icons;
gboolean show_removable_media;
+ gboolean show_network_volumes;
+ gboolean show_device_volumes;
+ gboolean show_unknown_volumes;
gboolean show_special[XFDESKTOP_SPECIAL_FILE_ICON_TRASH+1];
gboolean show_thumbnails;
@@ -188,6 +188,16 @@ static void xfdesktop_file_icon_manager_load_desktop_folder(XfdesktopFileIconMan
static void xfdesktop_file_icon_manager_load_removable_media(XfdesktopFileIconManager *fmanager);
static void xfdesktop_file_icon_manager_remove_removable_media(XfdesktopFileIconManager *fmanager);
+
+static void xfdesktop_file_icon_manager_set_show_special_file(XfdesktopFileIconManager *manager,
+ XfdesktopSpecialFileIconType type,
+ gboolean show_special_file);
+static void xfdesktop_file_icon_manager_set_show_thumbnails(XfdesktopFileIconManager *manager,
+ gboolean show_thumbnails);
+static void xfdesktop_file_icon_manager_set_show_removable_media(XfdesktopFileIconManager *manager,
+ XfdesktopFileIconManagerProp prop,
+ gboolean show);
+
static void xfdesktop_file_icon_position_changed(XfdesktopFileIcon *icon,
gpointer user_data);
@@ -284,6 +294,24 @@ xfdesktop_file_icon_manager_class_init(XfdesktopFileIconManagerClass *klass)
"show removable",
TRUE,
XFDESKTOP_PARAM_FLAGS));
+ g_object_class_install_property(gobject_class, PROP_SHOW_NETWORK_VOLUME,
+ g_param_spec_boolean("show-network-volume",
+ "show network volume",
+ "show network volume",
+ TRUE,
+ XFDESKTOP_PARAM_FLAGS));
+ g_object_class_install_property(gobject_class, PROP_SHOW_DEVICE_VOLUME,
+ g_param_spec_boolean("show-device-volume",
+ "show device volume",
+ "show device volume",
+ TRUE,
+ XFDESKTOP_PARAM_FLAGS));
+ g_object_class_install_property(gobject_class, PROP_SHOW_UNKNOWN_VOLUME,
+ g_param_spec_boolean("show-unknown-volume",
+ "show unknown volume",
+ "show unknown volume",
+ TRUE,
+ XFDESKTOP_PARAM_FLAGS));
g_object_class_install_property(gobject_class, PROP_SHOW_THUMBNAILS,
g_param_spec_boolean("show-thumbnails",
"show-thumbnails",
@@ -347,7 +375,11 @@ xfdesktop_file_icon_manager_set_property(GObject *object,
break;
case PROP_SHOW_REMOVABLE:
+ case PROP_SHOW_NETWORK_VOLUME:
+ case PROP_SHOW_DEVICE_VOLUME:
+ case PROP_SHOW_UNKNOWN_VOLUME:
xfdesktop_file_icon_manager_set_show_removable_media(fmanager,
+ property_id,
g_value_get_boolean(value));
break;
@@ -393,6 +425,18 @@ xfdesktop_file_icon_manager_get_property(GObject *object,
g_value_set_boolean(value, fmanager->priv->show_removable_media);
break;
+ case PROP_SHOW_NETWORK_VOLUME:
+ g_value_set_boolean(value, fmanager->priv->show_network_volumes);
+ break;
+
+ case PROP_SHOW_DEVICE_VOLUME:
+ g_value_set_boolean(value, fmanager->priv->show_device_volumes);
+ break;
+
+ case PROP_SHOW_UNKNOWN_VOLUME:
+ g_value_set_boolean(value, fmanager->priv->show_unknown_volumes);
+ break;
+
case PROP_SHOW_THUMBNAILS:
g_value_set_boolean(value, fmanager->priv->show_thumbnails);
break;
@@ -2160,9 +2204,33 @@ xfdesktop_file_icon_manager_add_volume_icon(XfdesktopFileIconManager *fmanager,
GVolume *volume)
{
XfdesktopVolumeIcon *icon;
+ gchar *volume_type;
g_return_val_if_fail(fmanager && G_IS_VOLUME(volume), NULL);
-
+
+ /* If we aren't showing any media exit now */
+ if(!fmanager->priv->show_removable_media)
+ return NULL;
+
+ volume_type = g_volume_get_identifier(volume, G_VOLUME_IDENTIFIER_KIND_CLASS);
+
+ /* Check if we should filter out the volume icon based on what kind it is */
+ if(g_strcmp0(volume_type, "network") == 0 && !fmanager->priv->show_network_volumes) {
+ g_free(volume_type);
+ return NULL;
+ }
+ if(g_strcmp0(volume_type, "device") == 0 && !fmanager->priv->show_device_volumes) {
+ g_free(volume_type);
+ return NULL;
+ }
+ if(volume_type == NULL && !fmanager->priv->show_unknown_volumes) {
+ g_free(volume_type);
+ return NULL;
+ }
+
+ if(volume_type)
+ g_free(volume_type);
+
/* should never return NULL */
icon = xfdesktop_volume_icon_new(volume, fmanager->priv->gscreen);
@@ -2703,38 +2771,11 @@ xfdesktop_file_icon_manager_clipboard_changed(XfdesktopClipboardManager *cmanage
cmanager);
}
-
-static void
-xfdesktop_file_icon_manager_volume_changed(GVolume *volume,
- gpointer user_data)
-{
- XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
- XfdesktopIcon *icon;
- gboolean is_present = xfdesktop_file_utils_volume_is_present(volume);
-
- icon = g_hash_table_lookup(fmanager->priv->removable_icons, volume);
-
- if(is_present && !icon)
- xfdesktop_file_icon_manager_add_volume_icon(fmanager, volume);
- else if(!is_present && icon) {
- xfdesktop_icon_view_remove_item(fmanager->priv->icon_view, icon);
- g_hash_table_remove(fmanager->priv->removable_icons, volume);
- }
-}
-
static void
xfdesktop_file_icon_manager_add_removable_volume(XfdesktopFileIconManager *fmanager,
GVolume *volume)
{
- if(!xfdesktop_file_utils_volume_is_removable(volume))
- return;
-
- if(xfdesktop_file_utils_volume_is_present(volume))
- xfdesktop_file_icon_manager_add_volume_icon(fmanager, volume);
-
- g_signal_connect(G_OBJECT(volume), "changed",
- G_CALLBACK(xfdesktop_file_icon_manager_volume_changed),
- fmanager);
+ xfdesktop_file_icon_manager_add_volume_icon(fmanager, volume);
}
static void
@@ -2801,14 +2842,6 @@ xfdesktop_file_icon_manager_ht_remove_removable_media(gpointer key,
{
XfdesktopIcon *icon = XFDESKTOP_ICON(value);
XfdesktopFileIconManager *fmanager = XFDESKTOP_FILE_ICON_MANAGER(user_data);
- GVolume *volume;
-
- volume = xfdesktop_volume_icon_peek_volume(XFDESKTOP_VOLUME_ICON(icon));
- if(volume) {
- g_signal_handlers_disconnect_by_func(volume,
- G_CALLBACK(xfdesktop_file_icon_manager_volume_changed),
- fmanager);
- }
xfdesktop_icon_view_remove_item(fmanager->priv->icon_view, icon);
}
@@ -3546,46 +3579,73 @@ xfdesktop_file_icon_manager_new(GFile *folder,
NULL);
fmanager->priv->channel = g_object_ref(G_OBJECT(channel));
- xfconf_g_property_bind(channel, SETTING_SHOW_FILESYSTEM, G_TYPE_BOOLEAN,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_FILESYSTEM, G_TYPE_BOOLEAN,
G_OBJECT(fmanager), "show-filesystem");
- xfconf_g_property_bind(channel, SETTING_SHOW_HOME, G_TYPE_BOOLEAN,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_HOME, G_TYPE_BOOLEAN,
G_OBJECT(fmanager), "show-home");
- xfconf_g_property_bind(channel, SETTING_SHOW_TRASH, G_TYPE_BOOLEAN,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_TRASH, G_TYPE_BOOLEAN,
G_OBJECT(fmanager), "show-trash");
- xfconf_g_property_bind(channel, SETTING_SHOW_REMOVABLE, G_TYPE_BOOLEAN,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_REMOVABLE, G_TYPE_BOOLEAN,
G_OBJECT(fmanager), "show-removable");
- xfconf_g_property_bind(channel, SETTING_SHOW_THUMBNAILS, G_TYPE_BOOLEAN,
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_NETWORK_REMOVABLE, G_TYPE_BOOLEAN,
+ G_OBJECT(fmanager), "show-network-volume");
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_DEVICE_REMOVABLE, G_TYPE_BOOLEAN,
+ G_OBJECT(fmanager), "show-device-volume");
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_UNKNWON_REMOVABLE, G_TYPE_BOOLEAN,
+ G_OBJECT(fmanager), "show-unknown-volume");
+ xfconf_g_property_bind(channel, DESKTOP_ICONS_SHOW_THUMBNAILS, G_TYPE_BOOLEAN,
G_OBJECT(fmanager), "show-thumbnails");
return XFDESKTOP_ICON_VIEW_MANAGER(fmanager);
}
-void
+static void
xfdesktop_file_icon_manager_set_show_removable_media(XfdesktopFileIconManager *manager,
- gboolean show_removable_media)
+ XfdesktopFileIconManagerProp prop,
+ gboolean show)
{
g_return_if_fail(XFDESKTOP_IS_FILE_ICON_MANAGER(manager));
-
- if(show_removable_media == manager->priv->show_removable_media)
- return;
-
- manager->priv->show_removable_media = show_removable_media;
-
+
+ switch(prop) {
+ case PROP_SHOW_REMOVABLE:
+ if(show == manager->priv->show_removable_media)
+ return;
+
+ manager->priv->show_removable_media = show;
+ break;
+ case PROP_SHOW_NETWORK_VOLUME:
+ if(show == manager->priv->show_network_volumes)
+ return;
+
+ manager->priv->show_network_volumes = show;
+ break;
+ case PROP_SHOW_DEVICE_VOLUME:
+ if(show == manager->priv->show_device_volumes)
+ return;
+
+ manager->priv->show_device_volumes = show;
+ break;
+ case PROP_SHOW_UNKNOWN_VOLUME:
+ if(show == manager->priv->show_unknown_volumes)
+ return;
+
+ manager->priv->show_unknown_volumes = show;
+ break;
+ default:
+ break;
+ }
+
if(!manager->priv->inited)
return;
-
- if(show_removable_media)
+
+ /* Always remove all the icons when a setting changes */
+ xfdesktop_file_icon_manager_remove_removable_media(manager);
+
+ /* Then re-add the icons the user wants */
+ if(manager->priv->show_removable_media)
xfdesktop_file_icon_manager_load_removable_media(manager);
- else
- xfdesktop_file_icon_manager_remove_removable_media(manager);
}
-gboolean
-xfdesktop_file_icon_manager_get_show_removable_media(XfdesktopFileIconManager *manager)
-{
- g_return_val_if_fail(XFDESKTOP_IS_FILE_ICON_MANAGER(manager), FALSE);
- return manager->priv->show_removable_media;
-}
static void
xfdesktop_file_icon_manager_requeue_thumbnails(gpointer key,
@@ -3608,7 +3668,7 @@ xfdesktop_file_icon_manager_remove_thumbnails(gpointer key,
xfdesktop_icon_delete_thumbnail(XFDESKTOP_ICON(icon));
}
-void
+static void
xfdesktop_file_icon_manager_set_show_thumbnails(XfdesktopFileIconManager *manager,
gboolean show_thumbnails)
{
@@ -3637,14 +3697,7 @@ xfdesktop_file_icon_manager_set_show_thumbnails(XfdesktopFileIconManager *manage
}
}
-gboolean
-xfdesktop_file_icon_manager_get_show_thumbnails(XfdesktopFileIconManager *manager)
-{
- g_return_val_if_fail(XFDESKTOP_IS_FILE_ICON_MANAGER(manager), FALSE);
- return manager->priv->show_thumbnails;
-}
-
-void
+static void
xfdesktop_file_icon_manager_set_show_special_file(XfdesktopFileIconManager *manager,
XfdesktopSpecialFileIconType type,
gboolean show_special_file)
@@ -3675,17 +3728,6 @@ xfdesktop_file_icon_manager_set_show_special_file(XfdesktopFileIconManager *mana
}
}
-gboolean
-xfdesktop_file_icon_manager_get_show_special_file(XfdesktopFileIconManager *manager,
- XfdesktopSpecialFileIconType type)
-{
- g_return_val_if_fail(XFDESKTOP_IS_FILE_ICON_MANAGER(manager), FALSE);
- g_return_val_if_fail((int)type >= 0 && type <= XFDESKTOP_SPECIAL_FILE_ICON_TRASH,
- FALSE);
-
- return manager->priv->show_special[type];
-}
-
static void
xfdesktop_file_icon_manager_update_image(GtkWidget *widget,
gchar *srcfile,
diff --git a/src/xfdesktop-file-icon-manager.h b/src/xfdesktop-file-icon-manager.h
index 60fb0d0..847f573 100644
--- a/src/xfdesktop-file-icon-manager.h
+++ b/src/xfdesktop-file-icon-manager.h
@@ -55,19 +55,6 @@ GType xfdesktop_file_icon_manager_get_type(void) G_GNUC_CONST;
XfdesktopIconViewManager *xfdesktop_file_icon_manager_new(GFile *folder,
XfconfChannel *channel);
-void xfdesktop_file_icon_manager_set_show_removable_media(XfdesktopFileIconManager *manager,
- gboolean show_removable_media);
-gboolean xfdesktop_file_icon_manager_get_show_removable_media(XfdesktopFileIconManager *manager);
-
-void xfdesktop_file_icon_manager_set_show_special_file(XfdesktopFileIconManager *manager,
- XfdesktopSpecialFileIconType type,
- gboolean show_special_file);
-gboolean xfdesktop_file_icon_manager_get_show_special_file(XfdesktopFileIconManager *manager,
- XfdesktopSpecialFileIconType type);
-void xfdesktop_file_icon_manager_set_show_thumbnails(XfdesktopFileIconManager *manager,
- gboolean show_thumbnails);
-gboolean xfdesktop_file_icon_manager_get_show_thumbnails(XfdesktopFileIconManager *manager);
-
gboolean xfdesktop_file_icon_manager_get_cached_icon_position(
XfdesktopFileIconManager *fmanager,
const gchar *name,
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index 44feba1..4f53c57 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -237,137 +237,6 @@ xfdesktop_file_utils_get_display_name(GFile *file,
return display_name;
}
-gboolean
-xfdesktop_file_utils_volume_is_present(GVolume *volume)
-{
- gboolean has_media = FALSE;
- gboolean is_shadowed = FALSE;
- GDrive *drive;
-#if GLIB_CHECK_VERSION (2, 20, 0)
- GMount *mount;
-#endif
-
- g_return_val_if_fail(G_IS_VOLUME(volume), FALSE);
-
- drive = g_volume_get_drive (volume);
- if(drive) {
- has_media = g_drive_has_media(drive);
- g_object_unref(drive);
- }
-
-#if GLIB_CHECK_VERSION (2, 20, 0)
- mount = g_volume_get_mount(volume);
- if(mount) {
- is_shadowed = g_mount_is_shadowed(mount);
- g_object_unref(mount);
- }
-#endif
-
- return has_media && !is_shadowed;
-}
-
-#ifdef HAVE_GIO_UNIX
-static gboolean
-xfdesktop_file_utils_mount_is_internal (GMount *mount)
-{
- const gchar *point_mount_path;
- gboolean is_internal = FALSE;
- GFile *root;
- GList *lp;
- GList *mount_points;
- gchar *mount_path;
-
- g_return_val_if_fail(G_IS_MOUNT(mount), FALSE);
-
- /* determine the mount path */
- root = g_mount_get_root(mount);
- mount_path = g_file_get_path(root);
- g_object_unref(root);
-
- /* assume non-internal if we cannot determine the path */
- if (!mount_path)
- return FALSE;
-
- if (g_unix_is_mount_path_system_internal(mount_path)) {
- /* mark as internal */
- is_internal = TRUE;
- } else {
- /* get a list of all mount points */
- mount_points = g_unix_mount_points_get(NULL);
-
- /* search for the mount point associated with the mount entry */
- for (lp = mount_points; !is_internal && lp != NULL; lp = lp->next) {
- point_mount_path = g_unix_mount_point_get_mount_path(lp->data);
-
- /* check if this is the mount point we are looking for */
- if (g_strcmp0(mount_path, point_mount_path) == 0) {
- /* mark as internal if the user cannot mount this device */
- if (!g_unix_mount_point_is_user_mountable(lp->data))
- is_internal = TRUE;
- }
-
- /* free the mount point, we no longer need it */
- g_unix_mount_point_free(lp->data);
- }
-
- /* free the mount point list */
- g_list_free(mount_points);
- }
-
- g_free(mount_path);
-
- return is_internal;
-}
-#endif
-
-
-
-gboolean
-xfdesktop_file_utils_volume_is_removable(GVolume *volume)
-{
- gboolean can_eject;
- gboolean can_mount = FALSE;
- gboolean can_unmount = FALSE;
- gboolean is_removable = FALSE;
- gboolean is_internal = FALSE;
- GDrive *drive;
- GMount *mount;
-
- g_return_val_if_fail(G_IS_VOLUME(volume), FALSE);
-
- /* check if the volume can be ejected */
- can_eject = g_volume_can_eject(volume);
-
- /* determine the drive for the volume */
- drive = g_volume_get_drive(volume);
- if(drive) {
- /*check if the drive media can be removed */
- is_removable = g_drive_is_media_removable(drive);
-
- /* release the drive */
- g_object_unref(drive);
- }
-
- /* determine the mount for the volume (if it is mounted at all) */
- mount = g_volume_get_mount(volume);
- if(mount) {
-#ifdef HAVE_GIO_UNIX
- is_internal = xfdesktop_file_utils_mount_is_internal (mount);
-#endif
-
- /* check if the volume can be unmounted */
- can_unmount = g_mount_can_unmount(mount);
-
- /* release the mount */
- g_object_unref(mount);
- }
-
- /* determine whether the device can be mounted */
- can_mount = g_volume_can_mount(volume);
-
- return (!is_internal) && (can_eject || can_unmount || is_removable || can_mount);
-}
-
GList *
xfdesktop_file_utils_file_icon_list_to_file_list(GList *icon_list)
{
diff --git a/src/xfdesktop-file-utils.h b/src/xfdesktop-file-utils.h
index 65bb9bc..a3fed69 100644
--- a/src/xfdesktop-file-utils.h
+++ b/src/xfdesktop-file-utils.h
@@ -39,9 +39,6 @@ GKeyFile *xfdesktop_file_utils_query_key_file(GFile *file,
gchar *xfdesktop_file_utils_get_display_name(GFile *file,
GFileInfo *info);
-gboolean xfdesktop_file_utils_volume_is_present(GVolume *volume);
-gboolean xfdesktop_file_utils_volume_is_removable(GVolume *volume);
-
GList *xfdesktop_file_utils_file_icon_list_to_file_list(GList *icon_list);
GList *xfdesktop_file_utils_file_list_from_string(const gchar *string);
gchar *xfdesktop_file_utils_file_list_to_string(GList *file_list);
diff --git a/src/xfdesktop-volume-icon.c b/src/xfdesktop-volume-icon.c
index c8170e8..a8427f1 100644
--- a/src/xfdesktop-volume-icon.c
+++ b/src/xfdesktop-volume-icon.c
@@ -1044,22 +1044,11 @@ static void
xfdesktop_volume_icon_changed(GVolume *volume,
XfdesktopVolumeIcon *volume_icon)
{
- gboolean is_present;
-
g_return_if_fail(G_IS_VOLUME(volume));
g_return_if_fail(XFDESKTOP_IS_VOLUME_ICON(volume_icon));
DBG("VOLUME CHANGED");
- is_present = xfdesktop_file_utils_volume_is_present(volume);
- if(!is_present) {
- /* don't do anything because the icon will be removed from
- * the file icon manager anyway */
- return;
- }
-
- DBG("VOLUME STILL PRESENT");
-
/**
* NOTE: We use a timeout here to check if the volume is
* now mounted (or has been unmounted). This timeout seems
More information about the Xfce4-commits
mailing list