changeset 20458:faad7d69de10

propagate from branch 'im.pidgin.pidgin' (head eedca2ceb89c90a12f734e927c5d3b02bbde9a5c) to branch 'im.pidgin.cpw.khc.msnp14' (head 834884618ea5120f7e58227bfe8aa6410e0b133a)
author Ka-Hing Cheung <khc@hxbc.us>
date Sat, 23 Jun 2007 03:07:35 +0000
parents c9bcf4f11e30 (current diff) 98c1375232e2 (diff)
children 46437bdf316b
files COPYRIGHT libpurple/protocols/msn/msn-utils.c libpurple/protocols/msn/msn-utils.h
diffstat 10 files changed, 109 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Fri Jun 22 03:55:10 2007 +0000
+++ b/COPYRIGHT	Sat Jun 23 03:07:35 2007 +0000
@@ -277,6 +277,7 @@
 Julien Pivotto
 Ari Pollak
 Robey Pointer
+Eric Polino
 Stephen Pope
 Nathan Poznick
 Jory A. Pratt
--- a/finch/gntconv.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/finch/gntconv.c	Sat Jun 23 03:07:35 2007 +0000
@@ -485,7 +485,24 @@
 	gnt_box_set_title(GNT_BOX(ggc->window), title);
 	gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE);
 	gnt_box_set_pad(GNT_BOX(ggc->window), 0);
-	gnt_widget_set_name(ggc->window, "conversation-window");
+
+	switch(conv->type){
+		case PURPLE_CONV_TYPE_UNKNOWN:
+			gnt_widget_set_name(ggc->window, "conversation-window-unknown" );
+			break;
+		case PURPLE_CONV_TYPE_IM:
+			gnt_widget_set_name(ggc->window, "conversation-window-im" );
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			gnt_widget_set_name(ggc->window, "conversation-window-chat" );
+			break;
+		case PURPLE_CONV_TYPE_MISC:
+			gnt_widget_set_name(ggc->window, "conversation-window-misc" );
+			break;
+		case PURPLE_CONV_TYPE_ANY:
+			gnt_widget_set_name(ggc->window, "conversation-window-any" );
+			break;
+	}
 
 	gg_create_menu(ggc);
 
@@ -554,7 +571,8 @@
 	
 	if (ggc->list == NULL) {
 		g_free(ggc->u.chat);
-		gnt_widget_destroy(ggc->window);
+		if (ggc->window)
+			gnt_widget_destroy(ggc->window);
 		g_free(ggc);
 	}
 }
--- a/finch/gntplugin.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/finch/gntplugin.c	Sat Jun 23 03:07:35 2007 +0000
@@ -47,7 +47,7 @@
 
 static GHashTable *confwins;
 
-static void process_pref_frame(PurplePluginPrefFrame *frame);
+static GntWidget *process_pref_frame(PurplePluginPrefFrame *frame);
 
 static void
 decide_conf_button(PurplePlugin *plugin)
@@ -84,7 +84,7 @@
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
 		}
 
-		if ((win = g_hash_table_lookup(confwins, plugin)) != NULL)
+		if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL)
 		{
 			gnt_widget_destroy(win);
 		}
@@ -221,7 +221,11 @@
 	else if (plugin->info->prefs_info &&
 			plugin->info->prefs_info->get_plugin_pref_frame)
 	{
-		process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin));
+		GntWidget *win = process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin));
+		if (confwins == NULL)
+			confwin_init();
+		g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(remove_confwin), plugin);
+		g_hash_table_insert(confwins, plugin, win);
 		return;
 	}
 	else
@@ -308,7 +312,7 @@
 	decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree)));
 }
 
-static void
+static GntWidget*
 process_pref_frame(PurplePluginPrefFrame *frame)
 {
 	PurpleRequestField *field;
@@ -360,7 +364,7 @@
 		}
 	}
 
-	purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
+	return purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
 			_("Save"), G_CALLBACK(finch_request_save_in_prefs), _("Cancel"), NULL,
 			NULL, NULL, NULL,
 			NULL);
--- a/finch/gntrequest.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/finch/gntrequest.c	Sat Jun 23 03:07:35 2007 +0000
@@ -399,7 +399,7 @@
 							purple_request_field_string_get_default_value(field));
 				gnt_entry_set_masked(GNT_ENTRY(entry),
 						purple_request_field_string_is_masked(field));
-				if (purple_str_has_prefix(hint, "screenname")) {
+				if (hint && purple_str_has_prefix(hint, "screenname")) {
 					PurpleBlistNode *node = purple_blist_get_root();
 					gboolean offline = purple_str_has_suffix(hint, "all");
 					for (; node; node = purple_blist_node_next(node, offline)) {
@@ -673,7 +673,7 @@
 			switch (pt) {
 				case PURPLE_PREF_INT:
 				{
-					long int tmp;
+					long int tmp = GPOINTER_TO_INT(val);
 					if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */
 						sscanf(val, "%ld", &tmp);
 					purple_prefs_set_int(id, (gint)tmp);
--- a/finch/libgnt/gntwidget.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Sat Jun 23 03:07:35 2007 +0000
@@ -576,7 +576,7 @@
 		GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_GIVE_FOCUS], 0);
 	}
-	else if (!set)
+	else if (!set && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS))
 	{
 		GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS);
 		g_signal_emit(widget, signals[SIG_LOST_FOCUS], 0);
--- a/finch/libgnt/gntws.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/finch/libgnt/gntws.c	Sat Jun 23 03:07:35 2007 +0000
@@ -87,8 +87,12 @@
 
 void gnt_ws_add_widget(GntWS *ws, GntWidget* wid)
 {
+	GntWidget *oldfocus;
+	oldfocus = ws->ordered ? ws->ordered->data : NULL;
 	ws->list = g_list_append(ws->list, wid);
 	ws->ordered = g_list_prepend(ws->ordered, wid);
+	if (oldfocus)
+		gnt_widget_set_focus(oldfocus, FALSE);
 }
 
 void gnt_ws_remove_widget(GntWS *ws, GntWidget* wid)
--- a/libpurple/core.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/libpurple/core.c	Sat Jun 23 03:07:35 2007 +0000
@@ -222,11 +222,10 @@
 	purple_sound_uninit();
 
 	purple_plugins_uninit();
-	purple_signals_uninit();
-
 #ifdef HAVE_DBUS
 	purple_dbus_uninit();
 #endif
+	purple_signals_uninit();
 
 	g_free(core->ui);
 	g_free(core);
--- a/libpurple/status.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/libpurple/status.c	Sat Jun 23 03:07:35 2007 +0000
@@ -152,10 +152,10 @@
 	{ PURPLE_STATUS_UNSET,           "unset",           N_("Unset")           },
 	{ PURPLE_STATUS_OFFLINE,         "offline",         N_("Offline")         },
 	{ PURPLE_STATUS_AVAILABLE,       "available",       N_("Available")       },
-	{ PURPLE_STATUS_UNAVAILABLE,     "unavailable",     N_("Unavailable")     },
+	{ PURPLE_STATUS_UNAVAILABLE,     "unavailable",     N_("Do not disturb")     },
 	{ PURPLE_STATUS_INVISIBLE,       "invisible",       N_("Invisible")       },
 	{ PURPLE_STATUS_AWAY,            "away",            N_("Away")            },
-	{ PURPLE_STATUS_EXTENDED_AWAY,   "extended_away",   N_("Extended Away")   },
+	{ PURPLE_STATUS_EXTENDED_AWAY,   "extended_away",   N_("Extended away")   },
 	{ PURPLE_STATUS_MOBILE,          "mobile",          N_("Mobile")          }
 };
 
--- a/pidgin/gtkconv.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/pidgin/gtkconv.c	Sat Jun 23 03:07:35 2007 +0000
@@ -184,6 +184,8 @@
 static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields);
 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win);
 static void pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv);
+static gboolean infopane_release_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *conv);
+static gboolean infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *conv);
 
 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) {
 	static GdkColor col;
@@ -4377,7 +4379,7 @@
 static GtkWidget *
 setup_common_pane(PidginConversation *gtkconv)
 {
-	GtkWidget *paned, *vbox, *frame, *imhtml_sw;
+	GtkWidget *paned, *vbox, *frame, *imhtml_sw, *event_box;
 	GtkCellRenderer *rend;
 	GtkTreePath *path;
 	PurpleConversation *conv = gtkconv->active_conv;
@@ -4393,9 +4395,19 @@
 	gtk_widget_show(vbox);
 
 	/* Setup the info pane */
+	event_box = gtk_event_box_new();
+	gtk_widget_show(event_box);
 	gtkconv->infopane_hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox), gtkconv->infopane_hbox, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), event_box, FALSE, FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(event_box), gtkconv->infopane_hbox);
 	gtk_widget_show(gtkconv->infopane_hbox);
+	gtk_widget_add_events(event_box,
+	                      GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
+	g_signal_connect(G_OBJECT(event_box), "button_press_event",
+	                 G_CALLBACK(infopane_press_cb), gtkconv);
+	g_signal_connect(G_OBJECT(event_box), "button_release_event",
+	                 G_CALLBACK(infopane_release_cb), gtkconv);
+
 
 	gtkconv->infopane = gtk_cell_view_new();
 	gtkconv->infopane_model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
@@ -7594,6 +7606,45 @@
 /*
  * THANK YOU GALEON!
  */
+
+static gboolean
+infopane_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv)
+{
+	int nb_x, nb_y;
+
+	if (e->button != 1 || e->type != GDK_BUTTON_PRESS)
+		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;
+        }
+	
+	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;
+
+
+	/* 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);
+
+	gtkconv->win->drag_leave_signal =
+		g_signal_connect(G_OBJECT(gtkconv->win->notebook), "leave_notify_event",
+		                 G_CALLBACK(notebook_leave_cb), gtkconv->win);
+
+	return FALSE;
+
+}
+
 static gboolean
 notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
 {
@@ -7683,6 +7734,11 @@
 }
 
 static gboolean
+infopane_release_cb(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv)
+{
+}
+
+static gboolean
 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win)
 {
 	PidginWindow *dest_win;
@@ -8374,8 +8430,7 @@
 		/* Er, bug in notebooks? Switch to the page manually. */
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
 
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
-		                           purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs"));
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
 	} else
 		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE);
 
@@ -8491,14 +8546,16 @@
 
 	gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index);
 
-	/* go back to tabless if need be */
+	/* go back to tabless */
 	if (pidgin_conv_window_get_gtkconv_count(win) <= 2) {
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
-		                           purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs"));
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
 	}
 
 	win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv);
 
+	if (!win->gtkconvs || !win->gtkconvs->next)
+		gtk_notebook_set_show_tabs(win->notebook, FALSE);
+
 	if (!win->gtkconvs && win != hidden_convwin)
 		pidgin_conv_window_destroy(win);
 }
--- a/pidgin/gtkstatusbox.c	Fri Jun 22 03:55:10 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Sat Jun 23 03:07:35 2007 +0000
@@ -1019,7 +1019,7 @@
 static void
 pidgin_status_box_regenerate(PidginStatusBox *status_box)
 {
-	GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4;
+	GdkPixbuf *pixbuf, *pixbuf2, *pixbuf3, *pixbuf4, *pixbuf5;
 	GtkIconSize icon_size;
 
 	icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
@@ -1049,15 +1049,19 @@
 			                                  icon_size, "PidginStatusBox");
 			pixbuf4 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_INVISIBLE,
 			                                  icon_size, "PidginStatusBox");
+			pixbuf5 = gtk_widget_render_icon (GTK_WIDGET(status_box->vbox), PIDGIN_STOCK_STATUS_BUSY,
+							  icon_size, "PidginStatusBox");
 
 			pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf, _("Available"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE));
 			pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf2, _("Away"), NULL, GINT_TO_POINTER(PURPLE_STATUS_AWAY));
+			pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf5, _("Do not disturb"), NULL, GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE));
 			pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf4, _("Invisible"), NULL, GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE));
 			pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_PRIMITIVE, pixbuf3, _("Offline"), NULL, GINT_TO_POINTER(PURPLE_STATUS_OFFLINE));
 
 			if (pixbuf2)	g_object_unref(G_OBJECT(pixbuf2));
 			if (pixbuf3)	g_object_unref(G_OBJECT(pixbuf3));
 			if (pixbuf4)	g_object_unref(G_OBJECT(pixbuf4));
+			if (pixbuf5)	g_object_unref(G_OBJECT(pixbuf5));
 		}
 
 		add_popular_statuses(status_box);