diff options
author | Darin Adler <darin@src.gnome.org> | 2001-01-04 02:15:56 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-01-04 02:15:56 +0000 |
commit | f683ed7935cfb180946c4fb0b39edc6311ee25a1 (patch) | |
tree | f8867c5d687389a9b5db11295897b0fa76913bba | |
parent | ec540c3e648e4a0b71eebff5e767c3c233de6841 (diff) | |
download | nautilus-f683ed7935cfb180946c4fb0b39edc6311ee25a1.tar.gz |
reviewed by: Pavel Cisler <pavel@eazel.com>
Fix bug 5235 ("Forget History" eliminates history from Go menu,
not History sidebar panel).
* components/history/nautilus-history-view.c:
(install_icons): Fix leak of pixmap and bitmap.
(update_history): Replaced dual lock system with a single one.
(button_press_callback): Only respect button 1, ignore others.
(button_release_callback): Only respect button 1, ignore others,
(history_changed_callback): A new single callback for when the
history list changes to replace the multiple callbacks before.
(nautilus_history_view_initialize_class),
(nautilus_history_view_initialize),
(nautilus_history_view_destroy), (main): Change the history view
to use nautilus_view_standard_main which requires a subclass. This
gets rid of a lot of boilerplate code.
* libnautilus/nautilus-view-component.idl: Make every NautilusView
get an explicit history_changed call instead of requiring them to
guess when to get history. Removed the old get_history_list call
and also renamed the HistoryList sequence to History.
* libnautilus/nautilus-view.h:
* libnautilus/nautilus-view.c:
(impl_Nautilus_View_history_changed),
(nautilus_view_initialize_class): Added the necessary stuff to
cover the new history_changed call.
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c: (nautilus_view_frame_initialize):
Connect handlers so we can send history_changed calls to the
NautilusView when either the history or the icons change.
(nautilus_view_frame_destroy): Change state to EMPTY so the
history signal won't be sent once the frame is destroyed.
(view_frame_activated): Send a history_changed to every
newly-activated view.
(get_CORBA_object): Helper function to make code that makes CORBA
calls simpler.
(check_if_view_is_gone): Use get_CORBA_object.
(attach_client): Gave a nicer name, removed the code that makes
the Nautilus_HistoryFrame interface.
(nautilus_view_frame_load_client): Do the attach_client (formerly
nautilus_view_frame_set_to_component) before calling
view_frame_activated. This is needed since view_frame_activated
now sends a history_changed to the view.
(nautilus_view_frame_load_location),
(nautilus_view_frame_stop_loading),
(nautilus_view_frame_selection_changed),
(nautilus_view_frame_title_changed): Use get_CORBA_object.
(get_history_list): Made this private.
(send_history): Helper function that sends history to the view if
it's in the appropriate state.
* src/Makefile.am:
* src/nautilus-history-frame.c:
* src/nautilus-history-frame.h:
Removed the old NautilusHistoryFrame, which is no longer needed
since we put the history call right in the NautilusView class.
* src/nautilus-window-manage-views.c: (get_history_list_callback):
Updated for Nautilus_HistoryList -> Nautilus_History change.
Fix bug 5391 ("Esc" Canceling of an icon stretch doesn't restore
icon position.).
* libnautilus-extensions/nautilus-icon-private.h:
* libnautilus-extensions/nautilus-icon-container.c:
(clear_drag_state): Add a single bottleneck function to make sure
the context menu timeout always gets canceled.
(continue_stretching): Remove the unused "update_position" parameter.
(undo_stretching): Consolidate the cancel_stretching function and
restore the icon's position as well as its size. Also use the new
bottleneck to clear the drag state.
(button_release_event): Use the new bottleneck to clear the drag
state.
(show_context_menu_callback): Use the new bottleneck to clear the
drag state.
(nautilus_icon_container_set_selection),
(nautilus_icon_container_select_list_unselect_others): Take
advantage of the defaults in g_hash_table_new and use NULL, NULL
instead of g_direct_hash, g_direct_equal.
(nautilus_icon_container_show_stretch_handles): Save the position
as well as the size.
(compute_stretch): Add a FIXME with a bug number.
Fix bug 5407 (Make "Hardware Overview" title translatable).
* components/hardware/nautilus-hardware-view.c:
(nautilus_hardware_view_destroy): Remove unused uri field.
(extract_info): Fix storage leak.
(get_RAM_description): Get rid of code that non-portably relies on
long long. Mark strings for translation.
(get_IDE_description): Get rid of code that non-portably relies on
long long. Mark strings for translation.
(setup_overview_form): Marked string for translation.
(setup_CPU_form), (setup_RAM_form), (setup_IDE_form),
(is_location), (nautilus_hardware_view_load_uri): Disable the
views other than the overview for now since they are not ready to
be seen.
(nautilus_hardware_view_drag_data_received): Get rid of the code
that makes the hardware view accept a URI list drag.
Fix bug 5405 (nautilus --check fails when using LC_ALL=sv_SE due
to missing entry in POTFILES.in).
* po/POTFILES.in: Added nautilus-glib-extensions.c.
Other changes.
* src/nautilus-signaller.h:
* src/nautilus-signaller.c: (nautilus_signaller_initialize_class),
(nautilus_signaller_get_current):
Change the NautilusSignaller class so that the interface calls the
object a GtkObject * and the details of the class are hidden.
* src/nautilus-property-browser.c: (emit_emblems_changed_signal):
* src/nautilus-search-bar-criterion.c:
(nautilus_search_bar_criterion_destroy),
(nautilus_search_bar_criterion_new_from_values):
* src/nautilus-window-menus.c:
(nautilus_window_initialize_go_menu):
* src/nautilus-window.c: (nautilus_send_history_list_changed):
Now that nautilus_signaller_get_current returns a GtkObject,
remove some unnecessary casts.
* components/html/glibwww-callbacks.c: (get_sock_info),
(glibwww_timer_register):
* components/tree/nautilus-tree-model.c:
(nautilus_tree_model_initialize):
* components/tree/nautilus-tree-view.c:
(nautilus_tree_view_initialize):
* libnautilus-extensions/nautilus-directory-async.c:
(async_job_start):
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_notify_files_added),
(nautilus_directory_notify_files_removed),
(nautilus_directory_notify_files_moved):
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_initialize):
* libnautilus-extensions/nautilus-list.c:
(nautilus_list_set_selection):
* libnautilus-extensions/nautilus-merged-directory.c:
(nautilus_merged_directory_initialize):
* libnautilus-extensions/nautilus-trash-directory.c:
(nautilus_trash_directory_initialize):
* src/file-manager/fm-properties-window.c:
(fm_properties_window_present):
Take advantage of the defaults in g_hash_table_new and use NULL,
NULL instead of g_direct_hash, g_direct_equal.
43 files changed, 734 insertions, 746 deletions
@@ -1,3 +1,155 @@ +2001-01-03 Darin Adler <darin@eazel.com> + + reviewed by: Pavel Cisler <pavel@eazel.com> + + Fix bug 5235 ("Forget History" eliminates history from Go menu, + not History sidebar panel). + + * components/history/nautilus-history-view.c: + (install_icons): Fix leak of pixmap and bitmap. + (update_history): Replaced dual lock system with a single one. + (button_press_callback): Only respect button 1, ignore others. + (button_release_callback): Only respect button 1, ignore others, + (history_changed_callback): A new single callback for when the + history list changes to replace the multiple callbacks before. + (nautilus_history_view_initialize_class), + (nautilus_history_view_initialize), + (nautilus_history_view_destroy), (main): Change the history view + to use nautilus_view_standard_main which requires a subclass. This + gets rid of a lot of boilerplate code. + + * libnautilus/nautilus-view-component.idl: Make every NautilusView + get an explicit history_changed call instead of requiring them to + guess when to get history. Removed the old get_history_list call + and also renamed the HistoryList sequence to History. + * libnautilus/nautilus-view.h: + * libnautilus/nautilus-view.c: + (impl_Nautilus_View_history_changed), + (nautilus_view_initialize_class): Added the necessary stuff to + cover the new history_changed call. + + * src/nautilus-view-frame.h: + * src/nautilus-view-frame.c: (nautilus_view_frame_initialize): + Connect handlers so we can send history_changed calls to the + NautilusView when either the history or the icons change. + (nautilus_view_frame_destroy): Change state to EMPTY so the + history signal won't be sent once the frame is destroyed. + (view_frame_activated): Send a history_changed to every + newly-activated view. + (get_CORBA_object): Helper function to make code that makes CORBA + calls simpler. + (check_if_view_is_gone): Use get_CORBA_object. + (attach_client): Gave a nicer name, removed the code that makes + the Nautilus_HistoryFrame interface. + (nautilus_view_frame_load_client): Do the attach_client (formerly + nautilus_view_frame_set_to_component) before calling + view_frame_activated. This is needed since view_frame_activated + now sends a history_changed to the view. + (nautilus_view_frame_load_location), + (nautilus_view_frame_stop_loading), + (nautilus_view_frame_selection_changed), + (nautilus_view_frame_title_changed): Use get_CORBA_object. + (get_history_list): Made this private. + (send_history): Helper function that sends history to the view if + it's in the appropriate state. + + * src/Makefile.am: + * src/nautilus-history-frame.c: + * src/nautilus-history-frame.h: + Removed the old NautilusHistoryFrame, which is no longer needed + since we put the history call right in the NautilusView class. + + * src/nautilus-window-manage-views.c: (get_history_list_callback): + Updated for Nautilus_HistoryList -> Nautilus_History change. + + Fix bug 5391 ("Esc" Canceling of an icon stretch doesn't restore + icon position.). + + * libnautilus-extensions/nautilus-icon-private.h: + * libnautilus-extensions/nautilus-icon-container.c: + (clear_drag_state): Add a single bottleneck function to make sure + the context menu timeout always gets canceled. + (continue_stretching): Remove the unused "update_position" parameter. + (undo_stretching): Consolidate the cancel_stretching function and + restore the icon's position as well as its size. Also use the new + bottleneck to clear the drag state. + (button_release_event): Use the new bottleneck to clear the drag + state. + (show_context_menu_callback): Use the new bottleneck to clear the + drag state. + (nautilus_icon_container_set_selection), + (nautilus_icon_container_select_list_unselect_others): Take + advantage of the defaults in g_hash_table_new and use NULL, NULL + instead of g_direct_hash, g_direct_equal. + (nautilus_icon_container_show_stretch_handles): Save the position + as well as the size. + (compute_stretch): Add a FIXME with a bug number. + + Fix bug 5407 (Make "Hardware Overview" title translatable). + + * components/hardware/nautilus-hardware-view.c: + (nautilus_hardware_view_destroy): Remove unused uri field. + (extract_info): Fix storage leak. + (get_RAM_description): Get rid of code that non-portably relies on + long long. Mark strings for translation. + (get_IDE_description): Get rid of code that non-portably relies on + long long. Mark strings for translation. + (setup_overview_form): Marked string for translation. + (setup_CPU_form), (setup_RAM_form), (setup_IDE_form), + (is_location), (nautilus_hardware_view_load_uri): Disable the + views other than the overview for now since they are not ready to + be seen. + (nautilus_hardware_view_drag_data_received): Get rid of the code + that makes the hardware view accept a URI list drag. + + Fix bug 5405 (nautilus --check fails when using LC_ALL=sv_SE due + to missing entry in POTFILES.in). + + * po/POTFILES.in: Added nautilus-glib-extensions.c. + + Other changes. + + * src/nautilus-signaller.h: + * src/nautilus-signaller.c: (nautilus_signaller_initialize_class), + (nautilus_signaller_get_current): + Change the NautilusSignaller class so that the interface calls the + object a GtkObject * and the details of the class are hidden. + + * src/nautilus-property-browser.c: (emit_emblems_changed_signal): + * src/nautilus-search-bar-criterion.c: + (nautilus_search_bar_criterion_destroy), + (nautilus_search_bar_criterion_new_from_values): + * src/nautilus-window-menus.c: + (nautilus_window_initialize_go_menu): + * src/nautilus-window.c: (nautilus_send_history_list_changed): + Now that nautilus_signaller_get_current returns a GtkObject, + remove some unnecessary casts. + + * components/html/glibwww-callbacks.c: (get_sock_info), + (glibwww_timer_register): + * components/tree/nautilus-tree-model.c: + (nautilus_tree_model_initialize): + * components/tree/nautilus-tree-view.c: + (nautilus_tree_view_initialize): + * libnautilus-extensions/nautilus-directory-async.c: + (async_job_start): + * libnautilus-extensions/nautilus-directory.c: + (nautilus_directory_notify_files_added), + (nautilus_directory_notify_files_removed), + (nautilus_directory_notify_files_moved): + * libnautilus-extensions/nautilus-icon-factory.c: + (nautilus_icon_factory_initialize): + * libnautilus-extensions/nautilus-list.c: + (nautilus_list_set_selection): + * libnautilus-extensions/nautilus-merged-directory.c: + (nautilus_merged_directory_initialize): + * libnautilus-extensions/nautilus-trash-directory.c: + (nautilus_trash_directory_initialize): + * src/file-manager/fm-properties-window.c: + (fm_properties_window_present): + Take advantage of the defaults in g_hash_table_new and use NULL, + NULL instead of g_direct_hash, g_direct_equal. + 2001-01-03 John Sullivan <sullivan@eazel.com> reviewed by: Darin Adler <darin@eazel.com> @@ -91,7 +243,7 @@ 2001-01-03 Ramiro Estrugo <ramiro@eazel.com> - reviewed by: Pavel Cisler<pavel@eazel.com> + reviewed by: Pavel Cisler <pavel@eazel.com> * components/mozilla/nautilus-mozilla-content-view.c: (file_exists), (ensure_profile_dir), (ensure_cache_dir), diff --git a/components/hardware/nautilus-hardware-view.c b/components/hardware/nautilus-hardware-view.c index ecd93911d..a3d71a26c 100644 --- a/components/hardware/nautilus-hardware-view.c +++ b/components/hardware/nautilus-hardware-view.c @@ -33,12 +33,11 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gnome.h> #include <gtk/gtksignal.h> -#include <libgnomevfs/gnome-vfs.h> #include <libgnorba/gnorba.h> #include <libnautilus-extensions/nautilus-background.h> #include <libnautilus-extensions/nautilus-directory-background.h> -#include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-file-utilities.h> +#include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-font-factory.h> #include <libnautilus-extensions/nautilus-glib-extensions.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h> @@ -52,28 +51,21 @@ #include <sys/stat.h> #include <sys/types.h> -/* FIXME: Hardwired font size here. */ +/* FIXME bugzilla.eazel.com 5408: Hardwired font size here. */ #define HARDWARE_FONT_SIZE 14 #define HARDWARE_TITLE_FONT_SIZE 24 struct _NautilusHardwareViewDetails { - char *uri; NautilusView *nautilus_view; - GtkWidget *form; }; - enum { - TARGET_URI_LIST, TARGET_COLOR, - TARGET_GNOME_URI_LIST }; static GtkTargetEntry hardware_dnd_target_table[] = { - { "text/uri-list", 0, TARGET_URI_LIST }, { "application/x-color", 0, TARGET_COLOR }, - { "x-special/gnome-icon-list", 0, TARGET_GNOME_URI_LIST } }; static void nautilus_hardware_view_drag_data_received (GtkWidget *widget, @@ -138,9 +130,10 @@ nautilus_hardware_view_initialize (NautilusHardwareView *hardware_view) static void nautilus_hardware_view_destroy (GtkObject *object) { - NautilusHardwareView *hardware_view = NAUTILUS_HARDWARE_VIEW (object); + NautilusHardwareView *hardware_view; + + hardware_view = NAUTILUS_HARDWARE_VIEW (object); - g_free (hardware_view->details->uri); g_free (hardware_view->details); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); @@ -154,7 +147,7 @@ nautilus_hardware_view_get_nautilus_view (NautilusHardwareView *hardware_view) } static char * -read_proc_info(const gchar* proc_filename) +read_proc_info (const char* proc_filename) { FILE *thisFile; char *result; @@ -179,21 +172,23 @@ read_proc_info(const gchar* proc_filename) /* utility routine to extract information from a string and add it to an XML node */ static char* -extract_info (gchar* data, const gchar *field_name, gint nth) +extract_info (char* data, const char *field_name, int nth) { int index; char **info_array; char *field_data = NULL; /* parse the data into a string array */ - info_array = g_strsplit(data, "\n", 32); + info_array = g_strsplit (data, "\n", 32); /* iterate through the data isolating the field */ for (index = 0; index < 32; index++) { - if (info_array[index] == NULL) + if (info_array[index] == NULL) { break; + } if (nautilus_str_has_prefix(info_array[index], field_name)) { - if(nth>0) nth--; - else { + if (nth > 0) { + nth--; + } else { field_data = info_array[index] + strlen(field_name); field_data = strchr(field_data, ':') + 1; field_data = g_strchug(field_data); @@ -203,10 +198,8 @@ extract_info (gchar* data, const gchar *field_name, gint nth) } /* add the requested node if the field was found */ - if (field_data == NULL) - return NULL; - field_data = g_strdup(field_data); - g_strfreev(info_array); + field_data = g_strdup (field_data); + g_strfreev (info_array); return field_data; } @@ -235,7 +228,7 @@ get_CPU_description (int nth) * "K" for file sizes as of this writing (although we use "MB" * and "GB"). */ - + if (model == NULL || speed == NULL || cache_size == NULL) { result = NULL; } else { @@ -256,11 +249,11 @@ get_CPU_description (int nth) static char * get_RAM_description (void) { - char *temp_str, *num_str, *result; - char* proc_data; - GnomeVFSFileSize ram_size; + char *temp_str, *result; + char *proc_data; + gulong ram_size; - proc_data = read_proc_info("meminfo"); + proc_data = read_proc_info ("meminfo"); temp_str = extract_info (proc_data, "MemTotal", 0); if (temp_str == NULL || strlen (temp_str) < 3) { @@ -272,20 +265,16 @@ get_RAM_description (void) temp_str[strlen(temp_str) - 3] = '\0'; ram_size = (strtoul (temp_str, NULL, 10) + 500) / 1000; - if (ram_size > 1000) { - num_str = g_strdup_printf ("%Lu GB", ram_size / 1000); + if (ram_size >= 1000) { + result = g_strdup_printf (_("%lu GB RAM"), ram_size / 1000); } else { - num_str = g_strdup_printf ("%Lu MB", ram_size); + result = g_strdup_printf (_("%lu MB RAM"), ram_size); } g_free (temp_str); g_free (proc_data); - result = g_strdup_printf (_("%s RAM"), num_str); - - g_free (num_str); - return result; } @@ -293,30 +282,30 @@ static char * get_IDE_description (const char *device) { char *temp_str, *num_str, *result; - GString* string_data = g_string_new(""); + GString *string_data = g_string_new(""); char *proc_file; - GnomeVFSFileSize capacity; + gulong capacity; /* Read model information string */ - proc_file = g_strdup_printf("%s/model", device); - temp_str = read_proc_info(proc_file); - temp_str[strlen(temp_str) - 1] = '\0'; - g_string_append(string_data, temp_str); - g_free(temp_str); - g_free(proc_file); + proc_file = g_strdup_printf ("%s/model", device); + temp_str = read_proc_info (proc_file); + temp_str[strlen (temp_str) - 1] = '\0'; + g_string_append (string_data, temp_str); + g_free (temp_str); + g_free (proc_file); /* Read media type */ - proc_file = g_strdup_printf("%s/media", device); - temp_str = read_proc_info(proc_file); - g_free(proc_file); + proc_file = g_strdup_printf ("%s/media", device); + temp_str = read_proc_info (proc_file); + g_free (proc_file); /* If a hard disk, get the size */ - if(!strcmp(temp_str, "disk\n")) { - g_free(temp_str); + if (strcmp (temp_str, "disk\n") == 0) { + g_free (temp_str); - proc_file = g_strdup_printf("%s/capacity", device); - temp_str = read_proc_info(proc_file); - temp_str[strlen(temp_str) - 1] = '\0'; + proc_file = g_strdup_printf ("%s/capacity", device); + temp_str = read_proc_info (proc_file); + temp_str[strlen (temp_str) - 1] = '\0'; /* NOTE: this should be * capacity = strtoul (...) @@ -325,7 +314,7 @@ get_IDE_description (const char *device) * (512 bytes per sector) * * but with large disks we overflow an unsigned long, which is the - * the type that gnome_vfs uses. + * the type that gnome_vfs uses (Darin: Not true, gnome-vfs uses 64-bit integers). * * ALSO, in keeping with disk manufacturer convention, disk sizes * are quoted in powers of 10 (i.e., MB is 10^6, GB is 10^9). @@ -336,18 +325,18 @@ get_IDE_description (const char *device) */ capacity = (512 * (strtoul (temp_str, NULL, 10) / 1000)) / 1000; - if (capacity > 1000) { - num_str = g_strdup_printf ("%Lu GB", capacity / 1000); + if (capacity >= 1000) { + num_str = g_strdup_printf (_("%lu GB"), capacity / 1000); } else { - num_str = g_strdup_printf ("%Lu MB", capacity); + num_str = g_strdup_printf (_("%lu MB"), capacity); } - g_string_append(string_data, "\n"); - g_string_append(string_data, num_str); - g_free(temp_str); - g_free(proc_file); + g_string_append (string_data, "\n"); + g_string_append (string_data, num_str); + g_free (temp_str); + g_free (proc_file); } else { - g_free(temp_str); + g_free (temp_str); } result = string_data->str; @@ -360,7 +349,9 @@ get_IDE_description (const char *device) /* shared utility to allocate a title for a form */ static void -setup_form_title (NautilusHardwareView *view, const char* image_name, const char* title_text) +setup_form_title (NautilusHardwareView *view, + const char *image_name, + const char *title_text) { GtkWidget *temp_widget; char *file_name; @@ -373,8 +364,8 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char file_name = gnome_pixmap_file (image_name); if (file_name != NULL) { temp_widget = nautilus_image_new_from_file (file_name); - gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8); - gtk_widget_show(temp_widget); + gtk_box_pack_start (GTK_BOX (temp_container), temp_widget, 0, 0, 8); + gtk_widget_show (temp_widget); g_free (file_name); } } @@ -401,7 +392,8 @@ add_element_to_table (GtkWidget *table, GtkWidget *element, int element_index) } /* set up the widgetry for the overview page */ -static void setup_overview_form (NautilusHardwareView *view) +static void +setup_overview_form (NautilusHardwareView *view) { char *file_name, *temp_text; GtkWidget *temp_widget, *pixmap_widget, *temp_box; @@ -417,7 +409,7 @@ static void setup_overview_form (NautilusHardwareView *view) gtk_widget_show(view->details->form); /* set up the title */ - setup_form_title (view, NULL, "Hardware Overview"); + setup_form_title (view, NULL, _("Hardware Overview")); /* allocate a table to hold the elements */ table = gtk_table_new (3, 3, FALSE); @@ -433,8 +425,8 @@ static void setup_overview_form (NautilusHardwareView *view) file_name = nautilus_pixmap_file ("cpu.png"); temp_widget = nautilus_image_new_from_file (file_name); - gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0); - gtk_widget_show(temp_widget); + gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 0); + gtk_widget_show (temp_widget); g_free (file_name); temp_widget = nautilus_label_new (temp_text); @@ -460,8 +452,8 @@ static void setup_overview_form (NautilusHardwareView *view) temp_text = get_RAM_description (); temp_widget = nautilus_label_new (temp_text); nautilus_label_set_font_size (NAUTILUS_LABEL (temp_widget), HARDWARE_FONT_SIZE); - g_free(temp_text); - gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0 ); + g_free (temp_text); + gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 0 ); gtk_widget_show (temp_widget); /* Set up ide devices : by Shane Butler <shane_b@bigfoot.com> */ @@ -512,9 +504,12 @@ static void setup_overview_form (NautilusHardwareView *view) } } +#ifdef ENABLE_SUBVIEWS + /* set up the widgetry for the CPU page */ -static void setup_CPU_form(NautilusHardwareView *view) +static void +setup_CPU_form(NautilusHardwareView *view) { char *message; GtkWidget *temp_widget; @@ -538,7 +533,8 @@ static void setup_CPU_form(NautilusHardwareView *view) /* set up the widgetry for the RAM page */ -static void setup_RAM_form(NautilusHardwareView *view) +static void +setup_RAM_form(NautilusHardwareView *view) { char *message; GtkWidget *temp_widget; @@ -562,7 +558,8 @@ static void setup_RAM_form(NautilusHardwareView *view) /* set up the widgetry for the IDE page */ -static void setup_IDE_form(NautilusHardwareView *view) +static void +setup_IDE_form(NautilusHardwareView *view) { char *message; GtkWidget *temp_widget; @@ -586,43 +583,48 @@ static void setup_IDE_form(NautilusHardwareView *view) /* utility for checking uri */ -static gboolean is_location(char *document_str, const char *place_str) +static gboolean +is_location (const char *document_str, const char *place_str) { - return document_str && !strncmp(document_str + 1, place_str, strlen(place_str)); + return document_str && strncmp(document_str + 1, place_str, strlen (place_str)) == 0; } +#endif /* ENABLE_SUBVIEWS */ + /* load the uri by casing out on the path */ void nautilus_hardware_view_load_uri (NautilusHardwareView *view, const char *uri) { - char *document_name; +#ifdef ENABLE_SUBVIEWS + const char *document_name; +#endif - /* dispose of the old uri and copy the new one */ - g_free (view->details->uri); - view->details->uri = g_strdup (uri); - /* dispose of any old form that was installed */ if (view->details->form != NULL) { - gtk_widget_destroy(view->details->form); + gtk_widget_destroy (view->details->form); view->details->form = NULL; } +#ifndef ENABLE_SUBVIEWS + setup_overview_form (view); +#else /* extract the document part of the uri */ - document_name = strchr(uri, ':'); + document_name = strchr (uri, ':'); /* load the appropriate form, based on the uri and the registration state */ - if (is_location(document_name, "overview")) { - setup_overview_form(view); - } else if (is_location(document_name, "CPU")) { - setup_CPU_form(view); - } else if (is_location(document_name, "RAM")) { - setup_RAM_form(view); - } else if (is_location(document_name, "IDE")) { - setup_IDE_form(view); + if (is_location (document_name, "overview")) { + setup_overview_form (view); + } else if (is_location (document_name, "CPU")) { + setup_CPU_form (view); + } else if (is_location (document_name, "RAM")) { + setup_RAM_form (view); + } else if (is_location (document_name, "IDE")) { + setup_IDE_form (view); } else { - setup_overview_form(view); /* if we don't understand it, go to the overview */ + setup_overview_form (view); /* if we don't understand it, go to the overview */ } +#endif } static void @@ -645,12 +647,6 @@ nautilus_hardware_view_drag_data_received (GtkWidget *widget, GdkDragContext *co g_return_if_fail (NAUTILUS_IS_HARDWARE_VIEW (widget)); switch (info) { - case TARGET_GNOME_URI_LIST: - case TARGET_URI_LIST: - g_message ("dropped data on hardware_view: %s", selection_data->data); - break; - - case TARGET_COLOR: /* Let the background change based on the dropped color. */ nautilus_background_receive_dropped_color (nautilus_get_widget_background (widget), diff --git a/components/history/nautilus-history-view.c b/components/history/nautilus-history-view.c index ef2037abb..258bc1eab 100644 --- a/components/history/nautilus-history-view.c +++ b/components/history/nautilus-history-view.c @@ -28,313 +28,275 @@ #include <bonobo/bonobo-generic-factory.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-ui-util.h> -#include <gnome.h> -#include <libnautilus/libnautilus.h> -#include <libnautilus/nautilus-view-component.h> -#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h> +#include <gtk/gtkclist.h> +#include <gtk/gtkscrolledwindow.h> #include <libnautilus-extensions/nautilus-bookmark.h> -#include <libnautilus-extensions/nautilus-icon-factory.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomevfs/gnome-vfs-init.h> -#include <libgnomevfs/gnome-vfs-uri.h> -#include <liboaf/liboaf.h> +#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h> +#include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus/nautilus-view-component.h> +#include <libnautilus/nautilus-view-standard-main.h> + +#define NAUTILUS_TYPE_HISTORY_VIEW (nautilus_history_view_get_type ()) +#define NAUTILUS_HISTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryView)) +#define NAUTILUS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryViewClass)) +#define NAUTILUS_IS_HISTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_HISTORY_VIEW)) +#define NAUTILUS_IS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_HISTORY_VIEW)) typedef struct { - NautilusView *view; - Nautilus_HistoryFrame history_frame; - GtkCList *clist; + NautilusView parent; + GtkCList *list; + gboolean updating_history; + int press_row; +} NautilusHistoryView; - gint notify_count; - gint press_row; -} HistoryView; +typedef struct { + NautilusViewClass parent; +} NautilusHistoryViewClass; #define HISTORY_VIEW_COLUMN_ICON 0 #define HISTORY_VIEW_COLUMN_NAME 1 #define HISTORY_VIEW_COLUMN_COUNT 2 +static GtkType nautilus_history_view_get_type (void); +static void nautilus_history_view_initialize_class (NautilusHistoryViewClass *klass); +static void nautilus_history_view_initialize (NautilusHistoryView *view); +static void nautilus_history_view_destroy (GtkObject *object); -static void history_load_location (NautilusView *view, - const char *location, - HistoryView *hview); +NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusHistoryView, + nautilus_history_view, + NAUTILUS_TYPE_VIEW) static NautilusBookmark * -get_bookmark_from_row (GtkCList *clist, int row) +get_bookmark_from_row (GtkCList *list, int row) { - g_assert (NAUTILUS_IS_BOOKMARK (gtk_clist_get_row_data (clist, row))); - return NAUTILUS_BOOKMARK (gtk_clist_get_row_data (clist, row)); + return NAUTILUS_BOOKMARK (gtk_clist_get_row_data (list, row)); } static char * -get_uri_from_row (GtkCList *clist, int row) -{ - return nautilus_bookmark_get_uri (get_bookmark_from_row (clist, row)); -} - -static Nautilus_HistoryFrame -history_view_frame_call_begin (NautilusView *view, CORBA_Environment *ev) +get_uri_from_row (GtkCList *list, int row) { - g_return_val_if_fail (NAUTILUS_IS_VIEW (view), CORBA_OBJECT_NIL); - - CORBA_exception_init (ev); - return Bonobo_Unknown_queryInterface - (bonobo_control_get_control_frame (nautilus_view_get_bonobo_control (view)), - "IDL:Nautilus/HistoryFrame:1.0", ev); -} - -static void -history_view_frame_call_end (Nautilus_HistoryFrame frame, CORBA_Environment *ev) -{ - bonobo_object_release_unref (frame, ev); - CORBA_exception_free (ev); + return nautilus_bookmark_get_uri (get_bookmark_from_row (list, row)); } static void -install_icon (GtkCList *clist, gint row, GdkPixbuf *pixbuf) +install_icon (GtkCList *list, gint row, GdkPixbuf *pixbuf) { GdkPixmap *pixmap; GdkBitmap *mask; NautilusBookmark *bookmark; - bookmark = get_bookmark_from_row (clist, row); - if (pixbuf != NULL) { gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, NAUTILUS_STANDARD_ALPHA_THRESHHOLD); } else { + bookmark = get_bookmark_from_row (list, row); if (!nautilus_bookmark_get_pixmap_and_mask (bookmark, NAUTILUS_ICON_SIZE_SMALLER, - &pixmap, &mask)) { + &pixmap, &mask)) { return; } } - gtk_clist_set_pixmap (clist, row, HISTORY_VIEW_COLUMN_ICON, pixmap, mask); -} + gtk_clist_set_pixmap (list, row, HISTORY_VIEW_COLUMN_ICON, pixmap, mask); -static void -history_view_update_icons (GtkObject *ignored, HistoryView *hview) -{ - /* Reload all bookmarks and pixbufs */ - history_load_location (hview->view, NULL, hview); -} - -static Nautilus_HistoryList * -get_history_list (HistoryView *hview) -{ - CORBA_Environment ev; - Nautilus_HistoryFrame view_frame; - Nautilus_HistoryList *list; - - view_frame = history_view_frame_call_begin (hview->view, &ev); - list = Nautilus_HistoryFrame_get_history_list (view_frame, &ev); - history_view_frame_call_end (view_frame, &ev); - - return list; + gdk_pixmap_unref (pixmap); + if (mask != NULL) { + gdk_pixmap_unref (mask); + } } - - static void -history_load_location (NautilusView *view, const char *location, HistoryView *hview) +update_history (NautilusHistoryView *view, + Nautilus_History *history) { char *cols[HISTORY_VIEW_COLUMN_COUNT]; - int new_rownum; - GtkCList *clist; + int new_row; + GtkCList *list; NautilusBookmark *bookmark; - Nautilus_HistoryList *history_list; Nautilus_HistoryItem *item; GdkPixbuf *pixbuf; guint i; - - static int lock = 0; - if (lock != 0) { + /* FIXME: We'll end up with old history if this happens. */ + if (view->updating_history) { return; } - lock = 1; - hview->notify_count++; + view->updating_history = TRUE; - clist = hview->clist; - gtk_clist_freeze (clist); + list = view->list; + gtk_clist_freeze (list); - /* Clear out list */ - gtk_clist_clear (clist); + gtk_clist_clear (list); - /* Populate with data from main history list */ - history_list = get_history_list (hview); - - for (i = 0; i < history_list->_length; i++) { - item = &history_list->_buffer[i]; + for (i = 0; i < history->_length; i++) { + item = &history->_buffer[i]; bookmark = nautilus_bookmark_new (item->location, item->title); cols[HISTORY_VIEW_COLUMN_ICON] = NULL; cols[HISTORY_VIEW_COLUMN_NAME] = item->title; - new_rownum = gtk_clist_append (clist, cols); + new_row = gtk_clist_append (list, cols); - gtk_clist_set_row_data_full (clist, new_rownum, bookmark, + gtk_clist_set_row_data_full (list, new_row, bookmark, (GtkDestroyNotify) gtk_object_unref); pixbuf = bonobo_ui_util_xml_to_pixbuf (item->icon); if (pixbuf != NULL) { - install_icon (clist, new_rownum, pixbuf); + install_icon (list, new_row, pixbuf); gdk_pixbuf_unref (pixbuf); } else { - install_icon (clist, new_rownum, NULL); + install_icon (list, new_row, NULL); } - gtk_clist_columns_autosize (clist); + gtk_clist_columns_autosize (list); - if (gtk_clist_row_is_visible(clist, new_rownum) != GTK_VISIBILITY_FULL) { - gtk_clist_moveto(clist, new_rownum, -1, 0.5, 0.0); + if (gtk_clist_row_is_visible (list, new_row) != GTK_VISIBILITY_FULL) { + gtk_clist_moveto (list, new_row, -1, 0.5, 0.0); } } - CORBA_free (history_list); - gtk_clist_select_row (clist, 0, 0); + gtk_clist_select_row (list, 0, 0); - gtk_clist_thaw (clist); + gtk_clist_thaw (list); - hview->notify_count--; - - lock = 0; + view->updating_history = FALSE; } static void -history_title_changed (NautilusView *view, - const char *title, - HistoryView *hview) +button_press_callback (GtkCList *list, + GdkEventButton *event, + NautilusHistoryView *view) { - history_load_location (view, NULL, hview); -} + int row, column; + if (event->button != 1) { + return; + } -static void -history_button_press (GtkCList *clist, GdkEventButton *event, HistoryView *hview) -{ - int row, column; - - /* Get row and column */ - gtk_clist_get_selection_info (clist, event->x, event->y, &row, &column); + gtk_clist_get_selection_info (list, event->x, event->y, &row, &column); - hview->press_row = row; + view->press_row = row; } static void -history_button_release (GtkCList *clist, GdkEventButton *event, HistoryView *hview) +button_release_callback (GtkCList *list, + GdkEventButton *event, + NautilusHistoryView *view) { char *uri; int row, column; - if(hview->notify_count > 0) { + /* FIXME: Is it really a good idea to just ignore button presses when we are updating? */ + if (view->updating_history) { return; } - /* Get row and column */ - gtk_clist_get_selection_info (clist, event->x, event->y, &row, &column); - - /* Do nothing if row is zero. A click either in the top list item - * or in the history content view is ignored. + if (event->button != 1) { + return; + } + + gtk_clist_get_selection_info (list, event->x, event->y, &row, &column); + + /* Do nothing if row is zero. A click either in the top list + * item or in the history content view is ignored. */ if (row <= 0) { return; } - /* Return if the row does not match the rwo we stashed on the mouse down. */ - if (row != hview->press_row) { + /* Do nothing if the row does not match the row we stashed on + * the mouse down. This means that dragging will not cause + * navigation. + */ + if (row != view->press_row) { return; } - /* Navigate to uri */ - uri = get_uri_from_row (clist, row); - nautilus_view_open_location_in_this_window (hview->view, uri); + /* Navigate to the clicked location. */ + uri = get_uri_from_row (list, row); + nautilus_view_open_location_in_this_window + (NAUTILUS_VIEW (view), uri); g_free (uri); } -static int object_count = 0; - static void -do_destroy(GtkObject *obj, HistoryView *hview) +history_changed_callback (NautilusHistoryView *view, + Nautilus_History *list, + gpointer callback_data) { - object_count--; - if(object_count <= 0) { - gtk_main_quit(); - } - - gtk_signal_disconnect_by_data (nautilus_icon_factory_get (), hview); + g_assert (view == callback_data); + update_history (view, list); } - -static BonoboObject * -make_obj (BonoboGenericFactory *Factory, const char *goad_id, gpointer closure) +static void +nautilus_history_view_initialize_class (NautilusHistoryViewClass *klass) { - GtkWidget *wtmp; - GtkCList *clist; - HistoryView *hview; - - g_return_val_if_fail(!strcmp(goad_id, "OAFIID:nautilus_history_view:a7a85bdd-2ecf-4bc1-be7c-ed328a29aacb"), NULL); - - hview = g_new0(HistoryView, 1); + GtkObjectClass *object_class; + + object_class = GTK_OBJECT_CLASS (klass); + + object_class->destroy = nautilus_history_view_destroy; +} - /* create interface */ - clist = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT)); - gtk_clist_column_titles_hide (clist); - gtk_clist_set_row_height (clist, NAUTILUS_ICON_SIZE_SMALLER); - gtk_clist_set_selection_mode (clist, GTK_SELECTION_BROWSE); - gtk_clist_columns_autosize (clist); +static void +nautilus_history_view_initialize (NautilusHistoryView *view) +{ + GtkCList *list; + GtkWidget *window; + + list = GTK_CLIST (gtk_clist_new (HISTORY_VIEW_COLUMN_COUNT)); + gtk_clist_column_titles_hide (list); + gtk_clist_set_row_height (list, NAUTILUS_ICON_SIZE_SMALLER); + gtk_clist_set_selection_mode (list, GTK_SELECTION_BROWSE); + gtk_clist_columns_autosize (list); + gtk_widget_show (GTK_WIDGET (list)); - wtmp = gtk_scrolled_window_new (gtk_clist_get_hadjustment (clist), - gtk_clist_get_vadjustment (clist)); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp), + window = gtk_scrolled_window_new (gtk_clist_get_hadjustment (list), + gtk_clist_get_vadjustment (list)); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (wtmp), GTK_WIDGET (clist)); - - gtk_widget_show_all (wtmp); - - /* create object */ - hview->view = nautilus_view_new (wtmp); - gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview); - object_count++; - - hview->clist = (GtkCList *)clist; - - /* handle events */ - gtk_signal_connect (GTK_OBJECT(hview->view), "load_location", - history_load_location, hview); - gtk_signal_connect (GTK_OBJECT(hview->view), "title_changed", - history_title_changed, hview); + gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (list)); + gtk_widget_show (window); + + nautilus_view_construct (NAUTILUS_VIEW (view), window); + + view->list = list; + + gtk_signal_connect (GTK_OBJECT (list), + "button-press-event", + button_press_callback, + view); + gtk_signal_connect (GTK_OBJECT (list), + "button-release-event", + button_release_callback, + view); + + gtk_signal_connect (GTK_OBJECT (view), + "history_changed", + history_changed_callback, + view); +} - gtk_signal_connect (GTK_OBJECT (clist), "button-press-event", history_button_press, hview); - gtk_signal_connect (GTK_OBJECT (clist), "button-release-event", history_button_release, hview); - gtk_signal_connect (nautilus_icon_factory_get (), "icons_changed", history_view_update_icons, hview); +static void +nautilus_history_view_destroy (GtkObject *object) +{ + NautilusHistoryView *view; + + view = NAUTILUS_HISTORY_VIEW (object); - return BONOBO_OBJECT (hview->view); + gtk_clist_clear (view->list); + + NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } int main (int argc, char *argv[]) { - BonoboGenericFactory *factory; - CORBA_ORB orb; - char *registration_id; - - gnome_init_with_popt_table ("nautilus-history-view", VERSION, - argc, argv, - oaf_popt_options, 0, NULL); - orb = oaf_init (argc, argv); - bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); - gnome_vfs_init (); - - registration_id = oaf_make_registration_id ("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", g_getenv ("DISPLAY")); - - factory = bonobo_generic_factory_new_multi (registration_id, make_obj, NULL); - - g_free (registration_id); - - do { - bonobo_main(); - } while(object_count > 0); - - return 0; + return nautilus_view_standard_main ("nautilus_history-view", VERSION, + argc, argv, + "OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", + "OAFIID:nautilus_history_view:a7a85bdd-2ecf-4bc1-be7c-ed328a29aacb", + nautilus_view_create_from_get_type_function, + nautilus_history_view_get_type); } diff --git a/components/html/glibwww-callbacks.c b/components/html/glibwww-callbacks.c index 21ff83d7c..6ff1751b5 100644 --- a/components/html/glibwww-callbacks.c +++ b/components/html/glibwww-callbacks.c @@ -40,7 +40,7 @@ get_sock_info(SOCKET s, gboolean create) SockInfo *info; if (!sockhash) - sockhash = g_hash_table_new(g_direct_hash, g_direct_equal); + sockhash = g_hash_table_new(NULL, NULL); info = g_hash_table_lookup(sockhash, GINT_TO_POINTER(s)); if (!info && create) { @@ -179,7 +179,7 @@ glibwww_timer_register(HTTimer *timer) guint tag; if (!timers) - timers = g_hash_table_new(g_direct_hash, g_direct_equal); + timers = g_hash_table_new(NULL, NULL); tag = g_timeout_add(HTTimer_expiresRelative(timer), glibwww_dispatch_timer, timer); diff --git a/components/tree/nautilus-tree-model.c b/components/tree/nautilus-tree-model.c index 8aae95b21..77ce2593d 100644 --- a/components/tree/nautilus-tree-model.c +++ b/components/tree/nautilus-tree-model.c @@ -148,8 +148,7 @@ nautilus_tree_model_initialize (gpointer object, gpointer klass) model->details = g_new0 (NautilusTreeModelDetails, 1); - model->details->file_to_node_map = g_hash_table_new (g_direct_hash, - g_direct_equal); + model->details->file_to_node_map = g_hash_table_new (NULL, NULL); } static void diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c index d13bf008b..aa8920ca4 100644 --- a/components/tree/nautilus-tree-view.c +++ b/components/tree/nautilus-tree-view.c @@ -714,7 +714,7 @@ nautilus_tree_view_initialize (NautilusTreeView *view) GTK_SIGNAL_FUNC (tree_load_location_callback), view); - view->details->file_to_node_map = g_hash_table_new (g_direct_hash, g_direct_equal); + view->details->file_to_node_map = g_hash_table_new (NULL, NULL); nautilus_tree_view_load_from_filesystem (view); diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c index 4844160cb..550716ae8 100644 --- a/libnautilus-extensions/nautilus-directory-async.c +++ b/libnautilus-extensions/nautilus-directory-async.c @@ -205,7 +205,7 @@ async_job_start (NautilusDirectory *directory, if (async_job_count >= MAX_ASYNC_JOBS) { if (waiting_directories == NULL) { waiting_directories = nautilus_g_hash_table_new_free_at_exit - (g_direct_hash, g_direct_equal, + (NULL, NULL, "nautilus-directory-async.c: waiting_directories"); } diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c index 9ebbf12b8..26db4fb71 100644 --- a/libnautilus-extensions/nautilus-directory.c +++ b/libnautilus-extensions/nautilus-directory.c @@ -858,10 +858,10 @@ nautilus_directory_notify_files_added (GList *uris) GnomeVFSURI *vfs_uri; /* Make a list of added files in each directory. */ - added_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + added_lists = g_hash_table_new (NULL, NULL); /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); for (p = uris; p != NULL; p = p->next) { uri = (const char *) p->data; @@ -914,10 +914,10 @@ nautilus_directory_notify_files_removed (GList *uris) NautilusFile *file; /* Make a list of changed files in each directory. */ - changed_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + changed_lists = g_hash_table_new (NULL, NULL); /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); /* Go through all the notifications. */ for (p = uris; p != NULL; p = p->next) { @@ -1133,12 +1133,12 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) /* Make a list of added and changed files in each directory. */ new_files_list = NULL; - added_lists = g_hash_table_new (g_direct_hash, g_direct_equal); - changed_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + added_lists = g_hash_table_new (NULL, NULL); + changed_lists = g_hash_table_new (NULL, NULL); unref_list = NULL; /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); for (p = uri_pairs; p != NULL; p = p->next) { pair = p->data; diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c index c14dd664c..e593ecf86 100644 --- a/libnautilus-extensions/nautilus-icon-container.c +++ b/libnautilus-extensions/nautilus-icon-container.c @@ -2449,6 +2449,17 @@ nautilus_icon_container_did_not_drag (NautilusIconContainer *container, } } +static void +clear_drag_state (NautilusIconContainer *container) +{ + container->details->drag_icon = NULL; + container->details->drag_state = DRAG_STATE_INITIAL; + if (container->details->context_menu_timeout_id != 0) { + gtk_timeout_remove (container->details->context_menu_timeout_id); + container->details->context_menu_timeout_id = 0; + } +} + static gboolean start_stretching (NautilusIconContainer *container) { @@ -2492,8 +2503,7 @@ start_stretching (NautilusIconContainer *container) static void continue_stretching (NautilusIconContainer *container, - int window_x, int window_y, - gboolean update_position) + int window_x, int window_y) { NautilusIconContainerDetails *details; NautilusIcon *icon; @@ -2522,7 +2532,7 @@ continue_stretching (NautilusIconContainer *container, &world_x, &world_y); icon_set_position (icon, world_x, world_y); - icon_set_size (container, icon, stretch_state.icon_size, update_position); + icon_set_size (container, icon, stretch_state.icon_size, FALSE); } static void @@ -2539,7 +2549,7 @@ end_stretching (NautilusIconContainer *container, NautilusIconPosition position; NautilusIcon *icon; - continue_stretching (container, window_x, window_y, FALSE); + continue_stretching (container, window_x, window_y); ungrab_stretch_icon (container); /* now that we're done stretching, update the icon's position */ @@ -2552,22 +2562,11 @@ end_stretching (NautilusIconContainer *container, signals[ICON_POSITION_CHANGED], icon->data, &position); - /* We must do a redo_layout after indicating we are done stretching. */ - container->details->drag_icon = NULL; - container->details->drag_state = DRAG_STATE_INITIAL; + clear_drag_state (container); redo_layout (container); } static void -cancel_stretching (NautilusIconContainer *container) -{ - ungrab_stretch_icon (container); - - container->details->drag_icon = NULL; - container->details->drag_state = DRAG_STATE_INITIAL; -} - -static void undo_stretching (NautilusIconContainer *container) { if (container->details->stretch_icon == NULL) { @@ -2575,13 +2574,19 @@ undo_stretching (NautilusIconContainer *container) } if (container->details->drag_state == DRAG_STATE_STRETCH) { - cancel_stretching (container); + ungrab_stretch_icon (container); + clear_drag_state (container); } nautilus_icon_canvas_item_set_show_stretch_handles (container->details->stretch_icon->item, FALSE); - icon_set_size (container, container->details->stretch_icon, - container->details->initial_stretch_size, FALSE); + icon_set_position (container->details->stretch_icon, + container->details->stretch_initial_x, + container->details->stretch_initial_y); + icon_set_size (container, + container->details->stretch_icon, + container->details->stretch_initial_size, + FALSE); container->details->stretch_icon = NULL; redo_layout (container); @@ -2611,8 +2616,7 @@ button_release_event (GtkWidget *widget, /* Right click, drag did not start, * show context menu. */ - details->drag_state = DRAG_STATE_INITIAL; - gtk_timeout_remove (details->context_menu_timeout_id); + clear_drag_state (container); gtk_signal_emit (GTK_OBJECT (container), signals[CONTEXT_CLICK_SELECTION], event); @@ -2634,11 +2638,7 @@ button_release_event (GtkWidget *widget, break; } - details->drag_icon = NULL; - if (details->drag_state == DRAG_STATE_MOVE_COPY_OR_MENU) { - gtk_timeout_remove (details->context_menu_timeout_id); - } - details->drag_state = DRAG_STATE_INITIAL; + clear_drag_state (container); return TRUE; } @@ -2700,7 +2700,7 @@ motion_notify_event (GtkWidget *widget, } break; case DRAG_STATE_STRETCH: - continue_stretching (container, event->x, event->y, FALSE); + continue_stretching (container, event->x, event->y); break; default: break; @@ -3236,8 +3236,7 @@ show_context_menu_callback (void *cast_to_parameters) g_assert (NAUTILUS_IS_ICON_CONTAINER (parameters->container)); if (parameters->container->details->drag_state == DRAG_STATE_MOVE_COPY_OR_MENU) { - parameters->container->details->drag_state = DRAG_STATE_INITIAL; - gtk_timeout_remove (parameters->container->details->context_menu_timeout_id); + clear_drag_state (parameters->container); /* Context menu applies to all selected items. The only * odd case is if this click deselected the icon under @@ -4087,7 +4086,7 @@ nautilus_icon_container_set_selection (NautilusIconContainer *container, selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } @@ -4126,7 +4125,7 @@ nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *cont selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } @@ -4268,11 +4267,15 @@ nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container) ungrab_stretch_icon (container); } nautilus_icon_canvas_item_set_show_stretch_handles (icon->item, TRUE); + details->stretch_icon = icon; icon_get_size (container, icon, &initial_size_x, &initial_size_y); + /* only need to keep size in one dimension, since they are constrained to be the same */ - container->details->initial_stretch_size = initial_size_x; + container->details->stretch_initial_x = icon->x; + container->details->stretch_initial_y = icon->y; + container->details->stretch_initial_size = initial_size_x; } /** @@ -4345,6 +4348,9 @@ compute_stretch (StretchState *start, gboolean right, bottom; int x_stretch, y_stretch; + /* FIXME bugzilla.eazel.com 5390: This doesn't correspond to + * the way the handles are drawn. + */ /* Figure out which handle we are dragging. */ right = start->pointer_x > start->icon_x + (int) start->icon_size / 2; bottom = start->pointer_y > start->icon_y + (int) start->icon_size / 2; @@ -4358,8 +4364,8 @@ compute_stretch (StretchState *start, if (bottom) { y_stretch = - y_stretch; } - current->icon_size = MAX ((int)start->icon_size + MIN (x_stretch, y_stretch), - (int)NAUTILUS_ICON_SIZE_SMALLEST); + current->icon_size = MAX ((int) start->icon_size + MIN (x_stretch, y_stretch), + (int) NAUTILUS_ICON_SIZE_SMALLEST); /* Figure out where the corner of the icon should be. */ current->icon_x = start->icon_x; diff --git a/libnautilus-extensions/nautilus-icon-factory.c b/libnautilus-extensions/nautilus-icon-factory.c index c889025e5..36dc2b55c 100644 --- a/libnautilus-extensions/nautilus-icon-factory.c +++ b/libnautilus-extensions/nautilus-icon-factory.c @@ -367,8 +367,7 @@ nautilus_icon_factory_initialize (NautilusIconFactory *factory) { factory->scalable_icons = g_hash_table_new (nautilus_scalable_icon_hash, nautilus_scalable_icon_equal); - factory->cache_icons = g_hash_table_new (g_direct_hash, - g_direct_equal); + factory->cache_icons = g_hash_table_new (NULL, NULL); factory->icon_cache = g_hash_table_new (cache_key_hash, cache_key_equal); diff --git a/libnautilus-extensions/nautilus-icon-private.h b/libnautilus-extensions/nautilus-icon-private.h index b590a78bb..cc51a6ea9 100644 --- a/libnautilus-extensions/nautilus-icon-private.h +++ b/libnautilus-extensions/nautilus-icon-private.h @@ -108,7 +108,8 @@ struct NautilusIconContainerDetails { /* Current icon with stretch handles, so we have only one. */ NautilusIcon *stretch_icon; - int initial_stretch_size; + double stretch_initial_x, stretch_initial_y; + guint stretch_initial_size; /* Last highlighted drop target. */ NautilusIcon *drop_target; diff --git a/libnautilus-extensions/nautilus-list.c b/libnautilus-extensions/nautilus-list.c index d652afb68..fc498aa02 100644 --- a/libnautilus-extensions/nautilus-list.c +++ b/libnautilus-extensions/nautilus-list.c @@ -3323,7 +3323,7 @@ nautilus_list_set_selection (NautilusList *list, GList *selection) selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } diff --git a/libnautilus-extensions/nautilus-merged-directory.c b/libnautilus-extensions/nautilus-merged-directory.c index e0a50f1eb..e54860522 100644 --- a/libnautilus-extensions/nautilus-merged-directory.c +++ b/libnautilus-extensions/nautilus-merged-directory.c @@ -80,8 +80,7 @@ nautilus_merged_directory_initialize (gpointer object, gpointer klass) merged->details = g_new0 (NautilusMergedDirectoryDetails, 1); merged->details->callbacks = g_hash_table_new (merged_callback_hash, merged_callback_equal); - merged->details->monitors = g_hash_table_new - (g_direct_hash, g_direct_equal); + merged->details->monitors = g_hash_table_new (NULL, NULL); } static void diff --git a/libnautilus-extensions/nautilus-trash-directory.c b/libnautilus-extensions/nautilus-trash-directory.c index 0e7210881..a4c03452b 100644 --- a/libnautilus-extensions/nautilus-trash-directory.c +++ b/libnautilus-extensions/nautilus-trash-directory.c @@ -205,8 +205,7 @@ nautilus_trash_directory_initialize (gpointer object, gpointer klass) trash = NAUTILUS_TRASH_DIRECTORY (object); trash->details = g_new0 (NautilusTrashDirectoryDetails, 1); - trash->details->volumes = g_hash_table_new - (g_direct_hash, g_direct_equal); + trash->details->volumes = g_hash_table_new (NULL, NULL); volume_monitor = nautilus_volume_monitor_get (); diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c index 4844160cb..550716ae8 100644 --- a/libnautilus-private/nautilus-directory-async.c +++ b/libnautilus-private/nautilus-directory-async.c @@ -205,7 +205,7 @@ async_job_start (NautilusDirectory *directory, if (async_job_count >= MAX_ASYNC_JOBS) { if (waiting_directories == NULL) { waiting_directories = nautilus_g_hash_table_new_free_at_exit - (g_direct_hash, g_direct_equal, + (NULL, NULL, "nautilus-directory-async.c: waiting_directories"); } diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c index 9ebbf12b8..26db4fb71 100644 --- a/libnautilus-private/nautilus-directory.c +++ b/libnautilus-private/nautilus-directory.c @@ -858,10 +858,10 @@ nautilus_directory_notify_files_added (GList *uris) GnomeVFSURI *vfs_uri; /* Make a list of added files in each directory. */ - added_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + added_lists = g_hash_table_new (NULL, NULL); /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); for (p = uris; p != NULL; p = p->next) { uri = (const char *) p->data; @@ -914,10 +914,10 @@ nautilus_directory_notify_files_removed (GList *uris) NautilusFile *file; /* Make a list of changed files in each directory. */ - changed_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + changed_lists = g_hash_table_new (NULL, NULL); /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); /* Go through all the notifications. */ for (p = uris; p != NULL; p = p->next) { @@ -1133,12 +1133,12 @@ nautilus_directory_notify_files_moved (GList *uri_pairs) /* Make a list of added and changed files in each directory. */ new_files_list = NULL; - added_lists = g_hash_table_new (g_direct_hash, g_direct_equal); - changed_lists = g_hash_table_new (g_direct_hash, g_direct_equal); + added_lists = g_hash_table_new (NULL, NULL); + changed_lists = g_hash_table_new (NULL, NULL); unref_list = NULL; /* Make a list of parent directories that will need their counts updated. */ - parent_directories = g_hash_table_new (g_direct_hash, g_direct_equal); + parent_directories = g_hash_table_new (NULL, NULL); for (p = uri_pairs; p != NULL; p = p->next) { pair = p->data; diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c index c14dd664c..e593ecf86 100644 --- a/libnautilus-private/nautilus-icon-container.c +++ b/libnautilus-private/nautilus-icon-container.c @@ -2449,6 +2449,17 @@ nautilus_icon_container_did_not_drag (NautilusIconContainer *container, } } +static void +clear_drag_state (NautilusIconContainer *container) +{ + container->details->drag_icon = NULL; + container->details->drag_state = DRAG_STATE_INITIAL; + if (container->details->context_menu_timeout_id != 0) { + gtk_timeout_remove (container->details->context_menu_timeout_id); + container->details->context_menu_timeout_id = 0; + } +} + static gboolean start_stretching (NautilusIconContainer *container) { @@ -2492,8 +2503,7 @@ start_stretching (NautilusIconContainer *container) static void continue_stretching (NautilusIconContainer *container, - int window_x, int window_y, - gboolean update_position) + int window_x, int window_y) { NautilusIconContainerDetails *details; NautilusIcon *icon; @@ -2522,7 +2532,7 @@ continue_stretching (NautilusIconContainer *container, &world_x, &world_y); icon_set_position (icon, world_x, world_y); - icon_set_size (container, icon, stretch_state.icon_size, update_position); + icon_set_size (container, icon, stretch_state.icon_size, FALSE); } static void @@ -2539,7 +2549,7 @@ end_stretching (NautilusIconContainer *container, NautilusIconPosition position; NautilusIcon *icon; - continue_stretching (container, window_x, window_y, FALSE); + continue_stretching (container, window_x, window_y); ungrab_stretch_icon (container); /* now that we're done stretching, update the icon's position */ @@ -2552,22 +2562,11 @@ end_stretching (NautilusIconContainer *container, signals[ICON_POSITION_CHANGED], icon->data, &position); - /* We must do a redo_layout after indicating we are done stretching. */ - container->details->drag_icon = NULL; - container->details->drag_state = DRAG_STATE_INITIAL; + clear_drag_state (container); redo_layout (container); } static void -cancel_stretching (NautilusIconContainer *container) -{ - ungrab_stretch_icon (container); - - container->details->drag_icon = NULL; - container->details->drag_state = DRAG_STATE_INITIAL; -} - -static void undo_stretching (NautilusIconContainer *container) { if (container->details->stretch_icon == NULL) { @@ -2575,13 +2574,19 @@ undo_stretching (NautilusIconContainer *container) } if (container->details->drag_state == DRAG_STATE_STRETCH) { - cancel_stretching (container); + ungrab_stretch_icon (container); + clear_drag_state (container); } nautilus_icon_canvas_item_set_show_stretch_handles (container->details->stretch_icon->item, FALSE); - icon_set_size (container, container->details->stretch_icon, - container->details->initial_stretch_size, FALSE); + icon_set_position (container->details->stretch_icon, + container->details->stretch_initial_x, + container->details->stretch_initial_y); + icon_set_size (container, + container->details->stretch_icon, + container->details->stretch_initial_size, + FALSE); container->details->stretch_icon = NULL; redo_layout (container); @@ -2611,8 +2616,7 @@ button_release_event (GtkWidget *widget, /* Right click, drag did not start, * show context menu. */ - details->drag_state = DRAG_STATE_INITIAL; - gtk_timeout_remove (details->context_menu_timeout_id); + clear_drag_state (container); gtk_signal_emit (GTK_OBJECT (container), signals[CONTEXT_CLICK_SELECTION], event); @@ -2634,11 +2638,7 @@ button_release_event (GtkWidget *widget, break; } - details->drag_icon = NULL; - if (details->drag_state == DRAG_STATE_MOVE_COPY_OR_MENU) { - gtk_timeout_remove (details->context_menu_timeout_id); - } - details->drag_state = DRAG_STATE_INITIAL; + clear_drag_state (container); return TRUE; } @@ -2700,7 +2700,7 @@ motion_notify_event (GtkWidget *widget, } break; case DRAG_STATE_STRETCH: - continue_stretching (container, event->x, event->y, FALSE); + continue_stretching (container, event->x, event->y); break; default: break; @@ -3236,8 +3236,7 @@ show_context_menu_callback (void *cast_to_parameters) g_assert (NAUTILUS_IS_ICON_CONTAINER (parameters->container)); if (parameters->container->details->drag_state == DRAG_STATE_MOVE_COPY_OR_MENU) { - parameters->container->details->drag_state = DRAG_STATE_INITIAL; - gtk_timeout_remove (parameters->container->details->context_menu_timeout_id); + clear_drag_state (parameters->container); /* Context menu applies to all selected items. The only * odd case is if this click deselected the icon under @@ -4087,7 +4086,7 @@ nautilus_icon_container_set_selection (NautilusIconContainer *container, selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } @@ -4126,7 +4125,7 @@ nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *cont selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } @@ -4268,11 +4267,15 @@ nautilus_icon_container_show_stretch_handles (NautilusIconContainer *container) ungrab_stretch_icon (container); } nautilus_icon_canvas_item_set_show_stretch_handles (icon->item, TRUE); + details->stretch_icon = icon; icon_get_size (container, icon, &initial_size_x, &initial_size_y); + /* only need to keep size in one dimension, since they are constrained to be the same */ - container->details->initial_stretch_size = initial_size_x; + container->details->stretch_initial_x = icon->x; + container->details->stretch_initial_y = icon->y; + container->details->stretch_initial_size = initial_size_x; } /** @@ -4345,6 +4348,9 @@ compute_stretch (StretchState *start, gboolean right, bottom; int x_stretch, y_stretch; + /* FIXME bugzilla.eazel.com 5390: This doesn't correspond to + * the way the handles are drawn. + */ /* Figure out which handle we are dragging. */ right = start->pointer_x > start->icon_x + (int) start->icon_size / 2; bottom = start->pointer_y > start->icon_y + (int) start->icon_size / 2; @@ -4358,8 +4364,8 @@ compute_stretch (StretchState *start, if (bottom) { y_stretch = - y_stretch; } - current->icon_size = MAX ((int)start->icon_size + MIN (x_stretch, y_stretch), - (int)NAUTILUS_ICON_SIZE_SMALLEST); + current->icon_size = MAX ((int) start->icon_size + MIN (x_stretch, y_stretch), + (int) NAUTILUS_ICON_SIZE_SMALLEST); /* Figure out where the corner of the icon should be. */ current->icon_x = start->icon_x; diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index c889025e5..36dc2b55c 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -367,8 +367,7 @@ nautilus_icon_factory_initialize (NautilusIconFactory *factory) { factory->scalable_icons = g_hash_table_new (nautilus_scalable_icon_hash, nautilus_scalable_icon_equal); - factory->cache_icons = g_hash_table_new (g_direct_hash, - g_direct_equal); + factory->cache_icons = g_hash_table_new (NULL, NULL); factory->icon_cache = g_hash_table_new (cache_key_hash, cache_key_equal); diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h index b590a78bb..cc51a6ea9 100644 --- a/libnautilus-private/nautilus-icon-private.h +++ b/libnautilus-private/nautilus-icon-private.h @@ -108,7 +108,8 @@ struct NautilusIconContainerDetails { /* Current icon with stretch handles, so we have only one. */ NautilusIcon *stretch_icon; - int initial_stretch_size; + double stretch_initial_x, stretch_initial_y; + guint stretch_initial_size; /* Last highlighted drop target. */ NautilusIcon *drop_target; diff --git a/libnautilus-private/nautilus-list.c b/libnautilus-private/nautilus-list.c index d652afb68..fc498aa02 100644 --- a/libnautilus-private/nautilus-list.c +++ b/libnautilus-private/nautilus-list.c @@ -3323,7 +3323,7 @@ nautilus_list_set_selection (NautilusList *list, GList *selection) selection_changed = FALSE; - hash = g_hash_table_new (g_direct_hash, g_direct_equal); + hash = g_hash_table_new (NULL, NULL); for (p = selection; p != NULL; p = p->next) { g_hash_table_insert (hash, p->data, p->data); } diff --git a/libnautilus-private/nautilus-merged-directory.c b/libnautilus-private/nautilus-merged-directory.c index e0a50f1eb..e54860522 100644 --- a/libnautilus-private/nautilus-merged-directory.c +++ b/libnautilus-private/nautilus-merged-directory.c @@ -80,8 +80,7 @@ nautilus_merged_directory_initialize (gpointer object, gpointer klass) merged->details = g_new0 (NautilusMergedDirectoryDetails, 1); merged->details->callbacks = g_hash_table_new (merged_callback_hash, merged_callback_equal); - merged->details->monitors = g_hash_table_new - (g_direct_hash, g_direct_equal); + merged->details->monitors = g_hash_table_new (NULL, NULL); } static void diff --git a/libnautilus-private/nautilus-trash-directory.c b/libnautilus-private/nautilus-trash-directory.c index 0e7210881..a4c03452b 100644 --- a/libnautilus-private/nautilus-trash-directory.c +++ b/libnautilus-private/nautilus-trash-directory.c @@ -205,8 +205,7 @@ nautilus_trash_directory_initialize (gpointer object, gpointer klass) trash = NAUTILUS_TRASH_DIRECTORY (object); trash->details = g_new0 (NautilusTrashDirectoryDetails, 1); - trash->details->volumes = g_hash_table_new - (g_direct_hash, g_direct_equal); + trash->details->volumes = g_hash_table_new (NULL, NULL); volume_monitor = nautilus_volume_monitor_get (); diff --git a/libnautilus/nautilus-view-component.idl b/libnautilus/nautilus-view-component.idl index 6ed271ae5..46680cd86 100644 --- a/libnautilus/nautilus-view-component.idl +++ b/libnautilus/nautilus-view-component.idl @@ -52,6 +52,13 @@ module Nautilus { typedef string URI; typedef sequence<URI> URIList; + struct HistoryItem { + string title; + URI location; + string icon; + }; + typedef sequence<HistoryItem> History; + /* The View interface is used by the Nautilus shell to control * the view. A view that is a Bonobo::Control can choose to * implement the View interface for additional finer control @@ -70,6 +77,9 @@ module Nautilus { /* Called to tell the view about title changes. */ oneway void title_changed (in string title); + + /* Called to tell the view about history changes. */ + oneway void history_changed (in History history); }; /* The ViewFrame interface is used by the view to communicate @@ -121,26 +131,6 @@ module Nautilus { /* Called by a view component to change the title. */ oneway void set_title (in string new_title); - }; - - /* The specifications for a history list item. The structure - * contains the title of the item, and the location it's for. - */ - struct HistoryItem { - string title; - URI location; - string icon; - }; - typedef sequence<HistoryItem> HistoryList; - - /* An interface that a component can use to get at the history - * list stored in Nautilus. - */ - interface HistoryFrame : ::Bonobo::Unknown { - /* Called by a view component to get the Nautilus - * history list. - */ - HistoryList get_history_list (); }; }; diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c index 5be86a4f3..7174badd2 100644 --- a/libnautilus/nautilus-view.c +++ b/libnautilus/nautilus-view.c @@ -40,9 +40,10 @@ #include <libnautilus-extensions/nautilus-gtk-macros.h> enum { + HISTORY_CHANGED, LOAD_LOCATION, - STOP_LOADING, SELECTION_CHANGED, + STOP_LOADING, TITLE_CHANGED, LAST_SIGNAL }; @@ -69,6 +70,9 @@ static void impl_Nautilus_View_selection_changed (PortableServer_Servant servan static void impl_Nautilus_View_title_changed (PortableServer_Servant servant, const CORBA_char *title, CORBA_Environment *ev); +static void impl_Nautilus_View_history_changed (PortableServer_Servant servant, + const Nautilus_History *history, + CORBA_Environment *ev); static void nautilus_view_initialize (NautilusView *view); static void nautilus_view_destroy (GtkObject *object); static void nautilus_view_initialize_class (NautilusViewClass *klass); @@ -78,10 +82,11 @@ NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusView, nautilus_view, BONOBO_OBJECT_TY static POA_Nautilus_View__epv libnautilus_Nautilus_View_epv = { NULL, - &impl_Nautilus_View_load_location, - &impl_Nautilus_View_stop_loading, - &impl_Nautilus_View_selection_changed, - &impl_Nautilus_View_title_changed + impl_Nautilus_View_load_location, + impl_Nautilus_View_stop_loading, + impl_Nautilus_View_selection_changed, + impl_Nautilus_View_title_changed, + impl_Nautilus_View_history_changed }; static PortableServer_ServantBase__epv base_epv; @@ -179,6 +184,15 @@ impl_Nautilus_View_title_changed (PortableServer_Servant servant, title); } +static void +impl_Nautilus_View_history_changed (PortableServer_Servant servant, + const Nautilus_History *history, + CORBA_Environment *ev) +{ + gtk_signal_emit (GTK_OBJECT (((impl_POA_Nautilus_View *) servant)->bonobo_object), + signals[HISTORY_CHANGED], + history); +} static void impl_Nautilus_View__destroy (BonoboObject *object, PortableServer_Servant servant) @@ -256,6 +270,13 @@ nautilus_view_initialize_class (NautilusViewClass *klass) GTK_SIGNAL_OFFSET (NautilusViewClass, title_changed), gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[HISTORY_CHANGED] = + gtk_signal_new ("history_changed", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (NautilusViewClass, history_changed), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } diff --git a/libnautilus/nautilus-view.h b/libnautilus/nautilus-view.h index 436ceebb7..7bd49bfec 100644 --- a/libnautilus/nautilus-view.h +++ b/libnautilus/nautilus-view.h @@ -22,6 +22,7 @@ * * Authors: Elliot Lee <sopwith@redhat.com> * Maciej Stachowiak <mjs@eazel.com> + * Darin Adler <darin@eazel.com> * */ @@ -30,11 +31,8 @@ #include <libnautilus/nautilus-view-component.h> #include <bonobo/bonobo-control.h> -#include <gtk/gtkwidget.h> -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +BEGIN_GNOME_DECLS #define NAUTILUS_TYPE_VIEW (nautilus_view_get_type ()) #define NAUTILUS_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW, NautilusView)) @@ -46,27 +44,26 @@ typedef struct NautilusViewDetails NautilusViewDetails; typedef struct { BonoboObject parent_spot; - NautilusViewDetails *details; } NautilusView; typedef struct { BonoboObjectClass parent_spot; - void (*load_location) (NautilusView *view, - const char *location_uri); - void (*stop_loading) (NautilusView *view); - void (*selection_changed) (NautilusView *view, - GList *selection); /* list of URI char *s */ - void (*title_changed) (NautilusView *view, - const char *title); + void (* load_location) (NautilusView *view, + const char *location_uri); + void (* stop_loading) (NautilusView *view); + void (* selection_changed) (NautilusView *view, + GList *selection); /* list of URI char *s */ + void (* title_changed) (NautilusView *view, + const char *title); + void (* history_changed) (NautilusView *view, + const Nautilus_History *history); } NautilusViewClass; GtkType nautilus_view_get_type (void); NautilusView * nautilus_view_new (GtkWidget *widget); NautilusView * nautilus_view_new_from_bonobo_control (BonoboControl *bonobo_control); - - BonoboControl * nautilus_view_get_bonobo_control (NautilusView *view); /* Calls to the Nautilus shell via the view frame. See the IDL for detailed comments. */ @@ -102,16 +99,12 @@ BonoboUIComponent *nautilus_view_set_up_ui (NautilusV const char *ui_xml_file_name, const char *application_name); - /* `protected' functions for use by subclasses only. */ NautilusView * nautilus_view_construct (NautilusView *view, GtkWidget *widget); NautilusView * nautilus_view_construct_from_bonobo_control (NautilusView *view, BonoboControl *bonobo_control); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +END_GNOME_DECLS #endif /* NAUTILUS_VIEW_H */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 5018b25ef..983098d0e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -73,6 +73,7 @@ libnautilus-extensions/nautilus-file-operations.c libnautilus-extensions/nautilus-file.c libnautilus-extensions/nautilus-font-factory.c libnautilus-extensions/nautilus-font-picker.c +libnautilus-extensions/nautilus-glib-extensions.c libnautilus-extensions/nautilus-global-preferences.c libnautilus-extensions/nautilus-icon-canvas-item.c libnautilus-extensions/nautilus-icon-dnd.c diff --git a/src/Makefile.am b/src/Makefile.am index 4937d9c1f..1d3f0040d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,6 @@ noinst_HEADERS = \ nautilus-component-adapter-factory.h \ nautilus-desktop-window.h \ nautilus-first-time-druid.h \ - nautilus-history-frame.h \ nautilus-link-set-window.h \ nautilus-location-bar.h \ nautilus-main.h \ @@ -107,7 +106,6 @@ nautilus_SOURCES = \ nautilus-component-adapter-factory.c \ nautilus-desktop-window.c \ nautilus-first-time-druid.c \ - nautilus-history-frame.c \ nautilus-link-set-window.c \ nautilus-location-bar.c \ nautilus-main.c \ diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 9c2f2dd59..b26bdfb69 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -2037,13 +2037,13 @@ fm_properties_window_present (NautilusFile *file, FMDirectoryView *directory_vie /* Create the hash tables first time through. */ if (windows == NULL) { - windows = nautilus_g_hash_table_new_free_at_exit ( - g_direct_hash, g_direct_equal, "Property windows"); + windows = nautilus_g_hash_table_new_free_at_exit + (NULL, NULL, "property windows"); } if (pending_files == NULL) { - pending_files = nautilus_g_hash_table_new_free_at_exit ( - g_direct_hash, g_direct_equal, "pending Property window files"); + pending_files = nautilus_g_hash_table_new_free_at_exit + (NULL, NULL, "pending property window files"); } file_to_display = get_and_ref_file_to_display (file); diff --git a/src/nautilus-history-frame.c b/src/nautilus-history-frame.c deleted file mode 100644 index 0a1aea892..000000000 --- a/src/nautilus-history-frame.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Nautilus - * - * Copyright (C) 1999, 2000 Eazel, Inc. - * - * Nautilus is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * Nautilus is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Author: Gene Z. Ragan <gzr@eazel.com> - * - */ - -/* nautilus-history-frame.c: CORBA server implementation of - Nautilus::HistoryFrame interface of a Nautilus HistoryFrame. */ - -#include <config.h> -#include "nautilus-history-frame.h" - -#include <gtk/gtksignal.h> -#include <libnautilus/nautilus-bonobo-workarounds.h> - -typedef struct { - POA_Nautilus_HistoryFrame servant; - BonoboObject *bonobo_object; - NautilusViewFrame *view; -} impl_POA_Nautilus_HistoryFrame; - -static Nautilus_HistoryList *impl_Nautilus_HistoryFrame_get_history_list (PortableServer_Servant servant, - CORBA_Environment *ev); - -POA_Nautilus_HistoryFrame__epv impl_Nautilus_HistoryFrame_epv = -{ - NULL, - impl_Nautilus_HistoryFrame_get_history_list, -}; - -static PortableServer_ServantBase__epv base_epv; -POA_Nautilus_HistoryFrame__vepv impl_Nautilus_HistoryFrame_vepv = -{ - &base_epv, - NULL, - &impl_Nautilus_HistoryFrame_epv -}; - -static void -impl_Nautilus_HistoryFrame__destroy (BonoboObject *object, - impl_POA_Nautilus_HistoryFrame *servant) -{ - PortableServer_ObjectId *object_id; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - object_id = PortableServer_POA_servant_to_id (bonobo_poa (), servant, &ev); - PortableServer_POA_deactivate_object (bonobo_poa (), object_id, &ev); - CORBA_free (object_id); - object->servant = NULL; - - POA_Nautilus_HistoryFrame__fini ((PortableServer_Servant) servant, &ev); - g_free (servant); - - CORBA_exception_free (&ev); -} - -BonoboObject * -impl_Nautilus_HistoryFrame__create (NautilusViewFrame *view, - CORBA_Environment * ev) -{ - BonoboObject *bonobo_object; - impl_POA_Nautilus_HistoryFrame *servant; - - impl_Nautilus_HistoryFrame_vepv.Bonobo_Unknown_epv = nautilus_bonobo_object_get_epv (); - - servant = g_new0 (impl_POA_Nautilus_HistoryFrame, 1); - servant->servant.vepv = &impl_Nautilus_HistoryFrame_vepv; - servant->view = view; - POA_Nautilus_HistoryFrame__init ((PortableServer_Servant) servant, ev); - - bonobo_object = bonobo_object_new_from_servant (servant); - - gtk_signal_connect (GTK_OBJECT (bonobo_object), "destroy", - GTK_SIGNAL_FUNC (impl_Nautilus_HistoryFrame__destroy), servant); - - return bonobo_object; -} - -static Nautilus_HistoryList * -impl_Nautilus_HistoryFrame_get_history_list (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - return nautilus_view_frame_get_history_list - (((impl_POA_Nautilus_HistoryFrame *)servant)->view); -} - - diff --git a/src/nautilus-history-frame.h b/src/nautilus-history-frame.h deleted file mode 100644 index beae952e0..000000000 --- a/src/nautilus-history-frame.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ - -/* - * Nautilus - * - * Copyright (C) 1999, 2000 Eazel, Inc. - * - * Nautilus is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * Nautilus is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Author: Gene Z. Ragan <gzr@eazel.com> - * - */ - -#ifndef NAUTILUS_HISTORY_FRAME_H -#define NAUTILUS_HISTORY_FRAME_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include "nautilus-view-frame.h" - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-main.h> -#include <libnautilus/nautilus-view-component.h> - - - -BonoboObject *impl_Nautilus_HistoryFrame__create (NautilusViewFrame *view, - CORBA_Environment *ev); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* NAUTILUS_HISTORY_FRAME_H */ diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c index 3f511e3f4..b4659121f 100644 --- a/src/nautilus-navigation-window-menus.c +++ b/src/nautilus-navigation-window-menus.c @@ -1112,7 +1112,7 @@ nautilus_window_initialize_go_menu (NautilusWindow *window) /* Recreate bookmarks part of menu if history list changes * or if icon theme changes. */ - gtk_signal_connect_object_while_alive (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_connect_object_while_alive (nautilus_signaller_get_current (), "history_list_changed", schedule_refresh_go_menu, GTK_OBJECT (window)); @@ -1121,7 +1121,6 @@ nautilus_window_initialize_go_menu (NautilusWindow *window) "icons_changed", schedule_refresh_go_menu, GTK_OBJECT (window)); - } /* handler to receive the user_level_changed signal, so we can update the menu and dialog diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 58e076e0d..3818e746c 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -1318,7 +1318,7 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow) void nautilus_send_history_list_changed (void) { - gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_emit_by_name (nautilus_signaller_get_current (), "history_list_changed"); } diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 58e076e0d..3818e746c 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -1318,7 +1318,7 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow) void nautilus_send_history_list_changed (void) { - gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_emit_by_name (nautilus_signaller_get_current (), "history_list_changed"); } diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c index 1e96311c8..84370bdc8 100644 --- a/src/nautilus-property-browser.c +++ b/src/nautilus-property-browser.c @@ -2314,6 +2314,6 @@ nautilus_property_browser_size_allocate(GtkWidget *widget, GtkAllocation *alloca static void emit_emblems_changed_signal (void) { - gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_emit_by_name (nautilus_signaller_get_current (), "emblems_changed"); } diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c index 638037cc5..a502309d9 100644 --- a/src/nautilus-search-bar-criterion.c +++ b/src/nautilus-search-bar-criterion.c @@ -268,7 +268,7 @@ nautilus_search_bar_criterion_destroy (GtkObject *object) criterion = NAUTILUS_SEARCH_BAR_CRITERION (object); /* FIXME bugzilla.eazel.com 2437: need more freeage */ - gtk_signal_disconnect_by_data (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_disconnect_by_data (nautilus_signaller_get_current (), criterion); /* nautilus_undo_editable_set_undo_key (GTK_EDITABLE (criterion->details->value_entry), FALSE); nautilus_undo_tear_down_nautilus_entry_for_undo (criterion->details->value_entry); @@ -336,7 +336,7 @@ nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType ty "need_reallocation", queue_bar_resize_callback, bar); - gtk_signal_connect (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_connect (nautilus_signaller_get_current (), "emblems_changed", emblems_changed_callback, (gpointer) criterion); diff --git a/src/nautilus-signaller.c b/src/nautilus-signaller.c index 6853a775f..c47d41053 100644 --- a/src/nautilus-signaller.c +++ b/src/nautilus-signaller.c @@ -32,7 +32,8 @@ #include <gtk/gtksignal.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> -static NautilusSignaller *global_signaller = NULL; +typedef GtkObject NautilusSignaller; +typedef GtkObjectClass NautilusSignallerClass; enum { HISTORY_LIST_CHANGED, @@ -40,11 +41,14 @@ enum { LAST_SIGNAL }; -static guint nautilus_signaller_signals[LAST_SIGNAL]; +static guint signals[LAST_SIGNAL]; -static void nautilus_signaller_initialize_class (gpointer klass); -static void nautilus_signaller_initialize (gpointer object, - gpointer klass); +static GtkObject *global_signaller = NULL; + +static GtkType nautilus_signaller_get_type (void); +static void nautilus_signaller_initialize_class (gpointer klass); +static void nautilus_signaller_initialize (gpointer object, + gpointer klass); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusSignaller, nautilus_signaller, @@ -57,21 +61,22 @@ nautilus_signaller_initialize_class (gpointer klass) object_class = GTK_OBJECT_CLASS (klass); - nautilus_signaller_signals[HISTORY_LIST_CHANGED] = + signals[HISTORY_LIST_CHANGED] = gtk_signal_new ("history_list_changed", GTK_RUN_LAST, object_class->type, 0, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); - nautilus_signaller_signals[EMBLEMS_CHANGED] = + signals[EMBLEMS_CHANGED] = gtk_signal_new ("emblems_changed", GTK_RUN_LAST, object_class->type, 0, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, nautilus_signaller_signals, LAST_SIGNAL); + + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } static void @@ -86,11 +91,11 @@ unref_global_signaller (void) gtk_object_unref (GTK_OBJECT (global_signaller)); } -NautilusSignaller * +GtkObject * nautilus_signaller_get_current (void) { if (global_signaller == NULL) { - global_signaller = NAUTILUS_SIGNALLER (gtk_object_new (NAUTILUS_TYPE_SIGNALLER, NULL)); + global_signaller = gtk_object_new (nautilus_signaller_get_type (), NULL); gtk_object_ref (GTK_OBJECT (global_signaller)); gtk_object_sink (GTK_OBJECT (global_signaller)); g_atexit (unref_global_signaller); diff --git a/src/nautilus-signaller.h b/src/nautilus-signaller.h index 4bf2b1359..0998a6e35 100644 --- a/src/nautilus-signaller.h +++ b/src/nautilus-signaller.h @@ -40,34 +40,7 @@ this kind of thing. */ -typedef struct _NautilusSignaller NautilusSignaller; -typedef struct _NautilusSignallerClass NautilusSignallerClass; - -#define NAUTILUS_TYPE_SIGNALLER \ - (nautilus_signaller_get_type ()) -#define NAUTILUS_SIGNALLER(obj) \ - (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SIGNALLER, NautilusSignaller)) -#define NAUTILUS_SIGNALLER_CLASS(klass) \ - (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SIGNALLER, NautilusSignallerClass)) -#define NAUTILUS_IS_SIGNALLER(obj) \ - (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SIGNALLER)) -#define NAUTILUS_IS_SIGNALLER_CLASS(klass) \ - (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SIGNALLER)) - -struct _NautilusSignaller -{ - GtkObject object; -}; - -struct _NautilusSignallerClass -{ - GtkObjectClass parent_class; -}; - -/* Basic GtkObject requirements. */ -GtkType nautilus_signaller_get_type (void); - /* Get the one and only NautilusSignaller to connect with or emit signals for */ -NautilusSignaller *nautilus_signaller_get_current (void); +GtkObject *nautilus_signaller_get_current (void); #endif /* NAUTILUS_SIGNALLER_H */ diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 58e076e0d..3818e746c 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -1318,7 +1318,7 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow) void nautilus_send_history_list_changed (void) { - gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_emit_by_name (nautilus_signaller_get_current (), "history_list_changed"); } diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c index ea6c5d371..940135480 100644 --- a/src/nautilus-view-frame.c +++ b/src/nautilus-view-frame.c @@ -32,7 +32,7 @@ #include "nautilus-application.h" #include "nautilus-component-adapter-factory.h" -#include "nautilus-history-frame.h" +#include "nautilus-signaller.h" #include "nautilus-window.h" #include <gtk/gtksignal.h> #include <libnautilus-extensions/nautilus-bonobo-extensions.h> @@ -90,10 +90,13 @@ static void nautilus_view_frame_initialize (NautilusViewFrame *view); static void nautilus_view_frame_destroy (GtkObject *view); static void nautilus_view_frame_finalize (GtkObject *view); static void nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass); +static void send_history (NautilusViewFrame *view); static guint signals[LAST_SIGNAL]; -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusViewFrame, nautilus_view_frame, NAUTILUS_TYPE_GENEROUS_BIN) +NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusViewFrame, + nautilus_view_frame, + NAUTILUS_TYPE_GENEROUS_BIN) static void nautilus_view_frame_initialize_class (NautilusViewFrameClass *klass) @@ -226,6 +229,15 @@ nautilus_view_frame_initialize (NautilusViewFrame *view) GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW); view->details = g_new0 (NautilusViewFrameDetails, 1); + + gtk_signal_connect_object_while_alive (nautilus_signaller_get_current (), + "history_list_changed", + send_history, + GTK_OBJECT (view)); + gtk_signal_connect_object_while_alive (GTK_OBJECT (nautilus_icon_factory_get ()), + "icons_changed", + send_history, + GTK_OBJECT (view)); } static void @@ -250,9 +262,10 @@ nautilus_view_frame_destroy_client (NautilusViewFrame *view) bonobo_object_unref (view->view_frame); view->view_frame = NULL; - /* we can NULL those since we just unref'ed them - with the aggregate view frame. */ - view->history_frame = NULL; + + /* We can NULL this since we just unref'ed it as part of the + * aggregate view frame. + */ view->zoomable_frame = NULL; CORBA_exception_free (&ev); @@ -272,11 +285,12 @@ nautilus_view_frame_destroy_client (NautilusViewFrame *view) static void nautilus_view_frame_destroy (GtkObject *object) { - NautilusViewFrame *frame; + NautilusViewFrame *view; - frame = NAUTILUS_VIEW_FRAME (object); + view = NAUTILUS_VIEW_FRAME (object); - nautilus_view_frame_destroy_client (frame); + nautilus_view_frame_destroy_client (view); + view->details->state = VIEW_FRAME_EMPTY; NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } @@ -284,14 +298,14 @@ nautilus_view_frame_destroy (GtkObject *object) static void nautilus_view_frame_finalize (GtkObject *object) { - NautilusViewFrame *frame; + NautilusViewFrame *view; - frame = NAUTILUS_VIEW_FRAME (object); + view = NAUTILUS_VIEW_FRAME (object); - g_free (frame->details->title); - g_free (frame->details->label); - g_free (frame->details->activation_iid); - g_free (frame->details); + g_free (view->details->title); + g_free (view->details->label); + g_free (view->details->activation_iid); + g_free (view->details); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object)); } @@ -351,6 +365,7 @@ view_frame_activated (NautilusViewFrame *view) switch (view->details->state) { case VIEW_FRAME_ACTIVATING: view->details->state = VIEW_FRAME_NO_LOCATION; + send_history (view); return; case VIEW_FRAME_EMPTY: case VIEW_FRAME_NO_LOCATION: @@ -563,6 +578,12 @@ nautilus_view_frame_new (BonoboUIContainer *ui_container, return view_frame; } +static Nautilus_ViewFrame +get_CORBA_object (NautilusViewFrame *view) +{ + return bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)); +} + static gboolean check_if_view_is_gone (gpointer data) { @@ -574,7 +595,7 @@ check_if_view_is_gone (gpointer data) CORBA_exception_init (&ev); ok = TRUE; - if (CORBA_Object_non_existent (bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)), &ev)) { + if (CORBA_Object_non_existent (get_CORBA_object (view), &ev)) { view->details->check_if_view_is_gone_timeout_id = 0; bonobo_window_deregister_dead_components (view->details->ui_container->win); view_frame_failed (view); @@ -608,7 +629,7 @@ zoom_parameters_changed_callback (BonoboZoomableFrame *zframe, NautilusViewFrame } static gboolean -nautilus_view_frame_set_to_component (NautilusViewFrame *view, BonoboObjectClient *component) +attach_client (NautilusViewFrame *view, BonoboObjectClient *client) { CORBA_Environment ev; Nautilus_View adapted; @@ -634,8 +655,8 @@ nautilus_view_frame_set_to_component (NautilusViewFrame *view, BonoboObjectClien adapted = nautilus_component_adapter_factory_create_adapter (adapter_factory, - component); - bonobo_object_unref (BONOBO_OBJECT (component)); + client); + bonobo_object_unref (BONOBO_OBJECT (client)); /* Handle case where we don't know how to host this component. */ if (adapted == CORBA_OBJECT_NIL) { @@ -660,7 +681,7 @@ nautilus_view_frame_set_to_component (NautilusViewFrame *view, BonoboObjectClien /* Add a zoomable frame interface. */ zoomable = Bonobo_Unknown_queryInterface (control, "IDL:Bonobo/Zoomable:1.0", &ev); - if ((ev._major == CORBA_NO_EXCEPTION) && !CORBA_Object_is_nil (zoomable, &ev)) { + if (ev._major == CORBA_NO_EXCEPTION && !CORBA_Object_is_nil (zoomable, &ev)) { view->zoomable_frame = bonobo_zoomable_frame_new (); gtk_signal_connect (GTK_OBJECT (view->zoomable_frame), "zoom_level_changed", @@ -686,23 +707,14 @@ nautilus_view_frame_set_to_component (NautilusViewFrame *view, BonoboObjectClien bonobo_control_frame_bind_to_control (control_frame, control); view->client_widget = bonobo_control_frame_get_widget (control_frame); - - if (view->zoomable_frame) { + if (view->zoomable_frame != NULL) { bonobo_object_add_interface (BONOBO_OBJECT (view->view_frame), BONOBO_OBJECT (view->zoomable_frame)); - gtk_signal_emit_by_name (GTK_OBJECT (view->zoomable_frame), "zoom_parameters_changed"); + gtk_signal_emit_by_name (GTK_OBJECT (view->zoomable_frame), + "zoom_parameters_changed"); } - /* Add a history frame interface. */ - view->history_frame = impl_Nautilus_HistoryFrame__create (view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - /* FIXME bugzilla.eazel.com 5041: Cleanup needed here. */ - return FALSE; - } - bonobo_object_add_interface (BONOBO_OBJECT (view->view_frame), - BONOBO_OBJECT (view->history_frame)); - /* Add an undo context interface. */ nautilus_undo_manager_add_interface (view->undo_manager, BONOBO_OBJECT (view->view_frame)); @@ -747,7 +759,7 @@ activation_callback (CORBA_Object object_reference, gpointer data) view = (NautilusViewFrame *) data; bonobo_object = bonobo_object_client_from_corba (object_reference); - nautilus_view_frame_set_to_component (view, bonobo_object); + attach_client (view, bonobo_object); gtk_signal_emit (GTK_OBJECT (view), signals[CLIENT_LOADED], bonobo_object); @@ -791,6 +803,7 @@ nautilus_view_frame_load_client (NautilusViewFrame *view, const char *iid) } view_frame_activating (view); + component = bonobo_object_activate (iid, 0); if (component == NULL) { view_frame_not_activated (view); @@ -798,9 +811,15 @@ nautilus_view_frame_load_client (NautilusViewFrame *view, const char *iid) } view->details->activation_iid = g_strdup (iid); + + if (!attach_client (view, component)) { + view_frame_not_activated (view); + return FALSE; + } + view_frame_activated (view); - return nautilus_view_frame_set_to_component (view, component); + return TRUE; } void @@ -830,7 +849,7 @@ nautilus_view_frame_load_location (NautilusViewFrame *view, /* ORBit does a bad job with Nautilus_URI, so it's not const char *. */ CORBA_exception_init (&ev); - Nautilus_View_load_location (bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)), + Nautilus_View_load_location (get_CORBA_object (view), (Nautilus_URI) location, &ev); if (ev._major != CORBA_NO_EXCEPTION) { view_frame_failed (view); @@ -846,8 +865,7 @@ nautilus_view_frame_stop_loading (NautilusViewFrame *view) g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); CORBA_exception_init (&ev); - Nautilus_View_stop_loading (bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)), - &ev); + Nautilus_View_stop_loading (get_CORBA_object (view), &ev); if (ev._major != CORBA_NO_EXCEPTION) { view_frame_failed (view); } @@ -867,8 +885,7 @@ nautilus_view_frame_selection_changed (NautilusViewFrame *view, uri_list = nautilus_uri_list_from_g_list (selection); CORBA_exception_init (&ev); - Nautilus_View_selection_changed (bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)), - uri_list, &ev); + Nautilus_View_selection_changed (get_CORBA_object (view), uri_list, &ev); if (ev._major != CORBA_NO_EXCEPTION) { view_frame_failed (view); } @@ -886,9 +903,7 @@ nautilus_view_frame_title_changed (NautilusViewFrame *view, g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); CORBA_exception_init (&ev); - Nautilus_View_title_changed (bonobo_object_corba_objref (BONOBO_OBJECT (view->client_object)), - title, - &ev); + Nautilus_View_title_changed (get_CORBA_object (view), title, &ev); if (ev._major != CORBA_NO_EXCEPTION) { view_frame_failed (view); } @@ -898,22 +913,19 @@ nautilus_view_frame_title_changed (NautilusViewFrame *view, gboolean nautilus_view_frame_is_zoomable (NautilusViewFrame *view) { - gboolean is_zoomable; - - is_zoomable = view->zoomable_frame != NULL; - - return is_zoomable; + return view->zoomable_frame != NULL; } -gdouble +double nautilus_view_frame_get_zoom_level (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return 0.0; + } - return (gdouble) bonobo_zoomable_frame_get_zoom_level (view->zoomable_frame); + return (double) bonobo_zoomable_frame_get_zoom_level (view->zoomable_frame); } void @@ -922,21 +934,23 @@ nautilus_view_frame_set_zoom_level (NautilusViewFrame *view, { g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return; + } bonobo_zoomable_frame_set_zoom_level (view->zoomable_frame, (float) zoom_level); } -gdouble +double nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return 0.0; + } - return (gdouble) bonobo_zoomable_frame_get_min_zoom_level (view->zoomable_frame); + return (double) bonobo_zoomable_frame_get_min_zoom_level (view->zoomable_frame); } double @@ -944,10 +958,11 @@ nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return 0.0; + } - return (gdouble) bonobo_zoomable_frame_get_max_zoom_level (view->zoomable_frame); + return (double) bonobo_zoomable_frame_get_max_zoom_level (view->zoomable_frame); } gboolean @@ -955,8 +970,9 @@ nautilus_view_frame_get_has_min_zoom_level (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return FALSE; + } return bonobo_zoomable_frame_has_min_zoom_level (view->zoomable_frame); } @@ -966,8 +982,9 @@ nautilus_view_frame_get_has_max_zoom_level (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return FALSE; + } return bonobo_zoomable_frame_has_max_zoom_level (view->zoomable_frame); } @@ -977,8 +994,9 @@ nautilus_view_frame_get_is_continuous (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return FALSE; + } return bonobo_zoomable_frame_is_continuous (view->zoomable_frame); } @@ -988,8 +1006,9 @@ nautilus_view_frame_get_preferred_zoom_levels (NautilusViewFrame *view) { g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return NULL; + } return bonobo_zoomable_frame_get_preferred_zoom_levels (view->zoomable_frame); } @@ -998,9 +1017,10 @@ void nautilus_view_frame_zoom_in (NautilusViewFrame *view) { g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); - - if (view->zoomable_frame == NULL) + + if (view->zoomable_frame == NULL) { return; + } bonobo_zoomable_frame_zoom_in (view->zoomable_frame); } @@ -1010,8 +1030,9 @@ nautilus_view_frame_zoom_out (NautilusViewFrame *view) { g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return; + } bonobo_zoomable_frame_zoom_out (view->zoomable_frame); } @@ -1021,8 +1042,9 @@ nautilus_view_frame_zoom_to_fit (NautilusViewFrame *view) { g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view)); - if (view->zoomable_frame == NULL) + if (view->zoomable_frame == NULL) { return; + } bonobo_zoomable_frame_zoom_to_fit (view->zoomable_frame); } @@ -1186,14 +1208,13 @@ nautilus_view_frame_activate (NautilusViewFrame *view) } -Nautilus_HistoryList * -nautilus_view_frame_get_history_list (NautilusViewFrame *view) +static Nautilus_History * +get_history_list (NautilusViewFrame *view) { - Nautilus_HistoryList *history_list; + Nautilus_History *history_list; g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL); - view_frame_wait_is_over (view); history_list = NULL; gtk_signal_emit (GTK_OBJECT (view), signals[GET_HISTORY_LIST], @@ -1201,6 +1222,36 @@ nautilus_view_frame_get_history_list (NautilusViewFrame *view) return history_list; } +static void +send_history (NautilusViewFrame *view) +{ + Nautilus_History *history; + CORBA_Environment ev; + + switch (view->details->state) { + case VIEW_FRAME_EMPTY: + case VIEW_FRAME_ACTIVATING: + case VIEW_FRAME_FAILED: + return; + case VIEW_FRAME_NO_LOCATION: + case VIEW_FRAME_WAITING: + case VIEW_FRAME_UNDERWAY: + case VIEW_FRAME_LOADED: + break; + } + + history = get_history_list (view); + + CORBA_exception_init (&ev); + Nautilus_View_history_changed (get_CORBA_object (view), history, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + view_frame_failed (view); + } + CORBA_exception_free (&ev); + + CORBA_free (history); +} + gboolean nautilus_view_frame_get_is_underway (NautilusViewFrame *view) { diff --git a/src/nautilus-view-frame.h b/src/nautilus-view-frame.h index 3bdb4ba6f..f7940aa2d 100644 --- a/src/nautilus-view-frame.h +++ b/src/nautilus-view-frame.h @@ -59,7 +59,6 @@ typedef struct { /* The frame itself (from various interface points of view). */ BonoboObject *view_frame; BonoboZoomableFrame *zoomable_frame; - BonoboObject *history_frame; /* The view inside the (various interfaces). */ BonoboObjectClient *client_object; @@ -72,33 +71,33 @@ typedef struct { /* These roughly correspond to CORBA calls, but in some cases they are higher level. */ /* This happens only just after load_client. */ - void (* client_loaded) (NautilusViewFrame *view); + void (* client_loaded) (NautilusViewFrame *view); /* These can happen pretty much any time. */ - void (* load_underway) (NautilusViewFrame *view); - void (* failed) (NautilusViewFrame *view); + void (* load_underway) (NautilusViewFrame *view); + void (* failed) (NautilusViewFrame *view); /* These will only happen after load_underway (guaranteed). */ - void (* open_location_in_this_window) - (NautilusViewFrame *view, - const char *location); - void (* open_location_prefer_existing_window) - (NautilusViewFrame *view, - const char *location); - void (* open_location_force_new_window) - (NautilusViewFrame *view, - const char *location, - GList *selection); /* list of char * */ - void (* change_selection) (NautilusViewFrame *view, - GList *selection); /* list of char * */ - void (* change_status) (NautilusViewFrame *view, - const char *status); - void (* load_progress_changed) (NautilusViewFrame *view); - void (* load_complete) (NautilusViewFrame *view); - void (* title_changed) (NautilusViewFrame *view); - void (* zoom_level_changed) (NautilusViewFrame *view); - void (* zoom_parameters_changed) (NautilusViewFrame *view); - Nautilus_HistoryList * (* get_history_list) (NautilusViewFrame *view); + void (* open_location_in_this_window) + (NautilusViewFrame *view, + const char *location); + void (* open_location_prefer_existing_window) + (NautilusViewFrame *view, + const char *location); + void (* open_location_force_new_window) + (NautilusViewFrame *view, + const char *location, + GList *selection); /* list of char * */ + void (* change_selection) (NautilusViewFrame *view, + GList *selection); /* list of char * */ + void (* change_status) (NautilusViewFrame *view, + const char *status); + void (* load_progress_changed) (NautilusViewFrame *view); + void (* load_complete) (NautilusViewFrame *view); + void (* title_changed) (NautilusViewFrame *view); + void (* zoom_level_changed) (NautilusViewFrame *view); + void (* zoom_parameters_changed) (NautilusViewFrame *view); + Nautilus_History * (* get_history_list) (NautilusViewFrame *view); } NautilusViewFrameClass; /* basic view management */ @@ -140,7 +139,6 @@ char * nautilus_view_frame_get_label (NautilusVie void nautilus_view_frame_set_label (NautilusViewFrame *view, const char *label); void nautilus_view_frame_activate (NautilusViewFrame *view); -Nautilus_HistoryList *nautilus_view_frame_get_history_list (NautilusViewFrame *view); /* view state */ char * nautilus_view_frame_get_title (NautilusViewFrame *view); diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index e54b9e923..3e65c3855 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -1692,11 +1692,11 @@ zoom_parameters_changed_callback (NautilusViewFrame *view, } -static Nautilus_HistoryList * +static Nautilus_History * get_history_list_callback (NautilusViewFrame *view, NautilusWindow *window) { - Nautilus_HistoryList *list; + Nautilus_History *list; NautilusBookmark *bookmark; int length, i; GList *node; @@ -1706,7 +1706,7 @@ get_history_list_callback (NautilusViewFrame *view, /* Get total number of history items */ length = g_list_length (nautilus_get_history_list ()); - list = Nautilus_HistoryList__alloc (); + list = Nautilus_History__alloc (); list->_length = length; list->_maximum = length; diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index 3f511e3f4..b4659121f 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -1112,7 +1112,7 @@ nautilus_window_initialize_go_menu (NautilusWindow *window) /* Recreate bookmarks part of menu if history list changes * or if icon theme changes. */ - gtk_signal_connect_object_while_alive (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_connect_object_while_alive (nautilus_signaller_get_current (), "history_list_changed", schedule_refresh_go_menu, GTK_OBJECT (window)); @@ -1121,7 +1121,6 @@ nautilus_window_initialize_go_menu (NautilusWindow *window) "icons_changed", schedule_refresh_go_menu, GTK_OBJECT (window)); - } /* handler to receive the user_level_changed signal, so we can update the menu and dialog diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 58e076e0d..3818e746c 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1318,7 +1318,7 @@ nautilus_window_allow_stop (NautilusWindow *window, gboolean allow) void nautilus_send_history_list_changed (void) { - gtk_signal_emit_by_name (GTK_OBJECT (nautilus_signaller_get_current ()), + gtk_signal_emit_by_name (nautilus_signaller_get_current (), "history_list_changed"); } |