changeset 7879:f9df510460d7

[gaim-migrate @ 8533] Some lot of small changes, mostly to conversation menus. -Made the alias menu item in chat convo windows work -Made the add/remove menu items in chat convo windows work. The menu item still doesn't toggle after you've added or removed, but I'll probably do that soon -Made the invite dialog not modal -Removed GAIM_STOCK_PRIVACY from stock.[c|h] since we're not using it anymore committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 14 Dec 2003 23:59:14 +0000
parents cbfbed263d00
children c5a4d1863425
files src/blist.c src/conversation.c src/dialogs.c src/gtkblist.c src/gtkconv.c src/stock.c src/stock.h src/ui.h
diffstat 8 files changed, 70 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/blist.c	Sun Dec 14 23:59:14 2003 +0000
@@ -628,7 +628,7 @@
 		gaim_blist_save();
 }
 
-void  gaim_blist_add_buddy (GaimBuddy *buddy, GaimContact *contact, GaimGroup *group, GaimBlistNode *node)
+void gaim_blist_add_buddy(GaimBuddy *buddy, GaimContact *contact, GaimGroup *group, GaimBlistNode *node)
 {
 	GaimBlistNode *cnode, *bnode;
 	GaimGroup *g;
--- a/src/conversation.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/conversation.c	Sun Dec 14 23:59:14 2003 +0000
@@ -28,7 +28,7 @@
 #include "signals.h"
 #include "util.h"
 
-/* XXX CORE/UI */
+/* XXX CORE/UI, waiting for away splittage */
 #include "gtkinternal.h"
 #include "ui.h"
 
--- a/src/dialogs.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/dialogs.c	Sun Dec 14 23:59:14 2003 +0000
@@ -180,10 +180,11 @@
 		serv_warn(w->gc, w->who, (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w->anon))) ? 1 : 0);
 
 	destroy_dialog(NULL, w->window);
+	g_free(w->who);
 	g_free(w);
 }
 
-void show_warn_dialog(GaimConnection *gc, char *who)
+void show_warn_dialog(GaimConnection *gc, const char *who)
 {
 	char *labeltext;
 	GtkWidget *hbox, *vbox;
@@ -192,7 +193,7 @@
 	GaimConversation *c = gaim_find_conversation_with_account(who, gc->account);
 
 	struct warning *w = g_new0(struct warning, 1);
-	w->who = who;
+	w->who = g_strdup(who);
 	w->gc = gc;
 
 	gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
--- a/src/gtkblist.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/gtkblist.c	Sun Dec 14 23:59:14 2003 +0000
@@ -3205,6 +3205,7 @@
 		serv_add_buddy(gaim_account_get_connection(data->account), who, g);
 
 		if (c != NULL) {
+			/* This should be in blist.c somewhere... */
 			gaim_buddy_icon_update(gaim_conv_im_get_icon(GAIM_CONV_IM(c)));
 			gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
 		}
--- a/src/gtkconv.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/gtkconv.c	Sun Dec 14 23:59:14 2003 +0000
@@ -465,7 +465,7 @@
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
 		gaim_conv_im_send(GAIM_CONV_IM(conv), buf);
-	else
+	else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
 		gaim_conv_chat_send(GAIM_CONV_CHAT(conv), buf);
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))
@@ -482,13 +482,11 @@
 {
 	GaimAccount *account;
 	const char *name;
-	GaimConversationType type;
 
 	account = gaim_conversation_get_account(conv);
 	name    = gaim_conversation_get_name(conv);
-	type    = gaim_conversation_get_type(conv);
-
-	if (GAIM_CONV_IM(conv)) {
+
+	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 		GaimBuddy *b;
 
 		b = gaim_find_buddy(account, name);
@@ -496,7 +494,7 @@
 			show_confirm_del(b);
 		else if (account != NULL && gaim_account_is_connected(account))
 			gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL);
-	} else if (GAIM_CONV_CHAT(conv)) {
+	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
 		GaimChat *c;
 
 		c = gaim_blist_find_chat(account, name);
@@ -516,7 +514,13 @@
 
 	gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-	if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
+	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
+		serv_get_info(gaim_conversation_get_gc(conv),
+					  gaim_conversation_get_name(conv));
+
+		gtk_widget_grab_focus(gtkconv->entry);
+	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
+		/* Get info of the person currently selected in the GtkTreeView */
 		GaimGtkChatPane *gtkchat;
 		GtkTreeIter iter;
 		GtkTreeModel *model;
@@ -533,13 +537,7 @@
 		else
 			return;
 
-		serv_get_info(gaim_conversation_get_gc(conv), (char *)name);
-	}
-	else {
-		serv_get_info(gaim_conversation_get_gc(conv),
-					  (char *)gaim_conversation_get_name(conv));
-
-		gtk_widget_grab_focus(gtkconv->entry);
+		serv_get_info(gaim_conversation_get_gc(conv), name);
 	}
 }
 
@@ -547,7 +545,7 @@
 warn_cb(GtkWidget *widget, GaimConversation *conv)
 {
 	show_warn_dialog(gaim_conversation_get_gc(conv),
-					 (char *)gaim_conversation_get_name(conv));
+					 gaim_conversation_get_name(conv));
 
 	gtk_widget_grab_focus(GAIM_GTK_CONVERSATION(conv)->entry);
 }
@@ -620,8 +618,8 @@
 		/* Create the new dialog. */
 		invite_dialog = gtk_dialog_new_with_buttons(
 			_("Invite Buddy Into Chat Room"),
-			GTK_WINDOW(gtkwin->window),
-			GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+			GTK_WINDOW(gtkwin->window), 0,
+			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
 
 		gtk_dialog_set_default_response(GTK_DIALOG(invite_dialog),
@@ -853,20 +851,25 @@
 {
 	GaimConvWindow *win = (GaimConvWindow *)data;
 	GaimConversation *conv;
-	GaimBuddy *b;
-
-	conv = gaim_conv_window_get_active_conversation(win);
-
-	b = gaim_find_buddy(gaim_conversation_get_account(conv),
-						gaim_conversation_get_name(conv));
-
-	if (b != NULL) {
-		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
+	GaimAccount *account;
+	const char *name;
+
+	conv    = gaim_conv_window_get_active_conversation(win);
+	account = gaim_conversation_get_account(conv);
+	name    = gaim_conversation_get_name(conv);
+
+	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
+		GaimBuddy *b;
+
+		b = gaim_find_buddy(account, name);
+		if (b != NULL)
 			alias_dialog_bud(b);
-#if 0
-		else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
-			alias_dialog_chat((struct chat *)b);
-#endif
+	} else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
+		GaimChat *c;
+
+		c = gaim_blist_find_chat(account, name);
+		if (c != NULL)
+			alias_dialog_blist_chat(c);
 	}
 }
 
@@ -2082,10 +2085,8 @@
 
 	gaim_conversation_set_unseen(conv, GAIM_UNSEEN_NONE);
 
-	if (gc != NULL) {
-		gtk_widget_set_sensitive(gtkwin->menu.insert_link, TRUE);
+	if (gc != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-	}
 
 	/* Update the menubar */
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
@@ -2094,6 +2095,8 @@
 		gtk_widget_show(gtkwin->menu.get_info);
 		gtk_widget_hide(gtkwin->menu.invite);
 
+		gtk_widget_show(gtkwin->menu.insert_link);
+
 		gtk_widget_show(gtkwin->menu.insert_image);
 		if (gc && prpl_info->options & OPT_PROTO_IM_IMAGE)
 			gtk_widget_set_sensitive(gtkwin->menu.insert_image, TRUE);
@@ -2137,14 +2140,16 @@
 		gtk_widget_hide(gtkwin->menu.get_info);
 		gtk_widget_show(gtkwin->menu.invite);
 
+		gtk_widget_show(gtkwin->menu.insert_link);
+
 		gtk_widget_hide(gtkwin->menu.insert_image);
 		gtk_widget_set_sensitive(gtkconv->toolbar.image, FALSE);
 
 		gtk_widget_hide(gtkwin->menu.warn);
 		gtk_widget_hide(gtkwin->menu.block);
 
-		if (gaim_find_chat(gaim_conversation_get_gc(conv),
-				   gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv))) == NULL) {
+		if (gaim_blist_find_chat(gaim_conversation_get_account(conv),
+								 gaim_conversation_get_name(conv)) == NULL) {
 			gtk_widget_show(gtkwin->menu.add);
 			gtk_widget_hide(gtkwin->menu.remove);
 			gtk_widget_set_sensitive(gtkwin->menu.alias, FALSE);
@@ -2983,33 +2988,25 @@
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Conversation/Add Buddy Pounce..."));
 
-	gtkwin->menu.alias =
-		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Alias..."));
+	/* --- */
 
 	gtkwin->menu.get_info =
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Conversation/Get Info"));
 
+	gtkwin->menu.warn =
+		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
+									N_("/Conversation/Warn..."));
+
 	gtkwin->menu.invite =
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Conversation/Invite..."));
 
 	/* --- */
 
-	gtkwin->menu.insert_link =
-		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Insert URL..."));
-
-	gtkwin->menu.insert_image =
+	gtkwin->menu.alias =
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Insert Image..."));
-
-	/* --- */
-
-	gtkwin->menu.warn =
-		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
-									N_("/Conversation/Warn..."));
+									N_("/Conversation/Alias..."));
 
 	gtkwin->menu.block =
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
@@ -3025,6 +3022,16 @@
 
 	/* --- */
 
+	gtkwin->menu.insert_link =
+		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
+									N_("/Conversation/Insert Link..."));
+
+	gtkwin->menu.insert_image =
+		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
+									N_("/Conversation/Insert Image..."));
+
+	/* --- */
+
 	gtkwin->menu.logging =
 		gtk_item_factory_get_widget(gtkwin->menu.item_factory,
 									N_("/Options/Enable Logging"));
@@ -4006,17 +4013,17 @@
 		/* Setup the font face */
 		gaim_gtkconv_update_font_face(conv);
 
-		if (conv_type == GAIM_CONV_CHAT) {
-			gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane));
-
-			pane = setup_chat_pane(conv);
-		}
-		else if (conv_type == GAIM_CONV_IM) {
+		if (conv_type == GAIM_CONV_IM) {
 			gtkconv->u.im = g_malloc0(sizeof(GaimGtkImPane));
 			gtkconv->u.im->a_virgin = TRUE;
 
 			pane = setup_im_pane(conv);
 		}
+		else if (conv_type == GAIM_CONV_CHAT) {
+			gtkconv->u.chat = g_malloc0(sizeof(GaimGtkChatPane));
+
+			pane = setup_chat_pane(conv);
+		}
 
 		if (pane == NULL) {
 			if      (conv_type == GAIM_CONV_CHAT) g_free(gtkconv->u.chat);
--- a/src/stock.c	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/stock.c	Sun Dec 14 23:59:14 2003 +0000
@@ -64,7 +64,6 @@
 	{ GAIM_STOCK_LOGO,            "gaim",    "logo.png"                 },
 	{ GAIM_STOCK_MODIFY,          NULL,      GTK_STOCK_PREFERENCES      },
 	{ GAIM_STOCK_PAUSE,           "buttons", "pause.png"                },
-	{ GAIM_STOCK_PRIVACY,         NULL,      GTK_STOCK_PROPERTIES       },
 	{ GAIM_STOCK_OPEN_MAIL,       NULL,      GTK_STOCK_JUMP_TO          },
 	{ GAIM_STOCK_SEND,            "buttons", "send-im.png"              },
 	{ GAIM_STOCK_SIGN_ON,         NULL,      GTK_STOCK_EXECUTE          },
--- a/src/stock.h	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/stock.h	Sun Dec 14 23:59:14 2003 +0000
@@ -61,7 +61,6 @@
 #define GAIM_STOCK_MODIFY          "gaim-modify"
 #define GAIM_STOCK_OPEN_MAIL       "gaim-stock-open-mail"
 #define GAIM_STOCK_PAUSE           "gaim-pause"
-#define GAIM_STOCK_PRIVACY         "gaim-privacy"
 #define GAIM_STOCK_SEND            "gaim-send"
 #define GAIM_STOCK_SIGN_OFF        "gaim-sign-off"
 #define GAIM_STOCK_SIGN_ON         "gaim-sign-on"
--- a/src/ui.h	Sun Dec 14 23:55:39 2003 +0000
+++ b/src/ui.h	Sun Dec 14 23:59:14 2003 +0000
@@ -122,7 +122,7 @@
 extern void alias_dialog_bud(GaimBuddy *);
 extern void alias_dialog_contact(GaimContact *);
 extern void alias_dialog_blist_chat(GaimChat *);
-extern void show_warn_dialog(GaimConnection *, char *);
+extern void show_warn_dialog(GaimConnection *, const char *);
 extern void show_im_dialog();
 extern void show_info_dialog();
 extern void destroy_all_dialogs();