[maemo-commits] [maemo-commits] r12686 - in projects/haf/trunk/hildon-desktop: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Jul 9 11:16:43 EEST 2007
- Previous message: [maemo-commits] r12685 - projects/haf/tags/osso-gnome-vfs2
- Next message: [maemo-commits] r12687 - in projects/haf/trunk/hildon-desktop: . data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2007-07-09 11:16:42 +0300 (Mon, 09 Jul 2007) New Revision: 12686 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c Log: 2007-07-09 Johan Bilien <johan.bilien at nokia.com> * src/hd-app-menu-tree.c: added "drag-motion" handler for both trees Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-07-06 15:26:39 UTC (rev 12685) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-07-09 08:16:42 UTC (rev 12686) @@ -1,3 +1,8 @@ +2007-07-09 Johan Bilien <johan.bilien at nokia.com> + + * src/hd-app-menu-tree.c: added "drag-motion" handler + for both trees + 2007-07-06 Johan Bilien <johan.bilien at nokia.com> * libhildondesktop/hd-app-menu-tree.[ch]: Modified: projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c 2007-07-06 15:26:39 UTC (rev 12685) +++ projects/haf/trunk/hildon-desktop/src/hd-app-menu-tree.c 2007-07-09 08:16:42 UTC (rev 12686) @@ -81,6 +81,20 @@ gint y, GtkSelectionData *data); +static gboolean +hd_app_menu_tree_content_drag_motion (HDAppMenuTree *tree, + GdkDragContext *context, + gint x, + gint y, + guint time); + +static gboolean +hd_app_menu_tree_navigation_drag_motion (HDAppMenuTree *tree, + GdkDragContext *context, + gint x, + gint y, + guint time); + struct _HDAppMenuTreePrivate { GtkTreeModel *model, *navigation_model, *content_model; @@ -204,6 +218,9 @@ 1, GDK_ACTION_MOVE); + g_signal_connect_swapped (priv->navigation_pane, "drag-motion", + G_CALLBACK (hd_app_menu_tree_navigation_drag_motion), + object); g_signal_connect_swapped (priv->navigation_pane, "drag-data-received", G_CALLBACK (hd_app_menu_tree_navigation_drag_received), object); @@ -259,6 +276,10 @@ G_CALLBACK (hd_app_menu_tree_content_drag_received), object); + g_signal_connect_swapped (priv->content_pane, "drag-motion", + G_CALLBACK (hd_app_menu_tree_content_drag_motion), + object); + g_signal_connect_swapped (priv->content_pane, "cursor-changed", G_CALLBACK (hd_app_menu_tree_content_changed), object); @@ -614,6 +635,145 @@ } } +static gboolean +hd_app_menu_tree_content_drag_motion (HDAppMenuTree *tree, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + HDAppMenuTreePrivate *priv = tree->priv; + GtkWidget *drag_source; + + drag_source = gtk_drag_get_source_widget (context); + + + if (drag_source == priv->content_pane) + { + GtkTreeViewDropPosition pos; + GtkTreePath *path; + + GTK_WIDGET_CLASS (GTK_TREE_VIEW_GET_CLASS (priv->content_pane))-> + drag_motion (priv->content_pane, + context, + x, y, + time); + + gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (priv->content_pane), + &path, + &pos); + + if (path) + { + if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->content_pane), + path, + GTK_TREE_VIEW_DROP_BEFORE); + + } + else if (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->content_pane), + path, + GTK_TREE_VIEW_DROP_AFTER); + } + + gtk_tree_path_free( path ); + } + } + + else if (drag_source == priv->navigation_pane) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->content_pane), + NULL, + 0); + gdk_drag_status( context, 0, time ); + } + + return TRUE; +} +static gboolean +hd_app_menu_tree_navigation_drag_motion (HDAppMenuTree *tree, + GdkDragContext *context, + gint x, + gint y, + guint time) +{ + HDAppMenuTreePrivate *priv = tree->priv; + GtkWidget *drag_source; + gboolean valid_location; + + drag_source = gtk_drag_get_source_widget (context); + + valid_location = + GTK_WIDGET_CLASS (GTK_TREE_VIEW_GET_CLASS (priv->navigation_pane))-> + drag_motion (priv->navigation_pane, + context, + x, y, + time); + + if (drag_source == priv->content_pane) + { + GtkTreeViewDropPosition pos; + GtkTreePath *path; + + gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + &path, + &pos); + + if (path) + { + if (pos == GTK_TREE_VIEW_DROP_BEFORE) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + path, + GTK_TREE_VIEW_DROP_INTO_OR_BEFORE); + + } + else if (pos == GTK_TREE_VIEW_DROP_AFTER) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + path, + GTK_TREE_VIEW_DROP_INTO_OR_AFTER); + } + + gtk_tree_path_free( path ); + } + } + + else if (drag_source == priv->navigation_pane) + { + GtkTreeViewDropPosition pos; + GtkTreePath *path; + + gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + &path, + &pos); + + if (path) + { + if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + path, + GTK_TREE_VIEW_DROP_BEFORE); + + } + else if (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER) + { + gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (priv->navigation_pane), + path, + GTK_TREE_VIEW_DROP_AFTER); + } + + gtk_tree_path_free( path ); + } + } + + return valid_location; +} + void hd_app_menu_tree_set_model (HDAppMenuTree *tree, GtkTreeModel *model) {
- Previous message: [maemo-commits] r12685 - projects/haf/tags/osso-gnome-vfs2
- Next message: [maemo-commits] r12687 - in projects/haf/trunk/hildon-desktop: . data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]