summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-icon-container.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-01-04 02:15:56 +0000
committerDarin Adler <darin@src.gnome.org>2001-01-04 02:15:56 +0000
commitf683ed7935cfb180946c4fb0b39edc6311ee25a1 (patch)
treef8867c5d687389a9b5db11295897b0fa76913bba /libnautilus-private/nautilus-icon-container.c
parentec540c3e648e4a0b71eebff5e767c3c233de6841 (diff)
downloadnautilus-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.
Diffstat (limited to 'libnautilus-private/nautilus-icon-container.c')
-rw-r--r--libnautilus-private/nautilus-icon-container.c74
1 files changed, 40 insertions, 34 deletions
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;