diff options
author | Alexander Larsson <alexl@redhat.com> | 2006-10-18 13:20:44 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2006-10-18 13:20:44 +0000 |
commit | b5023c72f73e2ab8354892c4d1799597a50b6e25 (patch) | |
tree | a18c8406cda5282daba28439c22812020f5a812c /src | |
parent | 3545f9b059824077fd84a55b5d54372d7a92ea31 (diff) | |
download | nautilus-b5023c72f73e2ab8354892c4d1799597a50b6e25.tar.gz |
Share target list for all instances (#357573)
2006-10-18 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-list-view.c:
Share target list for all instances (#357573)
* src/nautilus-location-bar.c: (style_set_handler):
Don't leak layout (#352693)
* src/nautilus-zoom-control.c:
Fix O(n^2) use of list (#357589)
All patches from paolo borelli.
Diffstat (limited to 'src')
-rw-r--r-- | src/file-manager/fm-list-view.c | 27 | ||||
-rw-r--r-- | src/nautilus-location-bar.c | 2 | ||||
-rw-r--r-- | src/nautilus-zoom-control.c | 4 |
3 files changed, 18 insertions, 15 deletions
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index c0d0027c1..dcd4d67cf 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -86,8 +86,6 @@ struct FMListViewDetails { NautilusTreeViewDragDest *drag_dest; - GtkTargetList *source_target_list; - GtkTreePath *double_click_path[2]; /* Both clicks in a double click need to be on the same row */ GtkTreePath *new_selection_path; /* Path of the new selection after removing a file */ @@ -142,6 +140,8 @@ static GList * default_visible_columns_auto_value; static GList * default_column_order_auto_value; static GdkCursor * hand_cursor = NULL; +static GtkTargetList * source_target_list = NULL; + static GList *fm_list_view_get_selection (FMDirectoryView *view); static GList *fm_list_view_get_selection_for_file_transfer (FMDirectoryView *view); static void fm_list_view_set_zoom_level (FMListView *view, @@ -487,6 +487,17 @@ motion_notify_callback (GtkWidget *widget, } if (view->details->drag_button != 0) { + if (!source_target_list) { + const GtkTargetEntry *drag_types; + int n_drag_types; + + fm_list_model_get_drag_types (&drag_types, + &n_drag_types); + + source_target_list = gtk_target_list_new (drag_types, + n_drag_types); + } + if (gtk_drag_check_threshold (widget, view->details->drag_x, view->details->drag_y, @@ -494,7 +505,7 @@ motion_notify_callback (GtkWidget *widget, event->y)) { context = gtk_drag_begin (widget, - view->details->source_target_list, + source_target_list, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK, view->details->drag_button, (GdkEvent*)event); @@ -1188,10 +1199,8 @@ create_and_set_up_tree_view (FMListView *view) { GtkCellRenderer *cell; GtkTreeViewColumn *column; - const GtkTargetEntry *drag_types; GtkBindingSet *binding_set; AtkObject *atk_obj; - int num_drag_types; GList *nautilus_columns; GList *l; @@ -1206,8 +1215,6 @@ create_and_set_up_tree_view (FMListView *view) binding_set = gtk_binding_set_by_class (GTK_WIDGET_GET_CLASS (view->details->tree_view)); gtk_binding_entry_clear (binding_set, GDK_BackSpace, 0); - fm_list_model_get_drag_types (&drag_types, &num_drag_types); - view->details->drag_dest = nautilus_tree_view_drag_dest_new (view->details->tree_view); @@ -1271,10 +1278,6 @@ create_and_set_up_tree_view (FMListView *view) g_signal_connect_object (view->details->model, "subdirectory_unloaded", G_CALLBACK (subdirectory_unloaded_callback), view, 0); - view->details->source_target_list = - gtk_target_list_new (drag_types, num_drag_types); - - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view->details->tree_view), GTK_SELECTION_MULTIPLE); gtk_tree_view_set_rules_hint (view->details->tree_view, TRUE); @@ -2461,8 +2464,6 @@ fm_list_view_finalize (GObject *object) if (list_view->details->new_selection_path) { gtk_tree_path_free (list_view->details->new_selection_path); } - - gtk_target_list_unref (list_view->details->source_target_list); g_list_free (list_view->details->cells); g_hash_table_destroy (list_view->details->columns); diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c index e7c9c0fd2..8efd711a7 100644 --- a/src/nautilus-location-bar.c +++ b/src/nautilus-location-bar.c @@ -250,6 +250,8 @@ style_set_handler (GtkWidget *widget, GtkStyle *previous_style) width += 2 * GTK_MISC (widget)->xpad; gtk_widget_set_size_request (widget, width, -1); + + g_object_unref (layout); } static gboolean diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c index 7ea1b5dcb..a7c2eebae 100644 --- a/src/nautilus-zoom-control.c +++ b/src/nautilus-zoom-control.c @@ -210,8 +210,8 @@ nautilus_zoom_control_instance_init (NautilusZoomControl *zoom_control) zoom_control->details->has_min_zoom_level = TRUE; zoom_control->details->has_max_zoom_level = TRUE; - for (i = NAUTILUS_ZOOM_LEVEL_SMALLEST; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) { - zoom_control->details->preferred_zoom_levels = g_list_append ( + for (i = NAUTILUS_ZOOM_LEVEL_LARGEST; i >= NAUTILUS_ZOOM_LEVEL_SMALLEST; i--) { + zoom_control->details->preferred_zoom_levels = g_list_prepend ( zoom_control->details->preferred_zoom_levels, GINT_TO_POINTER (i)); } |