changeset 5907:18486c860a46

[gaim-migrate @ 6339] Added an Add Buddy Pounce menu item to the conversation window. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 16 Jun 2003 21:43:43 +0000
parents 390d32a6b130
children ed8a9a3bf7e2
files src/gtkconv.c src/gtkpounce.c src/gtkpounce.h
diffstat 3 files changed, 29 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Mon Jun 16 05:14:05 2003 +0000
+++ b/src/gtkconv.c	Mon Jun 16 21:43:43 2003 +0000
@@ -44,6 +44,7 @@
 #include "gtkblist.h"
 #include "gtkconv.h"
 #include "gtkimhtml.h"
+#include "gtkpounce.h"
 #include "gtkutils.h"
 #include "stock.h"
 
@@ -296,6 +297,19 @@
 
 	conv_show_log(NULL, (char *)gaim_conversation_get_name(conv));
 }
+
+static void
+menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget)
+{
+	GaimWindow *win = (GaimWindow *)data;
+	GaimConversation *conv;
+
+	conv = gaim_window_get_active_conversation(win);
+
+	gaim_gtkpounce_dialog_show(gaim_conversation_get_account(conv),
+							   gaim_conversation_get_name(conv), NULL);
+}
+
 static void
 menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
 {
@@ -2554,11 +2568,14 @@
 	  "<StockItem>", GTK_STOCK_SAVE_AS },
 	{ N_("/Conversation/View _Log..."), NULL, menu_view_log_cb, 0, NULL },
 	{ "/Conversation/sep1", NULL, NULL, 0, "<Separator>" },
+	{ N_("/Conversation/Add Buddy _Pounce..."), NULL, menu_add_pounce_cb,
+		0, NULL },
+	{ "/Conversation/sep2", NULL, NULL, 0, "<Separator>" },
 	{ N_("/Conversation/Insert _URL..."), NULL, menu_insert_link_cb, 0,
 	  "<StockItem>", GAIM_STOCK_LINK },
 	{ N_("/Conversation/Insert _Image..."), NULL, menu_insert_image_cb, 0,
 	  "<StockItem>", GAIM_STOCK_IMAGE },
-	{ "/Conversation/sep2", NULL, NULL, 0, "<Separator>" },
+	{ "/Conversation/sep3", NULL, NULL, 0, "<Separator>" },
 	{ N_("/Conversation/_Close"), NULL, menu_close_conv_cb, 0,
 	  "<StockItem>", GTK_STOCK_CLOSE },
 
--- a/src/gtkpounce.c	Mon Jun 16 05:14:05 2003 +0000
+++ b/src/gtkpounce.c	Mon Jun 16 21:43:43 2003 +0000
@@ -336,7 +336,7 @@
 }
 
 void
-gaim_gtkpounce_dialog_show(struct buddy *buddy,
+gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name,
 						   GaimPounce *cur_pounce)
 {
 	GaimGtkPounceDialog *dialog;
@@ -359,9 +359,9 @@
 		dialog->pounce  = cur_pounce;
 		dialog->account = gaim_pounce_get_pouncer(cur_pounce);
 	}
-	else if (buddy != NULL) {
+	else if (account != NULL) {
 		dialog->pounce  = NULL;
-		dialog->account = buddy->account;
+		dialog->account = account;
 	}
 	else {
 		dialog->pounce  = NULL;
@@ -437,8 +437,8 @@
 		gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry),
 						   gaim_pounce_get_pouncee(cur_pounce));
 	}
-	else if (buddy != NULL) {
-		gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name);
+	else if (name != NULL) {
+		gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), name);
 	}
 
 	/* Create the "Pounce When" frame. */
@@ -708,7 +708,7 @@
 static void
 new_pounce_cb(GtkWidget *w, struct buddy *b)
 {
-	gaim_gtkpounce_dialog_show(b, NULL);
+	gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
 }
 
 static void
@@ -720,12 +720,7 @@
 static void
 edit_pounce_cb(GtkWidget *w, GaimPounce *pounce)
 {
-	struct buddy *buddy;
-
-	buddy = gaim_find_buddy(gaim_pounce_get_pouncer(pounce),
-							gaim_pounce_get_pouncee(pounce));
-
-	gaim_gtkpounce_dialog_show(buddy, pounce);
+	gaim_gtkpounce_dialog_show(NULL, NULL, pounce);
 }
 
 static void
--- a/src/gtkpounce.h	Mon Jun 16 05:14:05 2003 +0000
+++ b/src/gtkpounce.h	Mon Jun 16 21:43:43 2003 +0000
@@ -28,10 +28,12 @@
 /**
  * Displays a New Buddy Pounce or Edit Buddy Pounce dialog.
  *
- * @param buddy      The optional buddy to pounce on.
+ * @param account    The optional account to use.
+ * @param name       The optional name to pounce on.
  * @param cur_pounce The current buddy pounce, if editting an existing one.
  */
-void gaim_gtkpounce_dialog_show(struct buddy *buddy, GaimPounce *cur_pounce);
+void gaim_gtkpounce_dialog_show(GaimAccount *account, const char *name,
+								GaimPounce *cur_pounce);
 
 /**
  * Displays all registered buddy pounces in a menu.