- Hide Fedora livecd mount (#439166)

This commit is contained in:
Tomas Bzatek 2008-04-14 13:50:04 +00:00
parent fc23f8b607
commit 4f92cec767
2 changed files with 179 additions and 1 deletions

View File

@ -0,0 +1,171 @@
Index: src/file-manager/fm-tree-view.c
===================================================================
--- src/file-manager/fm-tree-view.c (revision 14068)
+++ src/file-manager/fm-tree-view.c (working copy)
@@ -590,6 +590,9 @@
GFile *root;
GIcon *icon;
+ if (nautilus_is_livecd (mount))
+ return;
+
icon = g_mount_get_icon (mount);
root = g_mount_get_root (mount);
mount_uri = g_file_get_uri (root);
Index: src/nautilus-places-sidebar.c
===================================================================
--- src/nautilus-places-sidebar.c (revision 14068)
+++ src/nautilus-places-sidebar.c (working copy)
@@ -308,22 +308,24 @@
volume = ll->data;
mount = g_volume_get_mount (volume);
if (mount != NULL) {
- /* Show mounted volume in the sidebar */
- icon = g_mount_get_icon (mount);
- root = g_mount_get_root (mount);
- mount_uri = g_file_get_uri (root);
- g_object_unref (root);
- name = g_mount_get_name (mount);
- last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
- name, icon, mount_uri,
- drive, volume, mount, 0);
- if (strcmp (location, mount_uri) == 0) {
- gtk_tree_selection_select_iter (selection, &last_iter);
+ if (! nautilus_is_livecd (mount)) {
+ /* Show mounted volume in the sidebar */
+ icon = g_mount_get_icon (mount);
+ root = g_mount_get_root (mount);
+ mount_uri = g_file_get_uri (root);
+ g_object_unref (root);
+ name = g_mount_get_name (mount);
+ last_iter = add_place (sidebar, PLACES_MOUNTED_VOLUME,
+ name, icon, mount_uri,
+ drive, volume, mount, 0);
+ if (strcmp (location, mount_uri) == 0) {
+ gtk_tree_selection_select_iter (selection, &last_iter);
+ }
+ g_object_unref (mount);
+ g_object_unref (icon);
+ g_free (name);
+ g_free (mount_uri);
}
- g_object_unref (mount);
- g_object_unref (icon);
- g_free (name);
- g_free (mount_uri);
} else {
/* Do show the unmounted volumes in the sidebar;
* this is so the user can mount it (in case automounting
@@ -412,6 +414,8 @@
mounts = g_volume_monitor_get_mounts (volume_monitor);
for (l = mounts; l != NULL; l = l->next) {
mount = l->data;
+ if (nautilus_is_livecd (mount))
+ continue;
volume = g_mount_get_volume (mount);
if (volume != NULL) {
g_object_unref (volume);
Index: libnautilus-private/nautilus-directory-async.c
===================================================================
--- libnautilus-private/nautilus-directory-async.c (revision 14068)
+++ libnautilus-private/nautilus-directory-async.c (working copy)
@@ -968,6 +968,9 @@
return;
}
+ if (nautilus_is_livecd_from_info (info))
+ return;
+
if (g_file_info_get_name (info) == NULL) {
char *uri;
Index: libnautilus-private/nautilus-desktop-link-monitor.c
===================================================================
--- libnautilus-private/nautilus-desktop-link-monitor.c (revision 14068)
+++ libnautilus-private/nautilus-desktop-link-monitor.c (working copy)
@@ -192,7 +192,7 @@
link = NULL;
- if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {
+ if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE) && (! nautilus_is_livecd (mount))) {
link = nautilus_desktop_link_new_from_mount (mount);
monitor->details->mount_links = g_list_prepend (monitor->details->mount_links, link);
}
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c (revision 14068)
+++ libnautilus-private/nautilus-file.c (working copy)
@@ -7145,3 +7145,53 @@
}
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
+
+
+gboolean
+nautilus_is_livecd (GMount *mount)
+{
+ char *mount_name, *root_path;
+ GFile *root_file;
+ gboolean res;
+
+ if (! mount)
+ return FALSE;
+
+ mount_name = g_mount_get_name (mount);
+ root_file = g_mount_get_root (mount);
+ root_path = g_file_get_path (root_file);
+
+ res = ((g_strstr_len (mount_name, strlen (mount_name), LIVECD_LABEL_STRING) == mount_name) &&
+ (g_strstr_len (root_path, strlen (root_path), LIVECD_MOUNTPOINT) == root_path));
+
+ g_free (root_path);
+ g_free (mount_name);
+ g_object_unref (root_file);
+
+ return res;
+}
+
+gboolean
+nautilus_is_livecd_from_info (GFileInfo *info)
+{
+ const char *mount_name;
+ const char *root_path;
+ gboolean res;
+
+ if (! info)
+ return FALSE;
+
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_MOUNTABLE)
+ return FALSE;
+
+ mount_name = g_file_info_get_display_name (info);
+ root_path = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+
+ res = ((g_strstr_len (mount_name, strlen (mount_name), LIVECD_LABEL_STRING) == mount_name) &&
+ (g_strstr_len (root_path, strlen (root_path), LIVECD_MOUNTPOINT) == root_path + 7));
+
+ return res;
+}
+
+
+
Index: libnautilus-private/nautilus-file.h
===================================================================
--- libnautilus-private/nautilus-file.h (revision 14068)
+++ libnautilus-private/nautilus-file.h (working copy)
@@ -423,6 +423,14 @@
/* Debugging */
void nautilus_file_dump (NautilusFile *file);
+/* LiveCD mount hiding */
+#define LIVECD_LABEL_STRING "Fedora-9-"
+#define LIVECD_MOUNTPOINT "/mnt/live"
+gboolean nautilus_is_livecd (GMount *mount);
+gboolean nautilus_is_livecd_from_info (GFileInfo *info);
+
+
+
typedef struct NautilusFileDetails NautilusFileDetails;
struct NautilusFile {

View File

@ -19,7 +19,7 @@
Name: nautilus Name: nautilus
Summary: Nautilus is a file manager for GNOME Summary: Nautilus is a file manager for GNOME
Version: 2.22.2 Version: 2.22.2
Release: 1%{?dist} Release: 2%{?dist}
License: GPLv2+ License: GPLv2+
Group: User Interface/Desktops Group: User Interface/Desktops
Source: http://download.gnome.org/sources/%{name}/2.22/%{name}-%{version}.tar.bz2 Source: http://download.gnome.org/sources/%{name}/2.22/%{name}-%{version}.tar.bz2
@ -86,6 +86,9 @@ Patch6: nautilus-2.22.1-dynamic-search.patch
Patch7: rtl-fix.patch Patch7: rtl-fix.patch
Patch8: nautilus-2.22.1-hide-white-screen.patch Patch8: nautilus-2.22.1-hide-white-screen.patch
# livecd hiding patch (https://bugzilla.redhat.com/show_bug.cgi?id=439166)
Patch9: nautilus-2.22.2-hide-livecd-mount.diff
%description %description
Nautilus integrates access to files, applications, media, Nautilus integrates access to files, applications, media,
@ -122,6 +125,7 @@ for writing nautilus extensions.
%patch6 -p1 -b .dynamic-search %patch6 -p1 -b .dynamic-search
%patch7 -p1 -b .rtl-fix %patch7 -p1 -b .rtl-fix
%patch8 -p1 -b .hide-white-screen %patch8 -p1 -b .hide-white-screen
%patch9 -p0 -b .livecd
%build %build
@ -232,6 +236,9 @@ fi
%{_libdir}/*.so %{_libdir}/*.so
%changelog %changelog
* Fri Apr 11 2008 Tomas Bzatek <tbzatek@redhat.com> - 2.22.2-2
- Hide Fedora livecd mount (#439166)
* Mon Apr 7 2008 Matthias Clasen <mclasen@redhat.com> - 2.22.2-1 * Mon Apr 7 2008 Matthias Clasen <mclasen@redhat.com> - 2.22.2-1
- Update to 2.22.2 - Update to 2.22.2