changeset 18524:5255cf9a0100

merge of '2f809d90603821641a30206f53f11a56b9bc62af' and '50b308f4b40f81464aa73773d975e460a3d3e60d'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 13 Jul 2007 15:24:23 +0000
parents 7abaa571dad1 (current diff) 0a8f9829640f (diff)
children 59c361c2f25b
files
diffstat 1 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Fri Jul 13 13:39:22 2007 +0000
+++ b/pidgin/gtkconv.c	Fri Jul 13 15:24:23 2007 +0000
@@ -7618,34 +7618,49 @@
 {
 	int nb_x, nb_y;
 
-	if (e->button != 1 || e->type != GDK_BUTTON_PRESS)
+	if (e->type != GDK_BUTTON_PRESS)
 		return FALSE;
 
+	if (e->button == 3) {
+		/* Right click was pressed. Popup the Send To menu. */
+		GtkWidget *menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to));
+		if (menu)
+			gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
+		else
+			return FALSE;
+		return TRUE;
+	} else if (e->button != 1) {
+		return FALSE;
+	}
+
 	if (gtkconv->win->in_drag) {
-		  purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
-                           "Already in the middle of a window drag at tab_press_cb\n");
-                return TRUE;
-        }
-	
+		purple_debug(PURPLE_DEBUG_WARNING, "gtkconv",
+				"Already in the middle of a window drag at tab_press_cb\n");
+		return TRUE;
+	}
+
+	/* If we have more than one tab, then we don't want drag-n-drop from the infopane */
+	if (g_list_length(gtkconv->win->gtkconvs) != 1)
+		return FALSE;
+
 	gtkconv->win->in_predrag = TRUE;
 	gtkconv->win->drag_tab = gtk_notebook_page_num(GTK_NOTEBOOK(gtkconv->win->notebook), gtkconv->tab_cont);
 
-        gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y);
-
-        gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x      + nb_x;
-        gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y      + nb_y;
-        gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width  + gtkconv->win->drag_min_x;
-        gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y;
-
+	gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y);
+
+	gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x      + nb_x;
+	gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y      + nb_y;
+	gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width  + gtkconv->win->drag_min_x;
+	gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y;
 
 	/* Connect the new motion signals. */
 	gtkconv->win->drag_motion_signal =
 		g_signal_connect(G_OBJECT(gtkconv->win->notebook), "motion_notify_event",
-		                 G_CALLBACK(notebook_motion_cb), gtkconv->win);
+				G_CALLBACK(notebook_motion_cb), gtkconv->win);
 
 	gtkconv->win->drag_leave_signal =
 		g_signal_connect(G_OBJECT(gtkconv->win->notebook), "leave_notify_event",
-		                 G_CALLBACK(notebook_leave_cb), gtkconv->win);
+				G_CALLBACK(notebook_leave_cb), gtkconv->win);
 
 	return FALSE;