changeset 16128:7a2ffa981c1a

Allow adding information widgets in the conversation window.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 15 Apr 2007 21:21:03 +0000
parents 063274e9cb27
children cc5917d70dde
files finch/gntconv.c finch/gntconv.h
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntconv.c	Sun Apr 15 20:25:40 2007 +0000
+++ b/finch/gntconv.c	Sun Apr 15 21:21:03 2007 +0000
@@ -308,6 +308,9 @@
 	gnt_widget_set_size(ggc->tv, purple_prefs_get_int(PREF_ROOT "/size/width"),
 			purple_prefs_get_int(PREF_ROOT "/size/height"));
 
+	ggc->info = gnt_vbox_new(FALSE);
+	gnt_box_add_widget(GNT_BOX(ggc->window), ggc->info);
+
 	ggc->entry = gnt_entry_new(NULL);
 	gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry);
 	gnt_widget_set_name(ggc->entry, "conversation-window-entry");
@@ -742,3 +745,21 @@
 	g_free(title);
 }
 
+void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget)
+{
+	FinchConv *fc = conv->ui_data;
+	int height, width;
+
+	gnt_box_remove_all(GNT_BOX(fc->info));
+
+	if (widget) {
+		gnt_box_add_widget(GNT_BOX(fc->info), widget);
+		gnt_box_readjust(GNT_BOX(fc->info));
+	}
+
+	gnt_widget_get_size(fc->window, &width, &height);
+	gnt_box_readjust(GNT_BOX(fc->window));
+	gnt_screen_resize_widget(fc->window, width, height);
+	gnt_box_give_focus_to_child(GNT_BOX(fc->window), fc->entry);
+}
+
--- a/finch/gntconv.h	Sun Apr 15 20:25:40 2007 +0000
+++ b/finch/gntconv.h	Sun Apr 15 21:21:03 2007 +0000
@@ -47,6 +47,7 @@
 	GntWidget *window;        /* the container */
 	GntWidget *entry;         /* entry */
 	GntWidget *tv;            /* text-view */
+	GntWidget *info;
 
 	union
 	{
@@ -89,6 +90,15 @@
  */
 void finch_conversation_set_active(PurpleConversation *conv);
 
+/**
+ * Sets the information widget for the conversation window.
+ *
+ * @param conv   The conversation.
+ * @param widget The widget containing the information. If @c NULL,
+ *               the current information widget is removed.
+ */
+void finch_conversation_set_info_widget(PurpleConversation *conv, GntWidget *widget);
+
 /*@}*/
 
 #endif