diff options
Diffstat (limited to 'src/plugins/chat/chat.c')
-rw-r--r-- | src/plugins/chat/chat.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/plugins/chat/chat.c b/src/plugins/chat/chat.c index 159627f0..fb3b609a 100644 --- a/src/plugins/chat/chat.c +++ b/src/plugins/chat/chat.c | |||
@@ -49,6 +49,7 @@ struct GNUNET_CHAT_safe_nick_write_struct | |||
49 | struct GNUNET_CHAT_gui_chat_client | 49 | struct GNUNET_CHAT_gui_chat_client |
50 | { | 50 | { |
51 | struct GNUNET_CHAT_gui_chat_client *next; | 51 | struct GNUNET_CHAT_gui_chat_client *next; |
52 | GtkWidget * send_button; | ||
52 | GtkWidget * text_view; | 53 | GtkWidget * text_view; |
53 | GtkListStore * nick_model; | 54 | GtkListStore * nick_model; |
54 | GtkWidget *chatFrame; | 55 | GtkWidget *chatFrame; |
@@ -90,18 +91,18 @@ write_save_call (void *arg) | |||
90 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (cls->text_view)); | 91 | buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (cls->text_view)); |
91 | message_buf_size = | 92 | message_buf_size = |
92 | snprintf (NULL, 0, | 93 | snprintf (NULL, 0, |
93 | "<%s> %s\n", | 94 | "<%s>: %s\n", |
94 | cls->sender, | 95 | cls->sender, |
95 | cls->message); | 96 | cls->message); |
96 | message_buf = GNUNET_malloc (message_buf_size + 1); | 97 | message_buf = GNUNET_malloc (message_buf_size + 1); |
97 | GNUNET_snprintf (message_buf, | 98 | GNUNET_snprintf (message_buf, |
98 | message_buf_size + 1, | 99 | message_buf_size + 1, |
99 | "<%s> %s\n", | 100 | "<%s>: %s\n", |
100 | cls->sender, | 101 | cls->sender, |
101 | cls->message); | 102 | cls->message); |
102 | gtk_text_buffer_insert_at_cursor (buffer, | 103 | gtk_text_buffer_insert_at_cursor (buffer, |
103 | message_buf, | 104 | message_buf, |
104 | message_buf_size + 1); | 105 | message_buf_size); |
105 | GNUNET_free(message_buf); | 106 | GNUNET_free(message_buf); |
106 | return NULL; | 107 | return NULL; |
107 | } | 108 | } |
@@ -116,7 +117,7 @@ add_nick_save_call (void *arg) | |||
116 | GtkListStore * model; | 117 | GtkListStore * model; |
117 | GtkTreeIter iter; | 118 | GtkTreeIter iter; |
118 | GNUNET_HashCode * pid; | 119 | GNUNET_HashCode * pid; |
119 | 120 | ||
120 | model = GTK_LIST_STORE (cls->model); | 121 | model = GTK_LIST_STORE (cls->model); |
121 | gtk_list_store_append (model, &iter); | 122 | gtk_list_store_append (model, &iter); |
122 | pid = GNUNET_malloc(sizeof(GNUNET_HashCode)); | 123 | pid = GNUNET_malloc(sizeof(GNUNET_HashCode)); |
@@ -238,16 +239,14 @@ member_list_callback (void *cls, | |||
238 | void | 239 | void |
239 | on_chat_frame_send_button_click_event_chat (GtkWidget * widget, gpointer data) | 240 | on_chat_frame_send_button_click_event_chat (GtkWidget * widget, gpointer data) |
240 | { | 241 | { |
241 | GtkWidget *chatnotebook; | ||
242 | unsigned int seq; | 242 | unsigned int seq; |
243 | const char *message; | 243 | const char *message; |
244 | struct GNUNET_CHAT_gui_chat_client *pos; | 244 | struct GNUNET_CHAT_gui_chat_client *pos; |
245 | 245 | ||
246 | chatnotebook = gtk_widget_get_ancestor (widget, GTK_TYPE_NOTEBOOK); | ||
247 | GNUNET_mutex_lock(lock); | 246 | GNUNET_mutex_lock(lock); |
248 | pos = list; | 247 | pos = list; |
249 | while ( (pos != NULL) && | 248 | while ( (pos != NULL) && |
250 | (pos->chatFrame != chatnotebook) ) | 249 | (pos->send_button != widget) ) |
251 | pos = pos->next; | 250 | pos = pos->next; |
252 | GNUNET_GE_ASSERT(NULL, pos != NULL); | 251 | GNUNET_GE_ASSERT(NULL, pos != NULL); |
253 | 252 | ||
@@ -257,6 +256,7 @@ on_chat_frame_send_button_click_event_chat (GtkWidget * widget, gpointer data) | |||
257 | GNUNET_CHAT_MSG_OPTION_NONE, | 256 | GNUNET_CHAT_MSG_OPTION_NONE, |
258 | NULL, &seq); | 257 | NULL, &seq); |
259 | gtk_entry_set_text (GTK_ENTRY(pos->chat_entry), ""); | 258 | gtk_entry_set_text (GTK_ENTRY(pos->chat_entry), ""); |
259 | GNUNET_mutex_unlock(lock); | ||
260 | } | 260 | } |
261 | 261 | ||
262 | /** FIXME: move to gtkcommon! */ | 262 | /** FIXME: move to gtkcommon! */ |
@@ -299,21 +299,21 @@ create_chat_room_tab (const char *room_name, | |||
299 | client->chatFrame = extractMainWidgetFromWindow (client->chatXML, | 299 | client->chatFrame = extractMainWidgetFromWindow (client->chatXML, |
300 | "chatFrame"); | 300 | "chatFrame"); |
301 | chatLabel = gtk_label_new (room_name); | 301 | chatLabel = gtk_label_new (room_name); |
302 | gtk_notebook_insert_page (GTK_NOTEBOOK (chatnotebook), | 302 | gtk_notebook_append_page (GTK_NOTEBOOK (chatnotebook), |
303 | client->chatFrame, | 303 | client->chatFrame, |
304 | chatLabel, 1); | 304 | chatLabel); |
305 | gtk_widget_show (client->chatFrame); | 305 | gtk_widget_show (chatnotebook); |
306 | gtk_widget_show (chatLabel); | ||
307 | 306 | ||
308 | client->nick_model = gtk_list_store_new (CHAT_NUM, | 307 | client->nick_model = gtk_list_store_new (CHAT_NUM, |
309 | G_TYPE_STRING, /* nickname */ | 308 | G_TYPE_STRING, /* nickname */ |
310 | G_TYPE_POINTER, /* metadata */ | 309 | G_TYPE_POINTER, /* metadata */ |
311 | GDK_TYPE_PIXBUF, /* icon */ | 310 | GDK_TYPE_PIXBUF, /* icon */ |
312 | G_TYPE_POINTER); /* pid */ | 311 | G_TYPE_POINTER); /* pid */ |
312 | client->send_button = glade_xml_get_widget (client->chatXML, "chatSendButton"); | ||
313 | client->text_view = glade_xml_get_widget (client->chatXML, "chatLogViewer"); | 313 | client->text_view = glade_xml_get_widget (client->chatXML, "chatLogViewer"); |
314 | client->chat_entry = glade_xml_get_widget (client->chatXML, "chatLineTextEntry"); | 314 | client->chat_entry = glade_xml_get_widget (client->chatXML, "chatLineTextEntry"); |
315 | treeview = GTK_TREE_VIEW(glade_xml_get_widget (client->chatXML, "roomMembersTreeView")); | 315 | treeview = GTK_TREE_VIEW(glade_xml_get_widget (client->chatXML, "roomMembersTreeView")); |
316 | gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (list->nick_model)); | 316 | gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (client->nick_model)); |
317 | 317 | ||
318 | renderer = gtk_cell_renderer_text_new (); | 318 | renderer = gtk_cell_renderer_text_new (); |
319 | col = gtk_tree_view_insert_column_with_attributes (treeview, | 319 | col = gtk_tree_view_insert_column_with_attributes (treeview, |