Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

91 lines
3.4 KiB

diff --git a/src/base/fm-config.c b/src/base/fm-config.c
index a6338579..dcf14980 100644
--- a/src/base/fm-config.c
+++ b/src/base/fm-config.c
@@ -127,6 +127,7 @@ static void fm_config_finalize(GObject *object)
g_free(cfg->format_cmd);
g_free(cfg->list_view_size_units);
g_free(cfg->saved_search);
+ g_strfreev(cfg->volumes_blacklist);
G_OBJECT_CLASS(fm_config_parent_class)->finalize(object);
}
@@ -294,6 +295,8 @@ void fm_config_load_from_key_file(FmConfig* cfg, GKeyFile* kf)
/* replace whitelist */
g_strfreev(cfg->modules_whitelist);
cfg->modules_whitelist = g_key_file_get_string_list(kf, "config", "modules_whitelist", NULL, NULL);
+ g_strfreev(cfg->volumes_blacklist);
+ cfg->volumes_blacklist = g_key_file_get_string_list(kf, "config", "volumes_blacklist", NULL, NULL);
#ifdef USE_UDISKS
fm_key_file_get_bool(kf, "config", "show_internal_volumes", &cfg->show_internal_volumes);
@@ -507,6 +510,7 @@ void fm_config_save(FmConfig* cfg, const char* name)
_save_config_strv(str, cfg, modules_blacklist);
_save_config_strv(str, cfg, modules_whitelist);
_save_config_bool(str, cfg, smart_desktop_autodrop);
+ _save_config_strv(str, cfg, volumes_blacklist);
g_string_append(str, "\n[ui]\n");
_save_config_int(str, cfg, big_icon_size);
_save_config_int(str, cfg, small_icon_size);
diff --git a/src/base/fm-config.h b/src/base/fm-config.h
index 10d5bbee..9360325f 100644
--- a/src/base/fm-config.h
+++ b/src/base/fm-config.h
@@ -207,6 +207,7 @@ struct _FmConfig
gboolean smart_desktop_autodrop;
gchar *saved_search;
+ gchar **volumes_blacklist;
/*< private >*/
gpointer _reserved1; /* reserved space for updates until next ABI */
gpointer _reserved2;
@@ -214,7 +215,6 @@ struct _FmConfig
gpointer _reserved4;
gpointer _reserved5;
gpointer _reserved6;
- gpointer _reserved7;
GFileMonitor *_cfg_mon;
};
diff --git a/src/gtk/fm-places-model.c b/src/gtk/fm-places-model.c
index 104f988b..f3c06218 100644
--- a/src/gtk/fm-places-model.c
+++ b/src/gtk/fm-places-model.c
@@ -384,6 +384,28 @@ static void remove_path_item(GtkListStore* model, FmPlacesOrder id)
} while(gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &it));
}
+static gboolean is_volume_blacklisted(GVolume *volume)
+{
+ char *name, *uuid, **list;
+ gboolean blacklisted = FALSE;
+
+ list = fm_config->volumes_blacklist;
+ if(list)
+ {
+ name = g_volume_get_name(volume);
+ uuid = g_volume_get_uuid(volume);
+
+ for( ; *list && !blacklisted; list++ )
+ if((name && !strcmp(name, *list)) || (uuid && !strcmp(uuid, *list)))
+ blacklisted = TRUE;
+
+ g_free(name);
+ g_free(uuid);
+ }
+
+ return blacklisted;
+}
+
static void add_volume_or_mount(FmPlacesModel* model, GObject* volume_or_mount, FmFileInfoJob* job)
{
FmPlacesItem* item;
@@ -391,6 +413,8 @@ static void add_volume_or_mount(FmPlacesModel* model, GObject* volume_or_mount,
GtkTreeIter it;
if(G_IS_VOLUME(volume_or_mount))
{
+ if(is_volume_blacklisted(G_VOLUME(volume_or_mount)))
+ return;
tp = gtk_tree_row_reference_get_path(model->separator);
item = add_new_item(GTK_LIST_STORE(model), FM_PLACES_ITEM_VOLUME, &it, tp);
gtk_tree_path_free(tp);