changeset 18527:9da6977fd813

merge of '94a9755f88bd06c61bdc7b7bb2222b989e548f90' and 'd72ab8fcc0f1c15dfd7bd46a2e26a77e0450b4d8'
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 13 Jul 2007 17:06:28 +0000
parents 491b422dfdd3 (current diff) 09db6fec9dce (diff)
children bf8ccdfb4fd7
files
diffstat 4 files changed, 62 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gnt.h	Fri Jul 13 16:54:41 2007 +0000
+++ b/finch/libgnt/gnt.h	Fri Jul 13 17:06:28 2007 +0000
@@ -153,7 +153,8 @@
  * Spawn a different application that will consume the console.
  */
 gboolean gnt_giveup_console(const char *wd, char **argv, char **envp,
-		gint *stin, gint *stout, gint *sterr);
+		gint *stin, gint *stout, gint *sterr,
+		void (*callback)(int status, gpointer data), gpointer data);
 
 gboolean gnt_is_refugee(void);
 
--- a/finch/libgnt/gntmain.c	Fri Jul 13 16:54:41 2007 +0000
+++ b/finch/libgnt/gntmain.c	Fri Jul 13 17:06:28 2007 +0000
@@ -306,7 +306,7 @@
 	                                 But irssi does this, so I am going to assume the
 	                                 crashes were caused by some other stuff. */
 
-	g_printerr("gntmain: setting up IO\n");
+	g_printerr("gntmain: setting up IO (%d)\n", channel_read_callback);
 }
 
 static gboolean
@@ -643,9 +643,21 @@
 }
 
 #if GLIB_CHECK_VERSION(2,4,0)
+typedef struct
+{
+	void (*callback)(int status, gpointer data);
+	gpointer data;
+} ChildProcess;
+
 static void
 reap_child(GPid pid, gint status, gpointer data)
 {
+	ChildProcess *cp = data;
+	if (cp->callback) {
+		cp->callback(status, cp->data);
+	}
+	g_free(cp);
+	clean_pid();
 	wm->mode = GNT_KP_MODE_NORMAL;
 	clear();
 	setup_io();
@@ -654,10 +666,12 @@
 #endif
 
 gboolean gnt_giveup_console(const char *wd, char **argv, char **envp,
-		gint *stin, gint *stout, gint *sterr)
+		gint *stin, gint *stout, gint *sterr,
+		void (*callback)(int status, gpointer data), gpointer data)
 {
 #if GLIB_CHECK_VERSION(2,4,0)
 	GPid pid = 0;
+	ChildProcess *cp = NULL;
 
 	if (!g_spawn_async_with_pipes(wd, argv, envp,
 			G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
@@ -665,9 +679,12 @@
 			&pid, stin, stout, sterr, NULL))
 		return FALSE;
 
+	cp = g_new0(ChildProcess, 1);
+	cp->callback = callback;
+	cp->data = data;
 	g_source_remove(channel_read_callback);
 	wm->mode = GNT_KP_MODE_WAIT_ON_CHILD;
-	g_child_watch_add(pid, reap_child, NULL);
+	g_child_watch_add(pid, reap_child, cp);
 
 	return TRUE;
 #else
--- a/finch/libgnt/gnttextview.c	Fri Jul 13 16:54:41 2007 +0000
+++ b/finch/libgnt/gnttextview.c	Fri Jul 13 17:06:28 2007 +0000
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 enum
 {
@@ -795,6 +796,13 @@
 	view->flags |= flag;
 }
 
+static void
+pager_end_cb(int status, gpointer data)
+{
+	unlink(data);
+	g_free(data);
+}
+
 static gboolean
 check_for_pager_cb(GntWidget *widget, const char *key, GntTextView *view)
 {
@@ -803,6 +811,7 @@
 	static char path[1024];
 	static int len = -1;
 	FILE *file;
+	gboolean ret;
 
 	if (combin == NULL) {
 		combin = gnt_key_translate(gnt_style_get_from_name("pager", "key"));
@@ -826,8 +835,11 @@
 	argv[0] = gnt_style_get_from_name("pager", "path");
 	argv[0] = argv[0] ? argv[0] : getenv("PAGER");
 	argv[0] = argv[0] ? argv[0] : "less";
-	argv[1] = path;
-	return gnt_giveup_console(NULL, argv, NULL, NULL, NULL, NULL);
+	argv[1] = g_strdup(path);
+	ret = gnt_giveup_console(NULL, argv, NULL, NULL, NULL, NULL, pager_end_cb, argv[1]);
+	if (!ret)
+		g_free(argv[1]);
+	return ret;
 }
 
 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager)
--- a/pidgin/gtkconv.c	Fri Jul 13 16:54:41 2007 +0000
+++ b/pidgin/gtkconv.c	Fri Jul 13 17:06:28 2007 +0000
@@ -7618,34 +7618,45 @@
 {
 	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;
+	}
+
 	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;