diff options
author | Carlos Soriano <csoriano@gnome.org> | 2017-03-29 13:39:48 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2017-04-22 17:16:24 +0200 |
commit | 8d6c3591d13ed35b9c673fdd9af35721a0d617ed (patch) | |
tree | 82eeec1ff0e6fc9b7ea078f44cbe1142db12b34b | |
parent | cc9511bb18975dde0ea806395d02b8e60176923f (diff) | |
download | nautilus-8d6c3591d13ed35b9c673fdd9af35721a0d617ed.tar.gz |
pathbar: Remove dnd handling
So users can drag the window from the buttons of the pathbar too, as it
seems it's more important feature for them instead of dnd the path in
the pathbar, which is also quite undiscoverable.
https://bugzilla.gnome.org/show_bug.cgi?id=776663
-rw-r--r-- | src/nautilus-pathbar.c | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c index 35eaf30d0..b5e0d653b 100644 --- a/src/nautilus-pathbar.c +++ b/src/nautilus-pathbar.c @@ -94,9 +94,6 @@ struct _NautilusPathBarDetails guint need_timer : 1; guint ignore_click : 1; - unsigned int drag_slider_timeout; - gboolean drag_slider_timeout_for_up_button; - GActionGroup *action_group; GMenu *context_menu; @@ -229,76 +226,6 @@ get_slider_button (NautilusPathBar *path_bar, return button; } -static gboolean -slider_timeout (gpointer user_data) -{ - NautilusPathBar *path_bar; - - path_bar = NAUTILUS_PATH_BAR (user_data); - - path_bar->priv->drag_slider_timeout = 0; - - if (gtk_widget_get_visible (GTK_WIDGET (path_bar))) - { - if (path_bar->priv->drag_slider_timeout_for_up_button) - { - nautilus_path_bar_scroll_up (path_bar); - } - else - { - nautilus_path_bar_scroll_down (path_bar); - } - } - - return FALSE; -} - -static void -nautilus_path_bar_slider_drag_motion (GtkWidget *widget, - GdkDragContext *context, - int x, - int y, - unsigned int time, - gpointer user_data) -{ - NautilusPathBar *path_bar; - GtkSettings *settings; - unsigned int timeout; - - path_bar = NAUTILUS_PATH_BAR (user_data); - - if (path_bar->priv->drag_slider_timeout == 0) - { - settings = gtk_widget_get_settings (widget); - - g_object_get (settings, "gtk-timeout-expand", &timeout, NULL); - path_bar->priv->drag_slider_timeout = - g_timeout_add (timeout, - slider_timeout, - path_bar); - - path_bar->priv->drag_slider_timeout_for_up_button = - widget == path_bar->priv->up_slider_button; - } -} - -static void -nautilus_path_bar_slider_drag_leave (GtkWidget *widget, - GdkDragContext *context, - unsigned int time, - gpointer user_data) -{ - NautilusPathBar *path_bar; - - path_bar = NAUTILUS_PATH_BAR (user_data); - - if (path_bar->priv->drag_slider_timeout != 0) - { - g_source_remove (path_bar->priv->drag_slider_timeout); - path_bar->priv->drag_slider_timeout = 0; - } -} - static void nautilus_path_bar_init (NautilusPathBar *path_bar) { @@ -339,30 +266,6 @@ nautilus_path_bar_init (NautilusPathBar *path_bar) g_signal_connect (path_bar->priv->down_slider_button, "button-press-event", G_CALLBACK (nautilus_path_bar_slider_button_press), path_bar); g_signal_connect (path_bar->priv->down_slider_button, "button-release-event", G_CALLBACK (nautilus_path_bar_slider_button_release), path_bar); - gtk_drag_dest_set (GTK_WIDGET (path_bar->priv->up_slider_button), - 0, NULL, 0, 0); - gtk_drag_dest_set_track_motion (GTK_WIDGET (path_bar->priv->up_slider_button), TRUE); - g_signal_connect (path_bar->priv->up_slider_button, - "drag-motion", - G_CALLBACK (nautilus_path_bar_slider_drag_motion), - path_bar); - g_signal_connect (path_bar->priv->up_slider_button, - "drag-leave", - G_CALLBACK (nautilus_path_bar_slider_drag_leave), - path_bar); - - gtk_drag_dest_set (GTK_WIDGET (path_bar->priv->down_slider_button), - 0, NULL, 0, 0); - gtk_drag_dest_set_track_motion (GTK_WIDGET (path_bar->priv->down_slider_button), TRUE); - g_signal_connect (path_bar->priv->down_slider_button, - "drag-motion", - G_CALLBACK (nautilus_path_bar_slider_drag_motion), - path_bar); - g_signal_connect (path_bar->priv->down_slider_button, - "drag-leave", - G_CALLBACK (nautilus_path_bar_slider_drag_leave), - path_bar); - gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar)), GTK_STYLE_CLASS_LINKED); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (path_bar)), @@ -378,12 +281,6 @@ nautilus_path_bar_finalize (GObject *object) nautilus_path_bar_stop_scrolling (path_bar); - if (path_bar->priv->drag_slider_timeout != 0) - { - g_source_remove (path_bar->priv->drag_slider_timeout); - path_bar->priv->drag_slider_timeout = 0; - } - g_list_free (path_bar->priv->button_list); unschedule_pop_up_context_menu (NAUTILUS_PATH_BAR (object)); @@ -1666,15 +1563,6 @@ button_event_cb (GtkWidget *button, return FALSE; } -static void -button_drag_begin_cb (GtkWidget *widget, - GdkDragContext *drag_context, - gpointer user_data) -{ - g_object_set_data (G_OBJECT (widget), "handle-button-release", - GINT_TO_POINTER (FALSE)); -} - static GIcon * get_gicon_for_mount (ButtonData *button_data) { @@ -1839,66 +1727,6 @@ setup_button_type (ButtonData *button_data, } static void -button_drag_data_get_cb (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time_, - gpointer user_data) -{ - ButtonData *button_data; - char *uri_list[2]; - char *tmp; - - button_data = user_data; - - uri_list[0] = g_file_get_uri (button_data->path); - uri_list[1] = NULL; - - if (info == NAUTILUS_ICON_DND_GNOME_ICON_LIST) - { - tmp = g_strdup_printf ("%s\r\n", uri_list[0]); - gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), - 8, (const guchar *) tmp, strlen (tmp)); - g_free (tmp); - } - else if (info == NAUTILUS_ICON_DND_URI_LIST) - { - gtk_selection_data_set_uris (selection_data, uri_list); - } - - g_free (uri_list[0]); -} - -static void -setup_button_drag_source (ButtonData *button_data) -{ - GtkTargetList *target_list; - const GtkTargetEntry targets[] = - { - { NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST } - }; - - gtk_drag_source_set (button_data->button, - GDK_BUTTON1_MASK | - GDK_BUTTON2_MASK, - NULL, 0, - GDK_ACTION_MOVE | - GDK_ACTION_COPY | - GDK_ACTION_LINK | - GDK_ACTION_ASK); - - target_list = gtk_target_list_new (targets, G_N_ELEMENTS (targets)); - gtk_target_list_add_uri_targets (target_list, NAUTILUS_ICON_DND_URI_LIST); - gtk_drag_source_set_target_list (button_data->button, target_list); - gtk_target_list_unref (target_list); - - g_signal_connect (button_data->button, "drag-data-get", - G_CALLBACK (button_drag_data_get_cb), - button_data); -} - -static void button_data_file_changed (NautilusFile *file, ButtonData *button_data) { @@ -2109,13 +1937,8 @@ make_button_data (NautilusPathBar *path_bar, g_signal_connect (button_data->button, "clicked", G_CALLBACK (button_clicked_cb), button_data); g_signal_connect (button_data->button, "button-press-event", G_CALLBACK (button_event_cb), button_data); g_signal_connect (button_data->button, "button-release-event", G_CALLBACK (button_event_cb), button_data); - g_signal_connect (button_data->button, "drag-begin", G_CALLBACK (button_drag_begin_cb), button_data); g_object_weak_ref (G_OBJECT (button_data->button), (GWeakNotify) button_data_free, button_data); - setup_button_drag_source (button_data); - - nautilus_drag_slot_proxy_init (button_data->button, button_data->file, NULL); - g_object_unref (path); return button_data; |