[Xfce4-commits] r24289 - squeeze/trunk/src

Peter de Ridder peter at xfce.org
Sun Jan 7 17:36:24 CET 2007


Author: peter
Date: 2007-01-07 16:36:24 +0000 (Sun, 07 Jan 2007)
New Revision: 24289

Added:
   squeeze/trunk/src/button_drag_box.c
   squeeze/trunk/src/button_drag_box.h
Modified:
   squeeze/trunk/src/Makefile.am
   squeeze/trunk/src/preferences_dialog.c
Log:
a button_drag_box, you can drag buttons now :)



Modified: squeeze/trunk/src/Makefile.am
===================================================================
--- squeeze/trunk/src/Makefile.am	2007-01-07 16:27:52 UTC (rev 24288)
+++ squeeze/trunk/src/Makefile.am	2007-01-07 16:36:24 UTC (rev 24289)
@@ -28,7 +28,8 @@
 	new_dialog.c new_dialog.h \
 	add_dialog.c add_dialog.h \
 	extract_dialog.c extract_dialog.h \
-	widget_factory.c widget_factory.h
+	widget_factory.c widget_factory.h \
+	button_drag_box.c button_drag_box.h
 
 squeeze_CFLAGS = \
 	@GTK_CFLAGS@ \

Added: squeeze/trunk/src/button_drag_box.c
===================================================================
--- squeeze/trunk/src/button_drag_box.c	                        (rev 0)
+++ squeeze/trunk/src/button_drag_box.c	2007-01-07 16:36:24 UTC (rev 24289)
@@ -0,0 +1,349 @@
+/*
+ *  Copyright (c) 2006 Stephan Arts <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <thunar-vfs/thunar-vfs.h>
+#include <libsqueeze/libsqueeze.h>
+#include "archive_store.h"
+#include "button_drag_box.h"
+
+#define SQ_INDICATOR_SIZE 9
+
+static void
+sq_button_drag_box_add_fixed_button(SQButtonDragBox *box, const gchar *label);
+
+static void
+sq_button_drag_box_add_button(SQButtonDragBox *box, const gchar *label, gboolean visible);
+
+static GdkPixbuf*
+sq_create_icon_from_widget(GtkWidget *widget);
+
+static gboolean
+cb_signal_blocker(GtkWidget *widget, gpointer user_data);
+
+static void
+cb_sq_button_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data);
+
+static void
+cb_sq_button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer user_data);
+
+static void
+cb_sq_button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data);
+
+static void
+cb_sq_visible_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint infom, guint time, gpointer user_data);
+
+static gboolean
+cb_sq_visible_drag_motion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data);
+
+static void
+cb_sq_visible_drag_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer user_data);
+
+static void
+cb_sq_hidden_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint infom, guint time, gpointer user_data);
+
+G_DEFINE_TYPE (SQButtonDragBox, sq_button_drag_box, GTK_TYPE_VBOX)
+
+static void
+sq_button_drag_box_class_init(SQButtonDragBoxClass *button_drag_box_class)
+{
+}
+
+static void
+sq_button_drag_box_init(SQButtonDragBox *box)
+{
+	GtkWidget *frame;
+
+	box->visible_box = gtk_hbox_new(FALSE, 0);
+	box->hidden_box = gtk_hbox_new(FALSE, 0);
+
+	box->entry.target = "_SQ_BUTTON_DRAG_BOX";
+	box->entry.flags = GTK_TARGET_SAME_APP;
+	box->entry.info = 2;
+
+	frame = gtk_frame_new(_("Visible:"));
+
+	gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &box->entry, 1, GDK_ACTION_MOVE);
+	g_signal_connect(frame, "drag_data_received", G_CALLBACK(cb_sq_visible_data_received), box);
+	g_signal_connect(frame, "drag_motion", G_CALLBACK(cb_sq_visible_drag_motion), box);
+	g_signal_connect(frame, "drag_leave", G_CALLBACK(cb_sq_visible_drag_leave), box);
+
+	gtk_container_set_border_width(GTK_CONTAINER(box->visible_box), 5);
+	gtk_container_add(GTK_CONTAINER(frame), box->visible_box);
+	gtk_box_pack_start(GTK_BOX(box), frame, FALSE, TRUE, 0);
+
+	frame = gtk_frame_new(_("Available:"));
+
+	gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &box->entry, 1, GDK_ACTION_MOVE);
+	g_signal_connect(frame, "drag_data_received", G_CALLBACK(cb_sq_hidden_data_received), box);
+
+	gtk_container_set_border_width(GTK_CONTAINER(box->hidden_box), 5);
+	gtk_container_add(GTK_CONTAINER(frame), box->hidden_box);
+	gtk_box_pack_start(GTK_BOX(box), frame, FALSE, TRUE, 0);
+
+	gtk_box_set_homogeneous(GTK_BOX(box), TRUE);
+}
+
+GtkWidget *
+sq_button_drag_box_new()
+{
+	GtkWidget *box;
+
+	box = g_object_new(SQ_TYPE_BUTTON_DRAG_BOX, NULL);
+
+	sq_button_drag_box_add_fixed_button(SQ_BUTTON_DRAG_BOX(box), _("Filename"));
+
+	sq_button_drag_box_add_button(SQ_BUTTON_DRAG_BOX(box), "Size", TRUE);
+	sq_button_drag_box_add_button(SQ_BUTTON_DRAG_BOX(box), "Time", TRUE);
+
+	return box;
+}
+
+static void
+sq_button_drag_box_add_fixed_button(SQButtonDragBox *box, const gchar *label)
+{
+	GtkWidget *button = gtk_button_new_with_label(label);
+
+	gtk_box_pack_start(GTK_BOX(box->visible_box), button, FALSE, FALSE, 0);
+
+	g_signal_connect(G_OBJECT(button), "button_press_event", G_CALLBACK(cb_signal_blocker), NULL);
+	g_signal_connect(G_OBJECT(button), "enter_notify_event", G_CALLBACK(cb_signal_blocker), NULL);
+	g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(cb_signal_blocker), NULL);
+}
+
+static void
+sq_button_drag_box_add_button(SQButtonDragBox *box, const gchar *label, gboolean visible)
+{
+	GtkWidget *button = gtk_button_new_with_label(label);
+
+	gtk_box_pack_start(visible?GTK_BOX(box->visible_box):GTK_BOX(box->hidden_box), button, FALSE, FALSE, 0);
+
+	gtk_drag_source_set(button, GDK_BUTTON1_MASK, &box->entry, 1, GDK_ACTION_MOVE);
+	g_signal_connect(G_OBJECT(button), "drag_data_get", G_CALLBACK(cb_sq_button_data_get), NULL);
+	g_signal_connect(G_OBJECT(button), "drag_begin", G_CALLBACK(cb_sq_button_drag_begin), NULL);
+	g_signal_connect(G_OBJECT(button), "drag_end", G_CALLBACK(cb_sq_button_drag_end), NULL);
+	g_signal_connect(G_OBJECT(button), "button_press_event", G_CALLBACK(cb_signal_blocker), NULL);
+	g_signal_connect(G_OBJECT(button), "enter_notify_event", G_CALLBACK(cb_signal_blocker), NULL);
+	g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(cb_signal_blocker), NULL);
+}
+
+static GdkPixbuf*
+sq_create_icon_from_widget(GtkWidget *widget)
+{
+	GdkWindow *drawable = GDK_DRAWABLE(gtk_widget_get_parent_window(widget));
+	return gdk_pixbuf_get_from_drawable(NULL, drawable, NULL, widget->allocation.x, widget->allocation.y, 0, 0, widget->allocation.width, widget->allocation.height);
+}
+
+static void
+sq_create_indicator(SQButtonDragBox *box, gint x, gint y, gint width, gint height)
+{
+	gint attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_COLORMAP | GDK_WA_VISUAL;
+	GdkWindowAttr attributes = {
+		NULL,
+		0,
+		x, y,
+		width, height,
+		GDK_INPUT_OUTPUT,
+		gtk_widget_get_visual(box->visible_box),
+		gtk_widget_get_colormap(box->visible_box),
+		GDK_WINDOW_CHILD, 
+		NULL, NULL, NULL, FALSE
+	};
+
+	box->indicator = gdk_window_new(gtk_widget_get_parent_window(box->visible_box), &attributes, attr_mask);
+	gdk_window_set_user_data(box->indicator, box->visible_box);
+
+	GdkPoint points[9];
+	points[0].x = 0;
+	points[0].y = 0;
+	points[1].x = width;
+	points[1].y = 0;
+	points[2].x = width/2+1;
+	points[2].y = width/2;
+	points[3].x = width/2+1;
+	points[3].y = height-1-width/2;
+	points[4].x = width;
+	points[4].y = height;
+	points[5].x = 0;
+	points[5].y = height-1;
+	points[6].x = width/2;
+	points[6].y = height-1-width/2;
+	points[7].x = width/2;
+	points[7].y = width/2;
+	points[8].x = 0;
+	points[8].y = 0;
+	GdkRegion *shape = gdk_region_polygon(points, 9, GDK_WINDING_RULE);
+
+	gdk_window_shape_combine_region(box->indicator, shape, 0, 0);
+
+	gdk_window_show(box->indicator);
+	gdk_window_raise(box->indicator);
+}
+
+static void
+sq_delete_indicator(SQButtonDragBox *box)
+{
+	if(box->indicator)
+	{
+		gdk_window_destroy(box->indicator);
+		box->indicator = NULL;
+	}
+}
+
+static gboolean
+cb_signal_blocker(GtkWidget *widget, gpointer user_data)
+{
+	return TRUE;
+}
+
+static void
+cb_sq_button_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data)
+{
+	gtk_widget_hide(widget);
+	gtk_selection_data_set(data, gdk_atom_intern("_SQ_BUTTON_DRAG_BOX", FALSE), 8, NULL, 0);
+}
+
+static void
+cb_sq_button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
+{
+	GdkPixbuf *pixbuf = sq_create_icon_from_widget(widget);
+
+	gtk_drag_source_set_icon_pixbuf(widget, pixbuf);
+	g_object_unref(G_OBJECT(pixbuf));
+	gtk_widget_hide(widget);
+}
+
+static void
+cb_sq_button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
+{
+	gtk_widget_show(widget);
+}
+
+static void
+cb_sq_visible_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint infom, guint time, gpointer user_data)
+{
+	SQButtonDragBox *box = SQ_BUTTON_DRAG_BOX(user_data);
+
+	GtkWidget *source = gtk_drag_get_source_widget(context);
+	GtkWidget *parent = gtk_widget_get_parent(source);
+
+	gtk_widget_ref(source);
+	gtk_container_remove(GTK_CONTAINER(parent), source);
+	gtk_box_pack_start(GTK_BOX(box->visible_box), source, FALSE, FALSE, 0);
+	gtk_widget_unref(source);
+
+	gint xoffset = box->visible_box->allocation.x;
+	GtkWidget *item;
+
+	GList *iter, *children = iter = gtk_container_get_children(GTK_CONTAINER(box->visible_box));
+
+	gint i = 0;
+
+	while(iter)
+	{
+		item = GTK_WIDGET(iter->data);
+
+		if(GTK_WIDGET_VISIBLE(item))
+		{
+			if(x < (item->allocation.width/2 + item->allocation.x - xoffset))
+			{
+				break;
+			}
+		}
+		i++;
+		iter = g_list_next(iter);
+	}
+
+	g_list_free(children);
+
+	gtk_box_reorder_child(GTK_BOX(box->visible_box), source, i);
+}
+
+static gboolean
+cb_sq_visible_drag_motion(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data)
+{
+	SQButtonDragBox *box = SQ_BUTTON_DRAG_BOX(user_data);
+
+	gint ix, iy;
+	gint xoffset = box->visible_box->allocation.x;
+	GtkWidget *item;
+
+	GList *iter, *children = iter = gtk_container_get_children(GTK_CONTAINER(box->visible_box));
+
+	ix = xoffset + gtk_container_get_border_width(GTK_CONTAINER(box->visible_box));
+
+	while(iter)
+	{
+		item = GTK_WIDGET(iter->data);
+
+		if(GTK_WIDGET_VISIBLE(item))
+		{
+			if(x < (item->allocation.width/2 + item->allocation.x - xoffset))
+			{
+				ix = item->allocation.x;
+				break;
+			}
+			ix = item->allocation.x + item->allocation.width;
+		}
+		iter = g_list_next(iter);
+	}
+
+	g_list_free(children);
+
+	ix -= SQ_INDICATOR_SIZE/2 + 1;
+	iy = box->visible_box->allocation.y - SQ_INDICATOR_SIZE/2 + gtk_container_get_border_width(GTK_CONTAINER(box->visible_box));
+
+	if(!box->indicator)
+	{
+		sq_create_indicator(box, ix, iy, SQ_INDICATOR_SIZE, box->visible_box->allocation.height + SQ_INDICATOR_SIZE - gtk_container_get_border_width(GTK_CONTAINER(box->visible_box))*2);
+	}
+	else
+	{
+		gdk_window_move(box->indicator, ix, iy);
+	}
+
+	return FALSE;
+}
+
+static void
+cb_sq_visible_drag_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer user_data)
+{
+	sq_delete_indicator(SQ_BUTTON_DRAG_BOX(user_data));
+}
+
+static void
+cb_sq_hidden_data_received(GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint infom, guint time, gpointer user_data)
+{
+	GtkWidget *source = gtk_drag_get_source_widget(context);
+	GtkWidget *parent = gtk_widget_get_parent(source);
+
+	/* if the item was dragged back to the location it already was */
+	if(parent == SQ_BUTTON_DRAG_BOX(user_data)->hidden_box)
+	{
+		return;
+	}
+
+	gtk_widget_ref(source);
+	gtk_container_remove(GTK_CONTAINER(parent), source);
+	gtk_box_pack_start(GTK_BOX(SQ_BUTTON_DRAG_BOX(user_data)->hidden_box), source, FALSE, FALSE, 0);
+	gtk_widget_unref(source);
+}
+

Added: squeeze/trunk/src/button_drag_box.h
===================================================================
--- squeeze/trunk/src/button_drag_box.h	                        (rev 0)
+++ squeeze/trunk/src/button_drag_box.h	2007-01-07 16:36:24 UTC (rev 24289)
@@ -0,0 +1,65 @@
+/*
+ *  Copyright (c) 2006 Stephan Arts <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SQRCHIVER_BUTTON_DRAG_BOX_H__
+#define __SQRCHIVER_BUTTON_DRAG_BOX_H__
+G_BEGIN_DECLS
+
+#define SQ_TYPE_BUTTON_DRAG_BOX sq_button_drag_box_get_type()
+
+#define SQ_BUTTON_DRAG_BOX(obj)(                \
+		G_TYPE_CHECK_INSTANCE_CAST ((obj),  \
+			SQ_TYPE_BUTTON_DRAG_BOX,                  \
+			SQButtonDragBox))
+
+#define SQ_IS_BUTTON_DRAG_BOX(obj)      ( \
+		G_TYPE_CHECK_INSTANCE_TYPE ((obj),    \
+			SQ_TYPE_BUTTON_DRAG_BOX))
+
+#define SQ_BUTTON_DRAG_BOX_CLASS(klass) ( \
+		G_TYPE_CHECK_CLASS_CAST ((klass),     \
+			SQ_TYPE_BUTTON_DRAG_BOX,      \
+			SQButtonDragBoxClass))
+
+#define SQ_IS_BUTTON_DRAG_BOX_CLASS(class) ( \
+		G_TYPE_CHECK_CLASS_TYPE ((class),        \
+			SQ_TYPE_BUTTON_DRAG_BOX()))	
+
+typedef struct _SQButtonDragBox SQButtonDragBox;
+
+struct _SQButtonDragBox
+{
+	GtkVBox parent;
+	GtkWidget *visible_box;
+	GtkWidget *hidden_box;
+	GtkTargetEntry entry;
+	GdkWindow *indicator;
+};
+
+typedef struct _SQButtonDragBoxClass SQButtonDragBoxClass;
+
+struct _SQButtonDragBoxClass
+{
+	GtkVBoxClass parent_class;
+};
+
+GType      sq_button_drag_box_get_type();
+GtkWidget *sq_button_drag_box_new();
+
+G_END_DECLS
+#endif /* __SQRCHIVER_BUTTON_DRAG_BOX_H__*/

Modified: squeeze/trunk/src/preferences_dialog.c
===================================================================
--- squeeze/trunk/src/preferences_dialog.c	2007-01-07 16:27:52 UTC (rev 24288)
+++ squeeze/trunk/src/preferences_dialog.c	2007-01-07 16:36:24 UTC (rev 24289)
@@ -24,6 +24,7 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include "preferences_dialog.h"
+#include "button_drag_box.h"
 
 static void
 sq_preferences_dialog_class_init(SQPreferencesDialogClass *archive_class);
@@ -37,32 +38,6 @@
 static GtkWidget *
 sq_preferences_dialog_create_page(LSQArchiveSupport *support);
 
-static GdkPixbuf *
-create_icon_from_widget(GtkWidget *widget);
-
-static void
-vis_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data);
-static void
-vis_drag_leave(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data);
-static void
-vis_drag_motion(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data);
-
-static void
-hid_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data);
-
-static void
-button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer user_data);
-static void
-button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data);
-static void
-data_get(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data);
-
-static gboolean
-signal_blocker(GtkWidget *widget, gpointer user_data)
-{
-	return TRUE;
-}
-
 GType
 sq_preferences_dialog_get_type ()
 {
@@ -220,68 +195,13 @@
 static GtkWidget *
 sq_preferences_dialog_create_page(LSQArchiveSupport *support)
 {
-	GtkTargetEntry entry;
+	GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
 
-	GtkWidget *_vbox = gtk_vbox_new(FALSE, 0);
+	GtkWidget *button_box = sq_button_drag_box_new();
 
-	GtkWidget *vbox = gtk_vbox_new(TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), button_box, FALSE, FALSE, 0);
 
-	GtkWidget *visbox = gtk_hbox_new(FALSE, 0);
-	GtkWidget *hidbox = gtk_hbox_new(FALSE, 0);
-
-	GtkWidget *frame = gtk_frame_new(_("Visible:"));
-
-	GtkWidget *button = gtk_button_new_with_label(_("Filename"));
-
-	entry.target = "_SQ_PREF_DIALOG_BUTTON";
-	entry.flags = GTK_TARGET_SAME_APP;
-	entry.info = 2;
-
-	gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &entry, 1, GDK_ACTION_MOVE);
-
-	g_signal_connect(frame, "drag_data_received", G_CALLBACK(vis_data_received), visbox);
-	g_signal_connect(frame, "drag_motion", G_CALLBACK(vis_drag_motion), visbox);
-	g_signal_connect(frame, "drag_leave", G_CALLBACK(vis_drag_leave), visbox);
-
-	gtk_container_add(GTK_CONTAINER(frame), visbox);
-
-	gtk_box_pack_start(GTK_BOX(visbox), button, FALSE, FALSE, 0);
-	g_signal_connect(G_OBJECT(button), "button_press_event", G_CALLBACK(signal_blocker), NULL);
-	g_signal_connect(G_OBJECT(button), "enter_notify_event", G_CALLBACK(signal_blocker), NULL);
-	g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(signal_blocker), NULL);
-
-	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0);
-
-	frame = gtk_frame_new(_("Availble:"));
-
-	gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &entry, 1, GDK_ACTION_MOVE);
-
-	g_signal_connect(frame, "drag_data_received", G_CALLBACK(hid_data_received), hidbox);
-
-	gtk_container_add(GTK_CONTAINER(frame), hidbox);
-
-/*for cols*/
-
-	button = gtk_button_new_with_label("size");
-
-	gtk_box_pack_start(GTK_BOX(visbox), button, FALSE, FALSE, 0);
-	
-	gtk_drag_source_set(button, GDK_BUTTON1_MASK, &entry, 1, GDK_ACTION_MOVE);
-
-	g_signal_connect(G_OBJECT(button), "drag-data-get", G_CALLBACK(data_get), NULL);
-	g_signal_connect(G_OBJECT(button), "drag_begin", G_CALLBACK(button_drag_begin), NULL);
-	g_signal_connect(G_OBJECT(button), "drag_end", G_CALLBACK(button_drag_end), NULL);
-	g_signal_connect(G_OBJECT(button), "button_press_event", G_CALLBACK(signal_blocker), NULL);
-	g_signal_connect(G_OBJECT(button), "enter_notify_event", G_CALLBACK(signal_blocker), NULL);
-	g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(signal_blocker), NULL);
-
-/*endfor*/
-
-	gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0);
-
-	gtk_box_pack_start(GTK_BOX(_vbox), vbox, FALSE, FALSE, 0);
-
-	return _vbox;
+	return vbox;
 }
 
 static void
@@ -291,82 +211,3 @@
 	gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog->support.notebook), gtk_tree_path_get_indices(path)[0]);
 }
 
-static void
-button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
-{
-	GdkPixbuf *pixbuf = create_icon_from_widget(widget);
-
-	gtk_drag_source_set_icon_pixbuf(widget, pixbuf);
-	g_object_unref(G_OBJECT(pixbuf));
-	gtk_widget_hide(widget);
-}
-
-static void
-button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
-{
-	gtk_widget_show(widget);
-}
-
-static void
-data_get(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data)
-{
-	gtk_widget_hide(widget);
-	gtk_selection_data_set(data, gdk_atom_intern("_SQ_PREF_DIALOG_BUTTON", FALSE), 8, (const guchar*)"", 0);
-}
-
-static void
-hid_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
-{
-	GtkWidget *source = gtk_drag_get_source_widget(context);
-	GtkWidget *parent = gtk_widget_get_parent(source);
-
-	if(parent == GTK_WIDGET(user_data))
-	{
-		return;
-	}
-
-	gtk_widget_ref(source);
-	gtk_container_remove(GTK_CONTAINER(parent), source);
-	gtk_box_pack_start(GTK_BOX(user_data), source, FALSE, FALSE, 0);
-	gtk_widget_unref(source);
-}
-
-static void
-vis_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
-{
-	GtkWidget *source = gtk_drag_get_source_widget(context);
-	GtkWidget *parent = gtk_widget_get_parent(source);
-
-	gtk_widget_ref(source);
-	gtk_container_remove(GTK_CONTAINER(parent), source);
-	gtk_box_pack_start(GTK_BOX(user_data), source, FALSE, FALSE, 0);
-	gtk_widget_unref(source);
-	/* vis_reorder_buttons(user_data, source, x); */
-}
-
-static void
-vis_drag_leave(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time, gpointer user_data)
-{
-}
-
-static void
-vis_drag_motion(GtkWidget * widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time, gpointer user_data)
-{
-}
-
-static GdkPixbuf *
-create_icon_from_widget(GtkWidget *widget)
-{
-	GdkPixbuf *src, *dest;
-
-	dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, widget->allocation.width, widget->allocation.height);
-
-	src = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE(widget->window), NULL, widget->allocation.x, widget->allocation.y, 0, 0, widget->allocation.width, widget->allocation.height);
-
-	gdk_pixbuf_copy_area(src, 0, 0, widget->allocation.width, widget->allocation.height, dest, 0, 0);
-
-	g_object_unref(G_OBJECT(src));
-
-	return dest;
-}
-



More information about the Xfce4-commits mailing list