[gtk+/wip/csoriano/bookmarks: 4/5] gtkfilechooserwidget: show drop hints on gtkplacessidebar



commit 54212da6a9a847d71a411e2a0b5489ad4a958054
Author: Carlos Soriano <csoriano gnome org>
Date:   Sat Apr 11 17:36:41 2015 +0200

    gtkfilechooserwidget: show drop hints on gtkplacessidebar
    
    Now with the API addition on gtkplacessidebar, we can show some
    hints for the drop targets.

 gtk/gtkfilechooserwidget.c     |   21 +++++++++++++++++++++
 gtk/ui/gtkfilechooserwidget.ui |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 9daf923..2583c9e 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -1648,6 +1648,14 @@ file_list_drag_drop_cb (GtkWidget             *widget,
   return TRUE;
 }
 
+static void
+file_list_drag_begin_cb (GtkWidget            *widget,
+                         GdkDragContext       *context,
+                         GtkFileChooserWidget *impl)
+{
+  gtk_places_sidebar_emulate_dragging_start (GTK_PLACES_SIDEBAR (impl->priv->places_sidebar));
+}
+
 /* Disable the normal tree drag motion handler, it makes it look like you're
    dropping the dragged item onto a tree item */
 static gboolean
@@ -1662,6 +1670,17 @@ file_list_drag_motion_cb (GtkWidget             *widget,
   return TRUE;
 }
 
+static void
+file_list_drag_end_cb (GtkWidget      *widget,
+                       GdkDragContext *context,
+                       gpointer        user_data)
+{
+  GtkFileChooserWidget *impl;
+
+  impl = GTK_FILE_CHOOSER_WIDGET (user_data);
+  gtk_places_sidebar_emulate_dragging_stop (GTK_PLACES_SIDEBAR (impl->priv->places_sidebar));
+}
+
 /* Sensitizes the "Copy file’s location" and other context menu items if there is actually
  * a selection active.
  */
@@ -7510,7 +7529,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
   gtk_widget_class_bind_template_callback (widget_class, file_list_query_tooltip_cb);
   gtk_widget_class_bind_template_callback (widget_class, list_button_press_event_cb);
   gtk_widget_class_bind_template_callback (widget_class, list_row_activated);
+  gtk_widget_class_bind_template_callback (widget_class, file_list_drag_begin_cb);
   gtk_widget_class_bind_template_callback (widget_class, file_list_drag_motion_cb);
+  gtk_widget_class_bind_template_callback (widget_class, file_list_drag_end_cb);
   gtk_widget_class_bind_template_callback (widget_class, list_selection_changed);
   gtk_widget_class_bind_template_callback (widget_class, list_cursor_changed);
   gtk_widget_class_bind_template_callback (widget_class, filter_combo_changed);
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 9f0c455..ca8c21d 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -193,7 +193,9 @@
                             <signal name="button-press-event" handler="list_button_press_event_cb" 
swapped="no"/>
                             <signal name="drag-data-received" handler="file_list_drag_data_received_cb" 
swapped="no"/>
                             <signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/>
+                            <signal name="drag-begin" handler="file_list_drag_begin_cb" swapped="no"/>
                             <signal name="drag-motion" handler="file_list_drag_motion_cb" swapped="no"/>
+                            <signal name="drag-end" handler="file_list_drag_end_cb" swapped="no"/>
                             <signal name="key-press-event" handler="browse_files_key_press_event_cb" 
swapped="no"/>
                             <signal name="popup-menu" handler="list_popup_menu_cb" swapped="no"/>
                             <signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]