summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@gnu.org>2002-01-27 23:31:54 +0000
committerAnders Carlsson <andersca@src.gnome.org>2002-01-27 23:31:54 +0000
commite4f7a87b7ce4a23a9d5d2aba57bbba6257b8d35a (patch)
treec70fbf1969e48824e60a4c57f0d50a007b840bf9 /libnautilus-private
parent555bc849a1d4da12c19046993f38d3642ca964f0 (diff)
downloadnautilus-e4f7a87b7ce4a23a9d5d2aba57bbba6257b8d35a.tar.gz
Remove gmc link support and calls to gnome_set_metadata.
2002-01-28 Anders Carlsson <andersca@gnu.org> * libnautilus-private/nautilus-file.c: * libnautilus-private/nautilus-file.h: Remove gmc link support and calls to gnome_set_metadata. * libnautilus-private/nautilus-file-operations.c (create_transfer_dialog): Set transfer_info as user_data. * libnautilus-private/nautilus-file-operations-progress.c: Move stuff to finalize. * libnautilus-private/nautilus-entry.c: Remove cursor obscuring code since that exists in GtkEntry now.
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-entry.c23
-rw-r--r--libnautilus-private/nautilus-file-operations-progress.c23
-rw-r--r--libnautilus-private/nautilus-file-operations.c2
-rw-r--r--libnautilus-private/nautilus-file.c137
-rw-r--r--libnautilus-private/nautilus-file.h1
5 files changed, 23 insertions, 163 deletions
diff --git a/libnautilus-private/nautilus-entry.c b/libnautilus-private/nautilus-entry.c
index 9d4fad988..fac55b3ed 100644
--- a/libnautilus-private/nautilus-entry.c
+++ b/libnautilus-private/nautilus-entry.c
@@ -40,7 +40,6 @@
struct NautilusEntryDetails {
gboolean user_edit;
gboolean special_tab_handling;
- gboolean cursor_obscured;
guint select_idle_id;
};
@@ -77,9 +76,6 @@ nautilus_entry_init (NautilusEntry *entry)
entry->details->user_edit = TRUE;
- /* Allow pointer motion events so we can expose an obscured cursor if necessary */
- gtk_widget_set_events (widget, gtk_widget_get_events (widget) | GDK_POINTER_MOTION_MASK);
-
nautilus_undo_set_up_nautilus_entry_for_undo (entry);
emacs_shortcuts_preference_changed_callback (entry);
}
@@ -117,17 +113,6 @@ nautilus_entry_finalize (GObject *object)
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
-static void
-obscure_cursor (NautilusEntry *entry)
-{
- if (entry->details->cursor_obscured) {
- return;
- }
-
- entry->details->cursor_obscured = TRUE;
- eel_gdk_window_set_invisible_cursor (GTK_ENTRY (entry)->text_area);
-}
-
static gboolean
nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event)
{
@@ -197,14 +182,6 @@ nautilus_entry_motion_notify (GtkWidget *widget, GdkEventMotion *event)
entry = NAUTILUS_ENTRY (widget);
editable = GTK_EDITABLE (widget);
- /* Reset cursor to I-Beam */
- if (entry->details->cursor_obscured) {
- cursor = gdk_cursor_new (GDK_XTERM);
- gdk_window_set_cursor (GTK_ENTRY (entry)->text_area, cursor);
- gdk_cursor_destroy (cursor);
- entry->details->cursor_obscured = FALSE;
- }
-
old_had = gtk_editable_get_selection_bounds (editable, &old_start, &old_end);
result = EEL_CALL_PARENT_WITH_RETURN_VALUE
diff --git a/libnautilus-private/nautilus-file-operations-progress.c b/libnautilus-private/nautilus-file-operations-progress.c
index ad5286660..e706edb69 100644
--- a/libnautilus-private/nautilus-file-operations-progress.c
+++ b/libnautilus-private/nautilus-file-operations-progress.c
@@ -126,6 +126,19 @@ close_callback (GtkDialog *dialog)
{
}
+/* GObject methods. */
+static void
+nautilus_file_operations_progress_finalize (GObject *object)
+{
+ NautilusFileOperationsProgress *progress;
+
+ progress = NAUTILUS_FILE_OPERATIONS_PROGRESS (object);
+
+ g_free (progress->details);
+
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+}
+
/* GtkObject methods. */
static void
@@ -137,10 +150,9 @@ nautilus_file_operations_progress_destroy (GtkObject *object)
if (progress->details->delayed_close_timeout_id != 0) {
g_source_remove (progress->details->delayed_close_timeout_id);
+ progress->details->delayed_close_timeout_id = 0;
}
-
- g_free (progress->details);
-
+
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
@@ -257,14 +269,19 @@ nautilus_file_operations_progress_init (NautilusFileOperationsProgress *progress
static void
nautilus_file_operations_progress_class_init (NautilusFileOperationsProgressClass *klass)
{
+ GObjectClass *gobject_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkDialogClass *dialog_class;
+ gobject_class = G_OBJECT_CLASS (klass);
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
dialog_class = GTK_DIALOG_CLASS (klass);
+
+ gobject_class->finalize = nautilus_file_operations_progress_finalize;
+
object_class->destroy = nautilus_file_operations_progress_destroy;
/* The progress dialog should not have a title and a close box.
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 3f76e5dd3..15e3965ac 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -376,7 +376,7 @@ create_transfer_dialog (const GnomeVFSXferProgressInfo *progress_info,
g_signal_connect (transfer_info->progress_dialog,
"response",
G_CALLBACK (handle_response_callback),
- NULL);
+ transfer_info);
g_signal_connect (transfer_info->progress_dialog,
"close",
G_CALLBACK (handle_close_callback),
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index d4571245a..3dc1e2b47 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -994,33 +994,11 @@ nautilus_file_rename (NautilusFile *file,
Operation *op;
GnomeVFSFileInfo *partial_file_info;
GnomeVFSURI *vfs_uri;
- char *uri, *path;
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (new_name != NULL);
g_return_if_fail (callback != NULL);
- /* FIXME: Rename GMC URLs on the local file system by setting
- * their metadata only. This leaves no way to rename them for
- * real.
- */
- if (nautilus_file_is_gmc_url (file)) {
- uri = nautilus_file_get_uri (file);
- path = gnome_vfs_get_local_path_from_uri (uri);
- g_free (uri);
-
- if (path != NULL) {
-#ifdef GNOME2_CONVERSION_COMPLETE
- gnome_metadata_set (path, "icon-caption", strlen (new_name) + 1, new_name);
-#endif
- g_free (path);
-
- (* callback) (file, GNOME_VFS_OK, callback_data);
- nautilus_file_changed (file);
- return;
- }
- }
-
/* Make return an error for incoming names containing path separators. */
if (strstr (new_name, "/") != NULL) {
(* callback) (file, GNOME_VFS_ERROR_NOT_PERMITTED, callback_data);
@@ -1939,82 +1917,11 @@ nautilus_file_is_metafile (NautilusFile *file)
(file->details->relative_uri);
}
-static gboolean
-is_special_desktop_gmc_file (NautilusFile *file)
-{
- static char *home_dir;
- static int home_dir_len;
- /* FIXME: Is a fixed-size buffer here OK? */
- char buffer [1024];
- char *uri, *path;
- int s;
-
- if (!nautilus_file_is_local (file)) {
- return FALSE;
- }
-
- if (strcmp (file->details->relative_uri, "Trash.gmc") == 0) {
- return TRUE;
- }
-
- /* FIXME: This does I/O here (the readlink call) which should
- * be done at async. time instead. Doing the I/O here means
- * that we potentially do this readlink over and over again
- * every time this function is called, slowing Nautilus down.
- */
- if (nautilus_file_is_symbolic_link (file)) {
- /* You would think that
- * nautilus_file_get_symbolic_link_target_path would
- * be useful here, but you would be wrong. The
- * information kept around by NautilusFile is not
- * available right now, and I have no clue how to fix
- * this. On top of that, inode/device are not stored,
- * so it is not possible to see if a link is a symlink
- * to the home directory. sigh. -Miguel
- */
- uri = nautilus_file_get_uri (file);
- path = gnome_vfs_get_local_path_from_uri (uri);
- if (path != NULL){
- s = readlink (path, buffer, sizeof (buffer)-1);
- g_free (path);
- } else {
- s = -1;
- }
- g_free (uri);
-
- if (s == -1) {
- return FALSE;
- }
-
- buffer [s] = 0;
-
- if (home_dir == NULL) {
- home_dir = g_strdup (g_get_home_dir ());
- home_dir_len = strlen (home_dir);
-
- if (home_dir != NULL && home_dir [home_dir_len-1] == '/') {
- home_dir [home_dir_len-1] = 0;
- home_dir_len--;
- }
-
- }
- if (home_dir != NULL) {
- if (strcmp (home_dir, buffer) == 0) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
gboolean
nautilus_file_should_show (NautilusFile *file,
gboolean show_hidden,
gboolean show_backup)
{
- if (nautilus_file_is_in_desktop (file) && is_special_desktop_gmc_file (file)) {
- return FALSE;
- }
return (show_hidden || ! nautilus_file_is_hidden_file (file)) &&
(show_backup || ! nautilus_file_is_backup_file (file));
}
@@ -2128,34 +2035,10 @@ nautilus_file_set_metadata (NautilusFile *file,
const char *default_metadata,
const char *metadata)
{
- char *icon_path;
- char *local_path;
- char *local_uri;
-
g_return_if_fail (NAUTILUS_IS_FILE (file));
g_return_if_fail (key != NULL);
g_return_if_fail (key[0] != '\0');
- if (strcmp (key, NAUTILUS_METADATA_KEY_CUSTOM_ICON) == 0) {
- if (nautilus_file_is_in_desktop (file)
- && nautilus_file_is_local (file)) {
-
- local_uri = nautilus_file_get_uri (file);
- local_path = gnome_vfs_get_local_path_from_uri (local_uri);
- icon_path = gnome_vfs_get_local_path_from_uri (metadata);
-
- if (local_path != NULL && icon_path != NULL) {
-#ifdef GNOME2_CONVERSION_COMPLETE
- gnome_metadata_set (local_path, "icon-filename", strlen (icon_path)+1, icon_path);
-#endif
- }
-
- g_free (icon_path);
- g_free (local_path);
- g_free (local_uri);
- }
- }
-
nautilus_directory_set_file_metadata
(file->details->directory,
get_metadata_name (file),
@@ -2370,7 +2253,7 @@ nautilus_file_monitor_remove (NautilusFile *file,
/* Return the uri associated with the passed-in file, which may not be
- * the actual uri if the file is an old-style gmc link or a nautilus
+ * the actual uri if the file is an desktop file or a nautilus
* xml link file.
*/
char *
@@ -2383,7 +2266,7 @@ nautilus_file_get_activation_uri (NautilusFile *file)
}
if (file->details->activation_uri != NULL) {
- return file->details->activation_uri;
+ return g_strdup (file->details->activation_uri);
}
/* If the file is a symbolic link, we return the file the link points at */
@@ -4517,22 +4400,6 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
}
/**
- * nautilus_file_is_gmc_url
- *
- * Check if this file is a gmc url
- * @file: NautilusFile representing the file in question.
- *
- * Returns: True if the file is a gmc url
- *
- **/
-gboolean
-nautilus_file_is_gmc_url (NautilusFile *file)
-{
- return strncmp (file->details->relative_uri, "url", 3) == 0
- && nautilus_file_is_in_desktop (file);
-}
-
-/**
* nautilus_file_is_directory
*
* Check if this file is a directory.
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 20aea0968..822094f2e 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -137,7 +137,6 @@ gboolean nautilus_file_is_symbolic_link (Nautilu
char * nautilus_file_get_symbolic_link_target_path (NautilusFile *file);
gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
-gboolean nautilus_file_is_gmc_url (NautilusFile *file);
gboolean nautilus_file_is_executable (NautilusFile *file);
gboolean nautilus_file_is_directory (NautilusFile *file);
gboolean nautilus_file_is_in_trash (NautilusFile *file);