diff --git a/thunar/thunar-abstract-icon-view.c b/thunar/thunar-abstract-icon-view.c index b3c3a5262610d7e51c9aa2f170dfc9ae8b05d515..5c4b178f6c93615c34d1f6f7abb3d085b3fe6c22 100644 --- a/thunar/thunar-abstract-icon-view.c +++ b/thunar/thunar-abstract-icon-view.c @@ -80,6 +80,7 @@ static void thunar_abstract_icon_view_item_activated (ExoIconVi GtkTreePath *path, ThunarAbstractIconView *abstract_icon_view); static void thunar_abstract_icon_view_zoom_level_changed (ThunarAbstractIconView *abstract_icon_view); +static void thunar_abstract_icon_view_queue_redraw (ThunarStandardView *standard_view); @@ -122,6 +123,7 @@ thunar_abstract_icon_view_class_init (ThunarAbstractIconViewClass *klass) thunarstandard_view_class->get_path_at_pos = thunar_abstract_icon_view_get_path_at_pos; thunarstandard_view_class->get_visible_range = thunar_abstract_icon_view_get_visible_range; thunarstandard_view_class->highlight_path = thunar_abstract_icon_view_highlight_path; + thunarstandard_view_class->queue_redraw = thunar_abstract_icon_view_queue_redraw; /** * ThunarAbstractIconView:column-spacing: @@ -665,3 +667,12 @@ thunar_abstract_icon_view_zoom_level_changed (ThunarAbstractIconView *abstract_i THUNAR_STANDARD_VIEW_GET_CLASS (abstract_icon_view)->cell_layout_data_func, NULL, NULL); } + + + +static void +thunar_abstract_icon_view_queue_redraw (ThunarStandardView *standard_view) +{ + _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (standard_view)); + gtk_widget_queue_draw (gtk_bin_get_child (GTK_BIN (standard_view))); +} diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c index 97ac90d65e7d4709694e662f329e45e2edcbf3e0..464b8b8824ffd406ad5cb7702ada5367c287a874 100644 --- a/thunar/thunar-details-view.c +++ b/thunar/thunar-details-view.c @@ -113,6 +113,7 @@ static void thunar_details_view_append_menu_items (ThunarStandardV GtkMenu *menu, GtkAccelGroup *accel_group); static void thunar_details_view_highlight_option_changed(ThunarDetailsView *details_view); +static void thunar_details_view_queue_redraw (ThunarStandardView *standard_view); @@ -143,6 +144,8 @@ struct _ThunarDetailsView guint idle_id; GtkCellRenderer *renderers[THUNAR_N_VISIBLE_COLUMNS]; + + ExoTreeView *tree_view; }; @@ -189,6 +192,7 @@ thunar_details_view_class_init (ThunarDetailsViewClass *klass) thunarstandard_view_class->append_menu_items = thunar_details_view_append_menu_items; thunarstandard_view_class->connect_accelerators = thunar_details_view_connect_accelerators; thunarstandard_view_class->disconnect_accelerators = thunar_details_view_disconnect_accelerators; + thunarstandard_view_class->queue_redraw = thunar_details_view_queue_redraw; thunarstandard_view_class->zoom_level_property_name = "last-details-view-zoom-level"; xfce_gtk_translate_action_entries (thunar_details_view_action_entries, G_N_ELEMENTS (thunar_details_view_action_entries)); @@ -217,7 +221,6 @@ thunar_details_view_init (ThunarDetailsView *details_view) GtkCellRenderer *left_aligned_renderer; GtkCellRenderer *renderer; ThunarColumn column; - GtkWidget *tree_view; /* we need to force the GtkTreeView to recalculate column sizes * whenever the zoom-level changes, so we connect a handler here. @@ -225,25 +228,25 @@ thunar_details_view_init (ThunarDetailsView *details_view) g_signal_connect (G_OBJECT (details_view), "notify::zoom-level", G_CALLBACK (thunar_details_view_zoom_level_changed), NULL); /* create the tree view to embed */ - tree_view = exo_tree_view_new (); - g_signal_connect (G_OBJECT (tree_view), "notify::model", + details_view->tree_view = EXO_TREE_VIEW (exo_tree_view_new ()); + g_signal_connect (G_OBJECT (details_view->tree_view), "notify::model", G_CALLBACK (thunar_details_view_notify_model), details_view); - g_signal_connect (G_OBJECT (tree_view), "button-press-event", + g_signal_connect (G_OBJECT (details_view->tree_view), "button-press-event", G_CALLBACK (thunar_details_view_button_press_event), details_view); - g_signal_connect (G_OBJECT (tree_view), "key-press-event", + g_signal_connect (G_OBJECT (details_view->tree_view), "key-press-event", G_CALLBACK (thunar_details_view_key_press_event), details_view); - g_signal_connect (G_OBJECT (tree_view), "row-activated", + g_signal_connect (G_OBJECT (details_view->tree_view), "row-activated", G_CALLBACK (thunar_details_view_row_activated), details_view); - g_signal_connect (G_OBJECT (tree_view), "select-cursor-row", + g_signal_connect (G_OBJECT (details_view->tree_view), "select-cursor-row", G_CALLBACK (thunar_details_view_select_cursor_row), details_view); - gtk_container_add (GTK_CONTAINER (details_view), tree_view); - gtk_widget_show (tree_view); + gtk_container_add (GTK_CONTAINER (details_view), GTK_WIDGET (details_view->tree_view)); + gtk_widget_show (GTK_WIDGET (details_view->tree_view)); /* configure general aspects of the details view */ - gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree_view), TRUE); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (details_view->tree_view), TRUE); /* enable rubberbanding (if supported) */ - gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (tree_view), TRUE); + gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (details_view->tree_view), TRUE); /* connect to the default column model */ details_view->column_model = thunar_column_model_get_default (); @@ -318,11 +321,11 @@ thunar_details_view_init (ThunarDetailsView *details_view) } /* append the tree view column to the tree view */ - gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), details_view->columns[column]); + gtk_tree_view_append_column (GTK_TREE_VIEW (details_view->tree_view), details_view->columns[column]); } /* configure the tree selection */ - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (details_view->tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); g_signal_connect_swapped (G_OBJECT (selection), "changed", G_CALLBACK (thunar_standard_view_selection_changed), details_view); @@ -1201,3 +1204,15 @@ thunar_details_view_highlight_option_changed (ThunarDetailsView *details_view) function, NULL, NULL); } } + + + +static void +thunar_details_view_queue_redraw (ThunarStandardView *standard_view) +{ + ThunarDetailsView *details_view = THUNAR_DETAILS_VIEW (standard_view); + + _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view)); + + gtk_widget_queue_draw (GTK_WIDGET (details_view->tree_view)); +} diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 0c81699ccbdff028963013e5ccad93780a52c9e3..f48bd67b9cb4c02dec5bcc45f88dda4188291919 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -4603,6 +4603,15 @@ thunar_standard_view_get_action_entries (void) +void +thunar_standard_view_queue_redraw (ThunarStandardView *standard_view) +{ + _thunar_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); + (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->queue_redraw) (standard_view); +} + + + static void thunar_standard_view_highlight_option_changed (ThunarStandardView *standard_view) { diff --git a/thunar/thunar-standard-view.h b/thunar/thunar-standard-view.h index 96ec470d83dee1a2b88fbb983e68726f84760fec..349dc4fec0dcdcfd67ccf26072e8e1e935171eab 100644 --- a/thunar/thunar-standard-view.h +++ b/thunar/thunar-standard-view.h @@ -143,6 +143,8 @@ struct _ThunarStandardViewClass GtkTreeIter *iter, gpointer data); + void (*queue_redraw) (ThunarStandardView *standard_view); + /* The name of the property in ThunarPreferences, that determines * the last (and default) zoom-level for the view classes (i.e. in * case of ThunarIconView, this is "last-icon-view-zoom-level"). @@ -201,6 +203,8 @@ GType thunar_standard_view_get_saved_view_type (ThunarStandardVi XfceGtkActionEntry *thunar_standard_view_get_action_entries (void); +void thunar_standard_view_queue_redraw (ThunarStandardView *standard_view); + G_END_DECLS; diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 127c2fb37d2eb3613f2b06b218b5766bbc880608..3ab86638990fa2813efd20b688cec65ece634da2 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -2013,10 +2013,10 @@ thunar_window_clipboard_manager_changed (GtkWidget *widget) ThunarWindow *window = THUNAR_WINDOW (widget); /* check if the content actually can be pasted into thunar, - * in order to do not trigger if just some text is copied. + * in order to do not redraw the view if just some text is copied. */ - if (thunar_clipboard_manager_get_can_paste (window->clipboard)) - thunar_window_reload (window, FALSE); + if (thunar_clipboard_manager_get_can_paste (window->clipboard) && G_LIKELY (window->view != NULL)) + thunar_standard_view_queue_redraw (THUNAR_STANDARD_VIEW (window->view)); }