[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 295/473: Prevent dragging search actions.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:57:45 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit bbeb4285b21865fc4c8d260257338d1fb80d8722
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Dec 12 09:48:01 2013 -0500

    Prevent dragging search actions.
---
 panel-plugin/launcher-view.cpp |   15 +++++++++++++--
 panel-plugin/launcher-view.h   |    2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/launcher-view.cpp b/panel-plugin/launcher-view.cpp
index d33b17e..11ae54b 100644
--- a/panel-plugin/launcher-view.cpp
+++ b/panel-plugin/launcher-view.cpp
@@ -45,7 +45,9 @@ LauncherView::LauncherView(Window* window) :
 	m_model(NULL),
 	m_icon_size(0),
 	m_pressed_launcher(NULL),
-	m_launcher_dragged(false)
+	m_drag_enabled(true),
+	m_launcher_dragged(false),
+	m_reorderable(false)
 {
 	// Create the view
 	m_view = GTK_TREE_VIEW(exo_tree_view_new());
@@ -145,7 +147,8 @@ void LauncherView::set_fixed_height_mode(bool fixed_height)
 
 void LauncherView::set_reorderable(bool reorderable)
 {
-	if (reorderable)
+	m_reorderable = reorderable;
+	if (m_reorderable)
 	{
 		const GtkTargetEntry row_targets[] = {
 			{ g_strdup("GTK_TREE_MODEL_ROW"), GTK_TARGET_SAME_WIDGET, 0 },
@@ -297,6 +300,14 @@ gboolean LauncherView::on_button_press_event(GtkWidget*, GdkEventButton* event)
 	if (m_pressed_launcher->get_type() != Launcher::Type)
 	{
 		m_pressed_launcher = NULL;
+		m_drag_enabled = false;
+		gtk_tree_view_unset_rows_drag_source(m_view);
+		gtk_tree_view_unset_rows_drag_dest(m_view);
+	}
+	else if (!m_drag_enabled)
+	{
+		m_drag_enabled = true;
+		set_reorderable(m_reorderable);
 	}
 
 	return false;
diff --git a/panel-plugin/launcher-view.h b/panel-plugin/launcher-view.h
index 3ee6258..c8dbc5c 100644
--- a/panel-plugin/launcher-view.h
+++ b/panel-plugin/launcher-view.h
@@ -86,7 +86,9 @@ private:
 	int m_icon_size;
 
 	Launcher* m_pressed_launcher;
+	bool m_drag_enabled;
 	bool m_launcher_dragged;
+	bool m_reorderable;
 };
 
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list