comparison console/gntconv.c @ 13916:fdf2dbed6faa

[gaim-migrate @ 16418] Make the conversation windows bigger ... which is better *wink*. Use Panel library to manage the windows. Add a window-list that you can use to quickly switch to a window (press Alt+w to bring it up). Get rid of some unused codes. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 04 Jul 2006 01:32:39 +0000
parents cc60d0861337
children 9309d27d780c
comparison
equal deleted inserted replaced
13915:e78d113f82db 13916:fdf2dbed6faa
1 #include <string.h> 1 #include <string.h>
2 #include <util.h> 2 #include <util.h>
3 3
4 #include "gntgaim.h" 4 #include "gntgaim.h"
5 #include "gntblist.h"
5 #include "gntconv.h" 6 #include "gntconv.h"
6 7
7 #include "gnt.h" 8 #include "gnt.h"
8 #include "gntbox.h" 9 #include "gntbox.h"
9 #include "gntentry.h" 10 #include "gntentry.h"
89 gg_create_conversation(GaimConversation *conv) 90 gg_create_conversation(GaimConversation *conv)
90 { 91 {
91 GGConv *ggc = g_hash_table_lookup(ggconvs, conv); 92 GGConv *ggc = g_hash_table_lookup(ggconvs, conv);
92 char *title; 93 char *title;
93 GaimConversationType type; 94 GaimConversationType type;
95 int x, width;
94 96
95 if (ggc) 97 if (ggc)
96 return; 98 return;
97 99
100 gg_blist_get_position(&x, NULL);
101 gg_blist_get_size(&width, NULL);
102
98 ggc = g_new0(GGConv, 1); 103 ggc = g_new0(GGConv, 1);
99 g_hash_table_insert(ggconvs, conv, ggc); 104 g_hash_table_insert(ggconvs, conv, ggc);
100 105
101 ggc->conv = conv; 106 ggc->conv = conv;
102 107
103 type = gaim_conversation_get_type(conv); 108 type = gaim_conversation_get_type(conv);
104 title = g_strdup_printf(_("%s"), gaim_conversation_get_name(conv)); 109 title = g_strdup_printf(_("%s"), gaim_conversation_get_name(conv));
105 ggc->window = gnt_box_new(FALSE, TRUE); 110 ggc->window = gnt_box_new(TRUE, TRUE);
106 gnt_box_set_title(GNT_BOX(ggc->window), title); 111 gnt_box_set_title(GNT_BOX(ggc->window), title);
107 gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); 112 gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE);
113 gnt_box_set_pad(GNT_BOX(ggc->window), 0);
108 gnt_widget_set_name(ggc->window, title); 114 gnt_widget_set_name(ggc->window, title);
109 115
110 ggc->tv = gnt_text_view_new(); 116 ggc->tv = gnt_text_view_new();
111 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); 117 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv);
112 gnt_widget_set_name(ggc->tv, "conversation-window-textview"); 118 gnt_widget_set_name(ggc->tv, "conversation-window-textview");
113 gnt_widget_set_size(ggc->tv, getmaxx(stdscr) - 40, getmaxy(stdscr) - 15); 119 gnt_widget_set_size(ggc->tv, getmaxx(stdscr) - 2 - x - width, getmaxy(stdscr) - 4);
114 120
115 ggc->entry = gnt_entry_new(NULL); 121 ggc->entry = gnt_entry_new(NULL);
116 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); 122 gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry);
117 gnt_widget_set_name(ggc->entry, "conversation-window-entry"); 123 gnt_widget_set_name(ggc->entry, "conversation-window-entry");
118 gnt_widget_set_size(ggc->entry, getmaxx(stdscr) - 40, 1);
119 124
120 g_signal_connect(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); 125 g_signal_connect(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc);
121 g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc); 126 g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc);
122 127
123 gnt_widget_set_position(ggc->window, 32, 0); 128 /* XXX: I am assuming the buddylist is on the leftmost corner.
129 * That may not always be correct, since the windows can be moved.
130 * It might be an option to remember the position of conv. windows. */
131 gnt_widget_set_position(ggc->window, x + width, 0);
124 gnt_widget_show(ggc->window); 132 gnt_widget_show(ggc->window);
125 133
126 g_free(title); 134 g_free(title);
127 } 135 }
128 136