diff options
author | Alexander Larsson <alexl@redhat.com> | 2005-12-12 16:22:17 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2005-12-12 16:22:17 +0000 |
commit | eaf8be2c8cc9a1c1188f39299570dd70ccfbcac5 (patch) | |
tree | ee6eeb5173e4c7d6153e9f2ec294497ef458a319 /libnautilus-private | |
parent | 415d9bf66557c658d7513c4c25681d71b766afb7 (diff) | |
download | nautilus-eaf8be2c8cc9a1c1188f39299570dd70ccfbcac5.tar.gz |
Merge in changes from NAUTILUS_SEARCH2_MERGE_ANCHOR1 toNAUTILUS_SEARCH2_MERGE_POINT2
2005-12-06 Alexander Larsson <alexl@redhat.com>
Merge in changes from NAUTILUS_SEARCH2_MERGE_ANCHOR1 to
NAUTILUS_SEARCH2_MERGE_ANCHOR2 (on HEAD).
(This is NAUTILUS_SEARCH2_MERGE_POINT2)
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/apps_nautilus_preferences.schemas.in | 15 | ||||
-rw-r--r-- | libnautilus-private/nautilus-desktop-icon-file.c | 5 | ||||
-rw-r--r-- | libnautilus-private/nautilus-desktop-link-monitor.c | 191 | ||||
-rw-r--r-- | libnautilus-private/nautilus-desktop-link.c | 10 | ||||
-rw-r--r-- | libnautilus-private/nautilus-desktop-link.h | 3 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory-async.c | 9 | ||||
-rw-r--r-- | libnautilus-private/nautilus-emblem-utils.c | 11 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 34 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-queue.c | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file.c | 149 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.h | 1 | ||||
-rw-r--r-- | libnautilus-private/nautilus-program-choosing.c | 7 |
12 files changed, 190 insertions, 247 deletions
diff --git a/libnautilus-private/apps_nautilus_preferences.schemas.in b/libnautilus-private/apps_nautilus_preferences.schemas.in index 8e0dd807b..a31cee3da 100644 --- a/libnautilus-private/apps_nautilus_preferences.schemas.in +++ b/libnautilus-private/apps_nautilus_preferences.schemas.in @@ -810,6 +810,21 @@ most cases, this should be left alone. -->Sans 10</default> </schema> <schema> + <key>/schemas/apps/nautilus/desktop/network_visible</key> + <applyto>/apps/nautilus/desktop/network_visible</applyto> + <owner>nautilus</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Network Servers icon visible on the desktop</short> + <long> + If this is set to true, an icon linking to the Network Servers view + will be put on the desktop. + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/nautilus/desktop/computer_icon_name</key> <applyto>/apps/nautilus/desktop/computer_icon_name</applyto> <owner>nautilus</owner> diff --git a/libnautilus-private/nautilus-desktop-icon-file.c b/libnautilus-private/nautilus-desktop-icon-file.c index ce28531ee..84d052974 100644 --- a/libnautilus-private/nautilus-desktop-icon-file.c +++ b/libnautilus-private/nautilus-desktop-icon-file.c @@ -204,13 +204,16 @@ update_info_from_link (NautilusDesktopIconFile *icon_file) GNOME_VFS_PERM_GROUP_WRITE | GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_OTHER_READ | - GNOME_VFS_PERM_GROUP_READ; + GNOME_VFS_PERM_GROUP_READ | + GNOME_VFS_PERM_ACCESS_READABLE | + GNOME_VFS_PERM_ACCESS_WRITABLE; file_info->valid_fields = GNOME_VFS_FILE_INFO_FIELDS_TYPE | GNOME_VFS_FILE_INFO_FIELDS_FLAGS | GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE | GNOME_VFS_FILE_INFO_FIELDS_SIZE | GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS | + GNOME_VFS_FILE_INFO_FIELDS_ACCESS | GNOME_VFS_FILE_INFO_FIELDS_LINK_COUNT; volume = nautilus_desktop_link_get_volume (link); diff --git a/libnautilus-private/nautilus-desktop-link-monitor.c b/libnautilus-private/nautilus-desktop-link-monitor.c index d9ea28b6b..8eae55491 100644 --- a/libnautilus-private/nautilus-desktop-link-monitor.c +++ b/libnautilus-private/nautilus-desktop-link-monitor.c @@ -50,6 +50,7 @@ struct NautilusDesktopLinkMonitorDetails { NautilusDesktopLink *home_link; NautilusDesktopLink *computer_link; NautilusDesktopLink *trash_link; + NautilusDesktopLink *network_link; gulong mount_id; gulong unmount_id; @@ -149,6 +150,7 @@ nautilus_desktop_link_monitor_delete_link (NautilusDesktopLinkMonitor *monitor, case NAUTILUS_DESKTOP_LINK_HOME: case NAUTILUS_DESKTOP_LINK_COMPUTER: case NAUTILUS_DESKTOP_LINK_TRASH: + case NAUTILUS_DESKTOP_LINK_NETWORK: /* just ignore. We don't allow you to delete these */ break; default: @@ -249,6 +251,23 @@ volume_unmounted_callback (GnomeVFSVolumeMonitor *volume_monitor, } } +static void +update_link_visibility (NautilusDesktopLinkMonitor *monitor, + NautilusDesktopLink **link_ref, + NautilusDesktopLinkType link_type, + const char *preference_key) +{ + if (eel_preferences_get_boolean (preference_key)) { + if (*link_ref == NULL) { + *link_ref = nautilus_desktop_link_new (link_type); + } + } else { + if (*link_ref != NULL) { + g_object_unref (*link_ref); + *link_ref = NULL; + } + } +} static void desktop_home_visible_changed (gpointer callback_data) @@ -257,16 +276,10 @@ desktop_home_visible_changed (gpointer callback_data) monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data); - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE)) { - if (monitor->details->home_link == NULL) { - monitor->details->home_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_HOME); - } - } else { - if (monitor->details->home_link != NULL) { - g_object_unref (monitor->details->home_link); - monitor->details->home_link = NULL; - } - } + update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (monitor), + &monitor->details->home_link, + NAUTILUS_DESKTOP_LINK_HOME, + NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE); } static void @@ -276,16 +289,10 @@ desktop_computer_visible_changed (gpointer callback_data) monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data); - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE)) { - if (monitor->details->computer_link == NULL) { - monitor->details->computer_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_COMPUTER); - } - } else { - if (monitor->details->computer_link != NULL) { - g_object_unref (monitor->details->computer_link); - monitor->details->computer_link = NULL; - } - } + update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data), + &monitor->details->computer_link, + NAUTILUS_DESKTOP_LINK_COMPUTER, + NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE); } static void @@ -295,16 +302,23 @@ desktop_trash_visible_changed (gpointer callback_data) monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data); - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE)) { - if (monitor->details->trash_link == NULL) { - monitor->details->trash_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_TRASH); - } - } else { - if (monitor->details->trash_link != NULL) { - g_object_unref (monitor->details->trash_link); - monitor->details->trash_link = NULL; - } - } + update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data), + &monitor->details->trash_link, + NAUTILUS_DESKTOP_LINK_TRASH, + NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE); +} + +static void +desktop_network_visible_changed (gpointer callback_data) +{ + NautilusDesktopLinkMonitor *monitor; + + monitor = NAUTILUS_DESKTOP_LINK_MONITOR (callback_data); + + update_link_visibility (NAUTILUS_DESKTOP_LINK_MONITOR (callback_data), + &monitor->details->network_link, + NAUTILUS_DESKTOP_LINK_NETWORK, + NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE); } static void @@ -334,6 +348,20 @@ desktop_volumes_visible_changed (gpointer callback_data) } static void +create_link_and_add_preference (NautilusDesktopLink **link_ref, + NautilusDesktopLinkType link_type, + const char *preference_key, + EelPreferencesCallback callback, + gpointer callback_data) +{ + if (eel_preferences_get_boolean (preference_key)) { + *link_ref = nautilus_desktop_link_new (link_type); + } + + eel_preferences_add_callback (preference_key, callback, callback_data); +} + +static void nautilus_desktop_link_monitor_init (gpointer object, gpointer klass) { NautilusDesktopLinkMonitor *monitor; @@ -350,17 +378,33 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass) /* We keep around a ref to the desktop dir */ monitor->details->desktop_dir = nautilus_directory_get (EEL_DESKTOP_URI); - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE)) { - monitor->details->home_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_HOME); - } - - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE)) { - monitor->details->computer_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_COMPUTER); - } + /* Default links */ + + create_link_and_add_preference (&monitor->details->home_link, + NAUTILUS_DESKTOP_LINK_HOME, + NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE, + desktop_home_visible_changed, + monitor); + + create_link_and_add_preference (&monitor->details->computer_link, + NAUTILUS_DESKTOP_LINK_COMPUTER, + NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE, + desktop_computer_visible_changed, + monitor); - if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE)) { - monitor->details->trash_link = nautilus_desktop_link_new (NAUTILUS_DESKTOP_LINK_TRASH); - } + create_link_and_add_preference (&monitor->details->trash_link, + NAUTILUS_DESKTOP_LINK_TRASH, + NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE, + desktop_trash_visible_changed, + monitor); + + create_link_and_add_preference (&monitor->details->network_link, + NAUTILUS_DESKTOP_LINK_NETWORK, + NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE, + desktop_network_visible_changed, + monitor); + + /* Volume links */ volume_monitor = gnome_vfs_get_volume_monitor (); @@ -372,15 +416,6 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass) } g_list_free (volumes); - eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE, - desktop_home_visible_changed, - monitor); - eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE, - desktop_computer_visible_changed, - monitor); - eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE, - desktop_trash_visible_changed, - monitor); eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE, desktop_volumes_visible_changed, monitor); @@ -390,7 +425,21 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass) monitor->details->unmount_id = g_signal_connect_object (volume_monitor, "volume_unmounted", G_CALLBACK (volume_unmounted_callback), monitor, 0); -} +} + +static void +remove_link_and_preference (NautilusDesktopLink **link_ref, + const char *preference_key, + EelPreferencesCallback callback, + gpointer callback_data) +{ + if (*link_ref != NULL) { + g_object_unref (*link_ref); + *link_ref = NULL; + } + + eel_preferences_remove_callback (preference_key, callback, callback_data); +} static void desktop_link_monitor_finalize (GObject *object) @@ -399,20 +448,29 @@ desktop_link_monitor_finalize (GObject *object) monitor = NAUTILUS_DESKTOP_LINK_MONITOR (object); - if (monitor->details->home_link != NULL) { - g_object_unref (monitor->details->home_link); - monitor->details->home_link = NULL; - } + /* Default links */ - if (monitor->details->computer_link != NULL) { - g_object_unref (monitor->details->computer_link); - monitor->details->computer_link = NULL; - } + remove_link_and_preference (&monitor->details->home_link, + NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE, + desktop_home_visible_changed, + monitor); - if (monitor->details->trash_link != NULL) { - g_object_unref (monitor->details->trash_link); - monitor->details->trash_link = NULL; - } + remove_link_and_preference (&monitor->details->computer_link, + NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE, + desktop_computer_visible_changed, + monitor); + + remove_link_and_preference (&monitor->details->trash_link, + NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE, + desktop_trash_visible_changed, + monitor); + + remove_link_and_preference (&monitor->details->network_link, + NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE, + desktop_network_visible_changed, + monitor); + + /* Volumes */ g_list_foreach (monitor->details->volume_links, (GFunc)g_object_unref, NULL); g_list_free (monitor->details->volume_links); @@ -421,15 +479,6 @@ desktop_link_monitor_finalize (GObject *object) nautilus_directory_unref (monitor->details->desktop_dir); monitor->details->desktop_dir = NULL; - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE, - desktop_home_visible_changed, - monitor); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE, - desktop_computer_visible_changed, - monitor); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE, - desktop_trash_visible_changed, - monitor); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE, desktop_volumes_visible_changed, monitor); diff --git a/libnautilus-private/nautilus-desktop-link.c b/libnautilus-private/nautilus-desktop-link.c index d0ddd7683..458103d85 100644 --- a/libnautilus-private/nautilus-desktop-link.c +++ b/libnautilus-private/nautilus-desktop-link.c @@ -174,6 +174,14 @@ nautilus_desktop_link_new (NautilusDesktopLinkType type) g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed", G_CALLBACK (trash_state_changed_callback), link, 0); break; + + case NAUTILUS_DESKTOP_LINK_NETWORK: + link->details->filename = g_strdup ("network"); + link->details->display_name = _("Network Servers"); + link->details->activation_uri = g_strdup ("network:///"); + link->details->icon = g_strdup ("gnome-fs-network"); + break; + default: case NAUTILUS_DESKTOP_LINK_VOLUME: g_assert_not_reached(); @@ -379,7 +387,7 @@ desktop_link_finalize (GObject *object) trash_name_changed, link); } - + if (link->details->type == NAUTILUS_DESKTOP_LINK_VOLUME) { gnome_vfs_volume_unref (link->details->volume); } diff --git a/libnautilus-private/nautilus-desktop-link.h b/libnautilus-private/nautilus-desktop-link.h index fd55bae01..578e592a2 100644 --- a/libnautilus-private/nautilus-desktop-link.h +++ b/libnautilus-private/nautilus-desktop-link.h @@ -54,7 +54,8 @@ typedef enum { NAUTILUS_DESKTOP_LINK_HOME, NAUTILUS_DESKTOP_LINK_COMPUTER, NAUTILUS_DESKTOP_LINK_TRASH, - NAUTILUS_DESKTOP_LINK_VOLUME + NAUTILUS_DESKTOP_LINK_VOLUME, + NAUTILUS_DESKTOP_LINK_NETWORK } NautilusDesktopLinkType; GType nautilus_desktop_link_get_type (void); diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index d8883d4e7..87dc9cfee 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -1476,7 +1476,8 @@ nautilus_directory_get_info_for_new_files (NautilusDirectory *directory, (&handle, vfs_uri_list, (GNOME_VFS_FILE_INFO_GET_MIME_TYPE - | GNOME_VFS_FILE_INFO_FOLLOW_LINKS), + | GNOME_VFS_FILE_INFO_FOLLOW_LINKS + | GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS), GNOME_VFS_PRIORITY_DEFAULT, new_files_callback, directory); @@ -1996,7 +1997,8 @@ start_monitoring_file_list (NautilusDirectory *directory) (&directory->details->directory_load_in_progress, /* handle */ directory->details->uri, /* uri */ (GNOME_VFS_FILE_INFO_GET_MIME_TYPE /* options */ - | GNOME_VFS_FILE_INFO_FOLLOW_LINKS), + | GNOME_VFS_FILE_INFO_FOLLOW_LINKS + | GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS), DIRECTORY_LOAD_ITEMS_PER_CALLBACK, /* items_per_notification */ GNOME_VFS_PRIORITY_DEFAULT, directory_load_callback, /* callback */ @@ -2808,7 +2810,8 @@ file_info_start (NautilusDirectory *directory, fake_list.next = NULL; options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE - | GNOME_VFS_FILE_INFO_FOLLOW_LINKS; + | GNOME_VFS_FILE_INFO_FOLLOW_LINKS + | GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS; if (need_slow_mime) { options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE; } diff --git a/libnautilus-private/nautilus-emblem-utils.c b/libnautilus-private/nautilus-emblem-utils.c index 21eaff331..081487aec 100644 --- a/libnautilus-private/nautilus-emblem-utils.c +++ b/libnautilus-private/nautilus-emblem-utils.c @@ -196,12 +196,12 @@ nautilus_emblem_verify_keyword (GtkWindow *parent_window, if (keyword == NULL || strlen (keyword) == 0) { eel_show_error_dialog (_("The emblem cannot be installed."), _("Sorry, but you must specify a non-blank keyword for the new emblem."), - _("Couldn't Install Emblem"), GTK_WINDOW (parent_window)); + GTK_WINDOW (parent_window)); return FALSE; } else if (!emblem_keyword_valid (keyword)) { eel_show_error_dialog (_("The emblem cannot be installed."), _("Sorry, but emblem keywords can only contain letters, spaces and numbers."), - _("Couldn't Install Emblem"), GTK_WINDOW (parent_window)); + GTK_WINDOW (parent_window)); return FALSE; } else if (is_reserved_keyword (keyword)) { char *error_string; @@ -212,7 +212,7 @@ nautilus_emblem_verify_keyword (GtkWindow *parent_window, */ error_string = g_strdup_printf (_("Sorry, but there is already an emblem named \"%s\"."), display_name); eel_show_error_dialog (_("Please choose a different emblem name."), error_string, - _("Couldn't install emblem"), GTK_WINDOW (parent_window)); + GTK_WINDOW (parent_window)); g_free (error_string); return FALSE; } @@ -255,8 +255,7 @@ nautilus_emblem_install_custom_emblem (GdkPixbuf *pixbuf, /* save the image */ if (eel_gdk_pixbuf_save_to_file (pixbuf, path) != TRUE) { eel_show_error_dialog (_("The emblem cannot be installed."), - _("Sorry, unable to save custom emblem."), - _("Couldn't Install Emblem"), + _("Sorry, unable to save custom emblem."), GTK_WINDOW (parent_window)); g_free (dir); g_free (stat_dir); @@ -274,7 +273,7 @@ nautilus_emblem_install_custom_emblem (GdkPixbuf *pixbuf, if (file == NULL) { eel_show_error_dialog (_("The emblem cannot be installed."), _("Sorry, unable to save custom emblem name."), - _("Couldn't Install Emblem"), GTK_WINDOW (parent_window)); + GTK_WINDOW (parent_window)); g_free (stat_dir); g_free (dir); return; diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 6170cfd78..0d085e248 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -914,7 +914,6 @@ handle_transfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, char *detail; char *formatted_source_name; char *formatted_target_name; - const char *dialog_title; NautilusFileOperationsErrorKind error_kind; NautilusFileOperationsErrorLocation error_location; @@ -1008,40 +1007,18 @@ handle_transfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, progress_info->vfs_status, &text, &detail); - switch (transfer_info->kind) { - case TRANSFER_COPY: - case TRANSFER_DUPLICATE: - dialog_title = _("Error While Copying"); - break; - case TRANSFER_MOVE: - dialog_title = _("Error While Moving"); - break; - case TRANSFER_LINK: - dialog_title = _("Error While Linking"); - break; - case TRANSFER_DELETE: - case TRANSFER_EMPTY_TRASH: - case TRANSFER_MOVE_TO_TRASH: - dialog_title = _("Error While Deleting"); - break; - default: - dialog_title = NULL; - break; - } - if (error_location == ERROR_LOCATION_TARGET || error_kind == ERROR_SOURCE_IN_TARGET) { /* We can't continue, just tell the user. */ eel_run_simple_dialog (parent_for_error_dialog (transfer_info), - TRUE, GTK_MESSAGE_ERROR, text, detail, dialog_title, GTK_STOCK_OK, NULL); + TRUE, GTK_MESSAGE_ERROR, text, detail, GTK_STOCK_OK, NULL); error_dialog_result = GNOME_VFS_XFER_ERROR_ACTION_ABORT; } else if (progress_info->files_total == 1) { error_dialog_button_pressed = eel_run_simple_dialog (parent_for_error_dialog (transfer_info), TRUE, GTK_MESSAGE_ERROR, text, - detail, dialog_title, - GTK_STOCK_CANCEL, _("_Retry"), NULL); + detail, GTK_STOCK_CANCEL, _("_Retry"), NULL); switch (error_dialog_button_pressed) { case 0: @@ -1058,8 +1035,7 @@ handle_transfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, error_dialog_button_pressed = eel_run_simple_dialog (parent_for_error_dialog (transfer_info), TRUE, GTK_MESSAGE_ERROR, text, - detail, dialog_title, - _("_Skip"), GTK_STOCK_CANCEL, _("_Retry"), NULL); + detail, _("_Skip"), GTK_STOCK_CANCEL, _("_Retry"), NULL); switch (error_dialog_button_pressed) { case 0: @@ -2238,7 +2214,7 @@ handle_new_folder_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewF error_string_to_free = (char *)error_string; } - eel_show_error_dialog (_("Error creating new folder."), error_string, _("Error Creating New Folder"), + eel_show_error_dialog (_("Error creating new folder."), error_string, GTK_WINDOW (gtk_widget_get_toplevel (state->parent_view))); g_free (error_string_to_free); @@ -2398,7 +2374,7 @@ handle_new_file_vfs_error (const GnomeVFSXferProgressInfo *progress_info, NewFil error_string_to_free = (char *)error_string; } - eel_show_error_dialog (_("Error creating new document."), error_string, _("Error Creating New Document"), + eel_show_error_dialog (_("Error creating new document."), error_string, GTK_WINDOW (gtk_widget_get_toplevel (state->parent_view))); g_free (error_string_to_free); diff --git a/libnautilus-private/nautilus-file-queue.c b/libnautilus-private/nautilus-file-queue.c index a7ea8fdf2..d5679fd4d 100644 --- a/libnautilus-private/nautilus-file-queue.c +++ b/libnautilus-private/nautilus-file-queue.c @@ -63,7 +63,7 @@ nautilus_file_queue_enqueue (NautilusFileQueue *queue, queue->head = g_list_append (NULL, file); queue->tail = queue->head; } else { - g_list_append (queue->tail, file); + queue->tail = g_list_append (queue->tail, file); queue->tail = queue->tail->next; } diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index 4d3f320c9..aa55dd441 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -637,48 +637,6 @@ nautilus_file_get_parent (NautilusFile *file) return nautilus_directory_get_corresponding_file (file->details->directory); } -struct NautilusUserInfo { - uid_t user_id; - - gboolean has_primary_group; - gid_t primary_group; - - int num_supplementary_groups; - gid_t supplementary_groups[NGROUPS_MAX]; -}; - -/* Returns a pointer to the cached info, does not need freeing */ -static struct NautilusUserInfo * -nautilus_file_get_user_info (void) -{ - static struct timeval cached_time; - static struct NautilusUserInfo info; - static gboolean has_cached_info = FALSE; - struct passwd *password_info; - struct timeval now; - - gettimeofday (&now, NULL); - - if (!has_cached_info || - ((now.tv_sec - cached_time.tv_sec) > GETPWUID_CACHE_TIME)) { - cached_time = now; - has_cached_info = TRUE; - - info.user_id = geteuid (); - - info.has_primary_group = FALSE; - /* No need to free result of getpwuid. */ - password_info = getpwuid (info.user_id); - if (password_info) { - info.has_primary_group = TRUE; - info.primary_group = password_info->pw_gid; - } - info.num_supplementary_groups = getgroups (NGROUPS_MAX, info.supplementary_groups); - } - - return &info; -} - /** * nautilus_file_denies_access_permission: * @@ -687,9 +645,9 @@ nautilus_file_get_user_info (void) * returns FALSE if permissions cannot be determined. * * @file: The file to check. - * @owner_permission: The USER version of the permission (e.g. GNOME_VFS_PERM_USER_READ). - * @group_permission: The GROUP version of the permission (e.g. GNOME_VFS_PERM_GROUP_READ). - * @other_permission: The OTHER version of the permission (e.g. GNOME_VFS_PERM_OTHER_READ). + * @permissions: The permissions to check. Must be either + * GNOME_VFS_PERM_ACCESS_READABLE, GNOME_VFS_PERM_ACCESS_WRITABLE, + * GNOME_VFS_PERM_ACCESS_EXECUTABLE * * Return value: TRUE if the current user definitely does not have * the specified permission. FALSE if the current user does have @@ -697,15 +655,13 @@ nautilus_file_get_user_info (void) */ static gboolean nautilus_file_denies_access_permission (NautilusFile *file, - GnomeVFSFilePermissions owner_permission, - GnomeVFSFilePermissions group_permission, - GnomeVFSFilePermissions other_permission) + GnomeVFSFilePermissions permissions) { - struct NautilusUserInfo *user_info; - int i; - g_assert (NAUTILUS_IS_FILE (file)); - + g_assert (permissions & (GNOME_VFS_PERM_ACCESS_READABLE | + GNOME_VFS_PERM_ACCESS_WRITABLE | + GNOME_VFS_PERM_ACCESS_EXECUTABLE)); + /* Once the file is gone, you are denied permission to do anything. */ if (nautilus_file_is_gone (file)) { return TRUE; @@ -717,45 +673,8 @@ nautilus_file_denies_access_permission (NautilusFile *file, if (!nautilus_file_can_get_permissions (file)) { return FALSE; } - - /* This is called often. Cache the user information for five minutes */ - - user_info = nautilus_file_get_user_info (); - - /* Check the user. */ - /* Root is not forbidden to do anything. */ - if (user_info->user_id == 0) { - return FALSE; - } - - /* File owner's access is governed by the owner bits. */ - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the uid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ - if (user_info->user_id == (uid_t) file->details->info->uid) { - return (file->details->info->permissions & owner_permission) == 0; - } - - - /* Group member's access is governed by the group bits. */ - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the gid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ - if (user_info->has_primary_group - && user_info->primary_group == (gid_t) file->details->info->gid) { - return (file->details->info->permissions & group_permission) == 0; - } - /* Check supplementary groups */ - for (i = 0; i < user_info->num_supplementary_groups; i++) { - if ((gid_t) file->details->info->gid == user_info->supplementary_groups[i]) { - return (file->details->info->permissions & group_permission) == 0; - } - } - /* Other users' access is governed by the other bits. */ - return (file->details->info->permissions & other_permission) == 0; + return (file->details->info->permissions & permissions) != permissions; } /** @@ -776,10 +695,7 @@ nautilus_file_can_read (NautilusFile *file) g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); return !nautilus_file_denies_access_permission - (file, - GNOME_VFS_PERM_USER_READ, - GNOME_VFS_PERM_GROUP_READ, - GNOME_VFS_PERM_OTHER_READ); + (file, GNOME_VFS_PERM_ACCESS_READABLE); } /** @@ -800,10 +716,7 @@ nautilus_file_can_write (NautilusFile *file) g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); return !nautilus_file_denies_access_permission - (file, - GNOME_VFS_PERM_USER_WRITE, - GNOME_VFS_PERM_GROUP_WRITE, - GNOME_VFS_PERM_OTHER_WRITE); + (file, GNOME_VFS_PERM_ACCESS_WRITABLE); } /** @@ -824,10 +737,7 @@ nautilus_file_can_execute (NautilusFile *file) g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); return !nautilus_file_denies_access_permission - (file, - GNOME_VFS_PERM_USER_EXEC, - GNOME_VFS_PERM_GROUP_EXEC, - GNOME_VFS_PERM_OTHER_EXEC); + (file, GNOME_VFS_PERM_ACCESS_EXECUTABLE); } /** @@ -3450,7 +3360,7 @@ nautilus_file_get_size (NautilusFile *file) gboolean nautilus_file_can_get_permissions (NautilusFile *file) { - return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS); + return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_ACCESS); } /** @@ -3565,7 +3475,8 @@ nautilus_file_set_permissions (NautilusFile *file, op->use_slow_mime = file->details->got_slow_mime_type; options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE - | GNOME_VFS_FILE_INFO_FOLLOW_LINKS; + | GNOME_VFS_FILE_INFO_FOLLOW_LINKS + | GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS; if (op->use_slow_mime) { options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE; } @@ -3750,11 +3661,7 @@ gboolean nautilus_file_can_get_owner (NautilusFile *file) { /* Before we have info on a file, the owner is unknown. */ - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the uid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ - return !nautilus_file_info_missing (file, 0 /* FIXME bugzilla.gnome.org 40644: GNOME_VFS_FILE_INFO_FIELDS_UID */); + return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_IDS); } /** @@ -3973,11 +3880,7 @@ gboolean nautilus_file_can_get_group (NautilusFile *file) { /* Before we have info on a file, the group is unknown. */ - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the gid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ - return !nautilus_file_info_missing (file, 0 /* FIXME bugzilla.gnome.org 40644: GNOME_VFS_FILE_INFO_FIELDS_GID */); + return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_IDS); } /** @@ -3997,14 +3900,10 @@ nautilus_file_get_group_name (NautilusFile *file) struct group *group_info; /* Before we have info on a file, the owner is unknown. */ - if (nautilus_file_info_missing (file, 0 /* FIXME bugzilla.gnome.org 40644: GNOME_VFS_FILE_INFO_FIELDS_GID */)) { + if (nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_IDS)) { return NULL; } - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the gid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ /* No need to free result of getgrgid */ group_info = getgrgid ((gid_t) file->details->info->gid); @@ -4304,11 +4203,7 @@ nautilus_file_get_owner_as_string (NautilusFile *file, gboolean include_real_nam char *user_name; /* Before we have info on a file, the owner is unknown. */ - /* FIXME bugzilla.gnome.org 40644: - * Can we trust the uid in the file info? Might - * there be garbage there? What will it do for non-local files? - */ - if (nautilus_file_info_missing (file, 0 /* FIXME bugzilla.gnome.org 40644: GNOME_VFS_FILE_INFO_FIELDS_UID */)) { + if (nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_IDS)) { return NULL; } @@ -5251,10 +5146,8 @@ nautilus_file_is_executable (NautilusFile *file) return FALSE; } - return (file->details->info->permissions - & (GNOME_VFS_PERM_USER_EXEC - | GNOME_VFS_PERM_GROUP_EXEC - | GNOME_VFS_PERM_OTHER_EXEC)) != 0; + return ((file->details->info->permissions + & GNOME_VFS_PERM_ACCESS_EXECUTABLE) != 0); } /** diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 14611e71d..dc2704ed8 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -182,6 +182,7 @@ typedef enum #define NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE "desktop/trash_icon_visible" #define NAUTILUS_PREFERENCES_DESKTOP_TRASH_NAME "desktop/trash_icon_name" #define NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE "desktop/volumes_visible" +#define NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE "desktop/network_visible" void nautilus_global_preferences_init (void); char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void); diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c index 9da89b8f8..37dd0abc7 100644 --- a/libnautilus-private/nautilus-program-choosing.c +++ b/libnautilus-private/nautilus-program-choosing.c @@ -643,7 +643,7 @@ void nautilus_launch_show_file (NautilusFile *file, } if (error_message != NULL) { - eel_show_error_dialog (error_message, detail_message, _("Can't Display Location"), parent_window); + eel_show_error_dialog (error_message, detail_message, parent_window); g_free (error_message); g_free (detail_message); @@ -877,7 +877,6 @@ nautilus_launch_desktop_file (GdkScreen *screen, (_("Sorry, but you can't execute commands from " "a remote site."), _("This is disabled due to security considerations."), - _("Can't Execute Remote Links"), parent_window); return; @@ -891,7 +890,6 @@ nautilus_launch_desktop_file (GdkScreen *screen, eel_show_error_dialog (_("There was an error launching the application."), message, - _("Error Launching Application"), parent_window); g_error_free (error); @@ -922,7 +920,6 @@ nautilus_launch_desktop_file (GdkScreen *screen, (_("This drop target only supports local files."), _("To open non-local files copy them to a local folder and then" " drop them again."), - _("Drop Target Only Supports Local Files"), parent_window); gnome_desktop_item_unref (ditem); @@ -934,7 +931,6 @@ nautilus_launch_desktop_file (GdkScreen *screen, (_("This drop target only supports local files."), _("To open non-local files copy them to a local folder and then" " drop them again. The local files you dropped have already been opened."), - _("Drop Target Only Supports Local Files"), parent_window); } } @@ -962,7 +958,6 @@ nautilus_launch_desktop_file (GdkScreen *screen, eel_show_error_dialog (_("There was an error launching the application."), message, - _("Error Launching Application"), parent_window); g_error_free (error); |