diff options
author | Anders Carlsson <andersca@gnu.org> | 2002-01-21 14:09:10 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@src.gnome.org> | 2002-01-21 14:09:10 +0000 |
commit | 39aacdfa739a052d3515c9702fbdc4a7dc110fe5 (patch) | |
tree | b2fca59647fe0369c3598df34ca7263bde33d1a8 | |
parent | d112f3e1acba1633f4dd98747c7ca9781b7cbcfe (diff) | |
download | nautilus-39aacdfa739a052d3515c9702fbdc4a7dc110fe5.tar.gz |
Change libprofiler location.
2002-01-21 Anders Carlsson <andersca@gnu.org>
* configure.in:
Change libprofiler location.
* libnautilus-private/nautilus-directory-async.c:
(lacks_link_info), (make_dot_directory_uri), (link_info_start):
Remove support for gmc style links.
* libnautilus-private/nautilus-entry.c:
(emacs_shortcuts_preference_changed_callback),
(nautilus_entry_init), (nautilus_entry_finalize),
(nautilus_entry_key_press), (select_all_at_idle),
(nautilus_entry_select_all_at_idle):
Use gtk_idle_add instead and store the idle id in the details
struct. This fixes some weirdness in the file properties dialog,
since the "destroy" signal can be emitted more than once.
* libnautilus-private/nautilus-icon-canvas-item.c:
(update_label_layouts):
Enable underlining.
* libnautilus-private/nautilus-monitor.c: (get_event_uri):
Silently return if we can't find the base path. This is valid when
we've called nautilus_monitor_cancel but still have some events
in the queue.
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory-async.c | 118 | ||||
-rw-r--r-- | libnautilus-private/nautilus-entry.c | 56 | ||||
-rw-r--r-- | libnautilus-private/nautilus-icon-canvas-item.c | 9 | ||||
-rw-r--r-- | libnautilus-private/nautilus-monitor.c | 9 |
6 files changed, 59 insertions, 162 deletions
@@ -1,3 +1,30 @@ +2002-01-21 Anders Carlsson <andersca@gnu.org> + + * configure.in: + Change libprofiler location. + + * libnautilus-private/nautilus-directory-async.c: + (lacks_link_info), (make_dot_directory_uri), (link_info_start): + Remove support for gmc style links. + + * libnautilus-private/nautilus-entry.c: + (emacs_shortcuts_preference_changed_callback), + (nautilus_entry_init), (nautilus_entry_finalize), + (nautilus_entry_key_press), (select_all_at_idle), + (nautilus_entry_select_all_at_idle): + Use gtk_idle_add instead and store the idle id in the details + struct. This fixes some weirdness in the file properties dialog, + since the "destroy" signal can be emitted more than once. + + * libnautilus-private/nautilus-icon-canvas-item.c: + (update_label_layouts): + Enable underlining. + + * libnautilus-private/nautilus-monitor.c: (get_event_uri): + Silently return if we can't find the base path. This is valid when + we've called nautilus_monitor_cancel but still have some events + in the queue. + 2002-01-18 Michael Meeks <michael@ximian.com> * src/nautilus-window-toolbars.c diff --git a/configure.in b/configure.in index 87c592ef3..545c11984 100644 --- a/configure.in +++ b/configure.in @@ -87,7 +87,7 @@ AC_DEFINE(ENABLE_PROFILER)) if test "x$ENABLE_PROFILER" = "x1" then CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES" - LDFLAGS="/gnome/PROFILE/lib/libprofiler.so -lpthread" + LDFLAGS="/gnome/GNOME2/lib/libprofiler.so -lpthread" fi AC_SUBST(ENABLE_PROFILER) diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index da73edc3f..5a9d1f400 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -1634,9 +1634,7 @@ lacks_link_info (NautilusFile *file) { if (file->details->file_info_is_up_to_date && !file->details->link_info_is_up_to_date) { - if ((nautilus_file_is_mime_type (file, "application/x-gmc-link") && - nautilus_file_is_in_desktop (file)) || - nautilus_file_is_nautilus_link (file) || + if (nautilus_file_is_nautilus_link (file) || nautilus_file_is_directory (file)) { return TRUE; } else { @@ -2803,110 +2801,13 @@ link_info_nautilus_link_read_callback (GnomeVFSResult result, } - - -static void -link_info_gmc_link_read_callback (GnomeVFSResult result, - GnomeVFSFileSize bytes_read, - char *file_contents, - gpointer callback_data) -{ - NautilusDirectory *directory; - char *end_of_line, *uri, *name, *path, *icon, *icon_path; - int size, res; - - directory = NAUTILUS_DIRECTORY (callback_data); - - nautilus_directory_ref (directory); - - uri = NULL; - name = NULL; - icon = NULL; - icon_path = NULL; - - /* Handle the case where we read the GMC link. */ - if (result != GNOME_VFS_OK || !eel_str_has_prefix (file_contents, "URL: ")) { - /* FIXME bugzilla.gnome.org 42433: We should report this error to the user. */ - } else { - /* Make sure we don't run off the end of the buffer. */ - end_of_line = memchr (file_contents, '\n', bytes_read); - if (end_of_line == NULL) { - end_of_line = file_contents + bytes_read; - } - uri = file_contents + strlen("URL: "); - uri = g_strndup (uri, end_of_line - uri); - - path = gnome_vfs_get_local_path_from_uri (uri); - - if (path != NULL) { - /* FIXME: this gnome_metata_get call is synchronous, but better to - * have it here where the results will at least be cached than in - * nautilus_file_get_display_name. - */ -#if GNOME2_CONVERSION_COMPLETE - res = gnome_metadata_get (path, "icon-name", &size, &name); - if (res != 0) { - name = NULL; - } -#else - size = 0; - res = -1; -#endif - } else { - res = -1; - } - - if (path != NULL) { - /* FIXME: this gnome_metata_get call is synchronous, but better to - * have it here where the results will at least be cached than in - * nautilus_file_get_display_name. - */ -#if GNOME2_CONVERSION_COMPLETE - res = gnome_metadata_get (path, "icon-filename", &size, &icon_path); -#else - res = -1; -#endif - } else { - res = -1; - } - - if (res == 0 && icon_path != NULL) { - icon = gnome_vfs_get_uri_from_local_path (icon_path); - g_free (icon_path); - } else { - icon = NULL; - } - - g_free (path); - } - - g_free (file_contents); - link_info_read_done (directory, uri, name, icon); - g_free (uri); - g_free (name); - g_free (icon); - - nautilus_directory_unref (directory); -} - -static gboolean -link_info_gmc_link_read_more_callback (GnomeVFSFileSize bytes_read, - const char *file_contents, - gpointer callback_data) -{ - g_assert (NAUTILUS_IS_DIRECTORY (callback_data)); - - /* We need the first 512 bytes to see if something is a gmc link. */ - return bytes_read < 512; -} - static char * make_dot_directory_uri (const char *uri) { char *dot_directory_uri; GnomeVFSURI *vfs_uri; GnomeVFSURI *dot_dir_vfs_uri; - + /* FIXME: what we really need is a uri_append_file_name call * that works on strings, so we can avoid the VFS parsing step. */ @@ -2965,7 +2866,7 @@ link_info_start (NautilusDirectory *directory, NautilusFile *file) { char *uri, *dot_directory_uri = NULL; - gboolean gmc_style_link, nautilus_style_link, is_directory; + gboolean nautilus_style_link, is_directory; if (directory->details->link_info_read_state != NULL) { return; @@ -2978,8 +2879,6 @@ link_info_start (NautilusDirectory *directory, } /* Figure out if it is a link. */ - gmc_style_link = nautilus_file_is_mime_type (file, "application/x-gmc-link") - && nautilus_file_is_in_desktop (file); nautilus_style_link = nautilus_file_is_nautilus_link (file); is_directory = nautilus_file_is_directory (file); @@ -2990,7 +2889,7 @@ link_info_start (NautilusDirectory *directory, } /* If it's not a link we are done. If it is, we need to read it. */ - if (!(gmc_style_link || nautilus_style_link || (is_directory && dot_directory_uri != NULL) )) { + if (!(nautilus_style_link || (is_directory && dot_directory_uri != NULL) )) { link_info_done (directory, file, NULL, NULL, NULL); } else { if (!async_job_start (directory, "link info")) { @@ -3001,14 +2900,7 @@ link_info_start (NautilusDirectory *directory, directory->details->link_info_read_state = g_new0 (LinkInfoReadState, 1); directory->details->link_info_read_state->file = file; - if (gmc_style_link) { - directory->details->link_info_read_state->handle = eel_read_file_async - (uri, - GNOME_VFS_PRIORITY_DEFAULT, - link_info_gmc_link_read_callback, - link_info_gmc_link_read_more_callback, - directory); - } else if (is_directory) { + if (is_directory) { directory->details->link_info_read_state->handle = eel_read_entire_file_async (dot_directory_uri, GNOME_VFS_PRIORITY_DEFAULT, diff --git a/libnautilus-private/nautilus-entry.c b/libnautilus-private/nautilus-entry.c index 24cf67cb2..9d4fad988 100644 --- a/libnautilus-private/nautilus-entry.c +++ b/libnautilus-private/nautilus-entry.c @@ -38,10 +38,11 @@ #include <libgnome/gnome-i18n.h> struct NautilusEntryDetails { - gboolean use_emacs_shortcuts; gboolean user_edit; gboolean special_tab_handling; gboolean cursor_obscured; + + guint select_idle_id; }; enum { @@ -64,9 +65,6 @@ emacs_shortcuts_preference_changed_callback (gpointer callback_data) NautilusEntry *entry; entry = NAUTILUS_ENTRY (callback_data); - - entry->details->use_emacs_shortcuts = - eel_preferences_get_boolean (NAUTILUS_PREFERENCES_USE_EMACS_SHORTCUTS); } static void @@ -83,10 +81,6 @@ nautilus_entry_init (NautilusEntry *entry) gtk_widget_set_events (widget, gtk_widget_get_events (widget) | GDK_POINTER_MOTION_MASK); nautilus_undo_set_up_nautilus_entry_for_undo (entry); - - eel_preferences_add_callback (NAUTILUS_PREFERENCES_USE_EMACS_SHORTCUTS, - emacs_shortcuts_preference_changed_callback, - entry); emacs_shortcuts_preference_changed_callback (entry); } @@ -114,9 +108,9 @@ nautilus_entry_finalize (GObject *object) entry = NAUTILUS_ENTRY (object); - eel_preferences_remove_callback (NAUTILUS_PREFERENCES_USE_EMACS_SHORTCUTS, - emacs_shortcuts_preference_changed_callback, - entry); + if (entry->details->select_idle_id != 0) { + gtk_idle_remove (entry->details->select_idle_id); + } g_free (entry->details); @@ -164,28 +158,10 @@ nautilus_entry_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } break; - - case GDK_KP_Enter: - /* Work around bug in GtkEntry where keypad Enter key - * inserts a character rather than activating like the - * other Enter key. - */ - gtk_widget_activate (widget); - return TRUE; - + default: break; } - - if (!entry->details->use_emacs_shortcuts) { - /* Filter out the emacs-style keyboard shortcuts in - * GtkEntry for alt and control keys. They have - * numerous conflicts with menu keyboard shortcuts. - */ - if (event->state & GDK_CONTROL_MASK || event->state & GDK_MOD1_MASK) { - return FALSE; - } - } obscure_cursor (entry); @@ -264,9 +240,14 @@ nautilus_entry_select_all (NautilusEntry *entry) static gboolean select_all_at_idle (gpointer callback_data) { - nautilus_entry_select_all (NAUTILUS_ENTRY (callback_data)); - g_object_unref (callback_data); + NautilusEntry *entry; + + entry = NAUTILUS_ENTRY (callback_data); + nautilus_entry_select_all (entry); + + entry->details->select_idle_id = 0; + return FALSE; } @@ -283,8 +264,6 @@ select_all_at_idle (gpointer callback_data) void nautilus_entry_select_all_at_idle (NautilusEntry *entry) { - GSource *source; - g_return_if_fail (NAUTILUS_IS_ENTRY (entry)); /* If the text cursor position changes in this routine @@ -292,12 +271,9 @@ nautilus_entry_select_all_at_idle (NautilusEntry *entry) * to move the text cursor position to the end). */ - source = g_idle_source_new (); - g_source_set_callback (source, select_all_at_idle, entry, NULL); - g_signal_connect_swapped (entry, "destroy", - G_CALLBACK (g_source_destroy), source); - g_source_attach (source, NULL); - g_source_unref (source); + if (entry->details->select_idle_id == 0) { + entry->details->select_idle_id = gtk_idle_add (select_all_at_idle, entry); + } } /** diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c index 3aa186107..640f7cced 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.c +++ b/libnautilus-private/nautilus-icon-canvas-item.c @@ -1192,15 +1192,11 @@ nautilus_icon_canvas_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, static void update_label_layouts (NautilusIconCanvasItem *item) { - /* We have to disable this for now due to a bug in pangoft2 that causes a crash - * when rendering an underlined layout. - */ -#ifdef GNOME2_CONVERSION_COMPLETE PangoUnderline underline; - + underline = (item->details->is_prelit && in_single_click_mode ()) ? PANGO_UNDERLINE_SINGLE : PANGO_UNDERLINE_NONE; - + if (item->details->editable_text_layout != NULL) { eel_pango_layout_set_underline (item->details->editable_text_layout, underline); } @@ -1208,7 +1204,6 @@ update_label_layouts (NautilusIconCanvasItem *item) if (item->details->additional_text_layout != NULL) { eel_pango_layout_set_underline (item->details->additional_text_layout, underline); } -#endif } static PangoLayout * diff --git a/libnautilus-private/nautilus-monitor.c b/libnautilus-private/nautilus-monitor.c index 6d679005d..3545a4c13 100644 --- a/libnautilus-private/nautilus-monitor.c +++ b/libnautilus-private/nautilus-monitor.c @@ -110,7 +110,14 @@ get_event_uri (const FAMEvent *event) */ base_path = g_hash_table_lookup (get_request_hash_table (), GINT_TO_POINTER (FAMREQUEST_GETREQNUM (&event->fr))); - g_return_val_if_fail (base_path != NULL, NULL); + + /* base_path can be NULL if we've cancelled the monitor but still have + * some change notifications in our queue. Just return NULL In that case. + */ + if (base_path == NULL) { + return NULL; + } + path = g_concat_dir_and_file (base_path, event->filename); uri = gnome_vfs_get_uri_from_local_path (path); g_free (path); |