aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/gnunet-conversation-gtk.c12
-rw-r--r--src/conversation/gnunet-conversation-gtk.h7
-rw-r--r--src/conversation/gnunet-conversation-gtk_contacts.c67
3 files changed, 44 insertions, 42 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 010194f2..f6675966 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -1072,9 +1072,15 @@ call_event_handler (void *cls,
1072 * 1072 *
1073 * @param arg arguments given to the command 1073 * @param arg arguments given to the command
1074 */ 1074 */
1075extern void 1075void
1076do_call (const char *arg) 1076GSC_do_call (const char *arg)
1077{ 1077{
1078 GtkEntry *address_entry;
1079
1080 address_entry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_address"));
1081 gtk_entry_set_text (address_entry,
1082 address);
1083
1078 if (NULL == caller_id) 1084 if (NULL == caller_id)
1079 { 1085 {
1080 GCG_log (_("Ego `%s' not available\n"), ego_name); 1086 GCG_log (_("Ego `%s' not available\n"), ego_name);
@@ -1556,7 +1562,7 @@ GNUNET_CONVERSATION_GTK_on_call_clicked ()
1556 1562
1557 address_entry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_address")); 1563 address_entry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_address"));
1558 1564
1559 do_call (gtk_entry_get_text(address_entry)); 1565 GSC_do_call (gtk_entry_get_text(address_entry));
1560 //disable_button ("GNUNET_GTK_conversation_accept_button"); 1566 //disable_button ("GNUNET_GTK_conversation_accept_button");
1561 do_status (); 1567 do_status ();
1562// free(to_addr); 1568// free(to_addr);
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h
index 66c0be7b..1064be4e 100644
--- a/src/conversation/gnunet-conversation-gtk.h
+++ b/src/conversation/gnunet-conversation-gtk.h
@@ -187,8 +187,13 @@ GCG_log (const char *message,
187 ...); 187 ...);
188 188
189 189
190/**
191 * Initiate a call to the given address.
192 *
193 * @param address address to call
194 */
190extern void 195extern void
191do_call(const char*); 196GSC_do_call (const char *address);
192 197
193 198
194 199
diff --git a/src/conversation/gnunet-conversation-gtk_contacts.c b/src/conversation/gnunet-conversation-gtk_contacts.c
index 76be3909..70dec478 100644
--- a/src/conversation/gnunet-conversation-gtk_contacts.c
+++ b/src/conversation/gnunet-conversation-gtk_contacts.c
@@ -57,22 +57,12 @@ static struct GNUNET_IDENTITY_Ego *contacts_ego;
57static GtkListStore *contacts_liststore; 57static GtkListStore *contacts_liststore;
58 58
59/** 59/**
60 * zone treeview
61 */
62static GtkTreeView *zone_treeview;
63
64/**
65 * zone tree model
66 */
67static GtkTreeModel *zone_treemodel;
68
69/**
70 * The main tree view for 'gns' that shows the records. 60 * The main tree view for 'gns' that shows the records.
71 */ 61 */
72static GtkTreeView *contacts_treeview; 62static GtkTreeView *contacts_treeview;
73 63
74/** 64/**
75 * Tree model (same object as 'contacts_treestore', just different type). 65 * Tree model of the #contacts_treeview, same objects as #contacts_liststore.
76 */ 66 */
77static GtkTreeModel *contacts_treemodel; 67static GtkTreeModel *contacts_treemodel;
78 68
@@ -292,54 +282,59 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
292 * FIXME: what was clicked where? 282 * FIXME: what was clicked where?
293 */ 283 */
294void 284void
295GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton *button, 285GNUNET_CONVERSATION_GTK_use_current_button_clicked (GtkButton *button,
296 gpointer *user_data) 286 gpointer *user_data)
297{ 287{
298 GtkEntry *addressEntry; 288 GtkEntry *addressEntry;
299 289
300 addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); 290 addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd"));
301 gtk_entry_set_text (addressEntry, 291 gtk_entry_set_text (addressEntry,
302 "FIXME"); 292 "FIXME");
303
304} 293}
305 294
306 295
307/** 296/**
308 * A row was activated in the contacts list. Initiate call. 297 * A row was activated in the contacts list. Initiate call.
309 * 298 *
310 * @return void 299 * @param tree_view view where the row was activated
300 * @param path path to the activated element
301 * @param column column that was activated
302 * @param user_data builder context (unused)
311 */ 303 */
312void 304void
313GNUNET_CONVERSATION_GTK_row_activated () 305GNUNET_CONVERSATION_GTK_row_activated (GtkTreeView *tree_view,
306 GtkTreePath *path,
307 GtkTreeViewColumn *column,
308 gpointer user_data)
314{ 309{
315 char *address; 310 char *address;
316 gchar *type; 311 gchar *type;
317 GtkTreeSelection *selection; 312 GtkTreeIter iter;
318 GtkTreeIter iterA;
319 GtkEntry *address_entry;
320 313
321 selection = gtk_tree_view_get_selection (contacts_treeview); 314 gtk_tree_model_get_iter (contacts_treemodel,
322 gtk_tree_selection_get_selected (selection, &contacts_treemodel, &iterA); 315 path,
316 &iter);
323 gtk_tree_model_get (contacts_treemodel, 317 gtk_tree_model_get (contacts_treemodel,
324 &iterA, 318 &iter,
325 CONTACTS_LS_NAME, &name, 319 CONTACTS_LS_NAME, &name,
326 CONTACTS_LS_TYPE, &type, 320 CONTACTS_LS_TYPE, &type,
327 -1); 321 -1);
328 if (0 == strcmp (type, "PKEY")) 322 if (0 == strcmp (type, "PKEY"))
329 { 323 {
330 GNUNET_asprintf (&address, "call.%s.gnu", name); 324 GNUNET_asprintf (&address,
325 "call.%s.gnu",
326 name);
331 } 327 }
332 else 328 else
333 { 329 {
334 GNUNET_assert (0 == strcmp (type, "PHONE")); 330 GNUNET_assert (0 == strcmp (type, "PHONE"));
335 GNUNET_asprintf (&address, "%s.gnu", name); 331 GNUNET_asprintf (&address,
332 "%s.gnu",
333 name);
336 } 334 }
335 g_free (name);
337 g_free (type); 336 g_free (type);
338 337 GSC_do_call (address);
339 address_entry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_address"));
340 gtk_entry_set_text (address_entry,
341 address);
342 do_call (address);
343 GNUNET_free (address); 338 GNUNET_free (address);
344} 339}
345 340
@@ -395,12 +390,12 @@ display_record (void *cls,
395 390
396 /* check if exists, if so, update or remove */ 391 /* check if exists, if so, update or remove */
397 update = FALSE; 392 update = FALSE;
398 if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (contacts_liststore), 393 if (gtk_tree_model_get_iter_first (contacts_treemodel,
399 &iter)) 394 &iter))
400 { 395 {
401 do 396 do
402 { 397 {
403 gtk_tree_model_get (GTK_TREE_MODEL(contacts_liststore), 398 gtk_tree_model_get (contacts_treemodel,
404 &iter, 399 &iter,
405 CONTACTS_LS_NAME, &lname, 400 CONTACTS_LS_NAME, &lname,
406 -1); 401 -1);
@@ -421,7 +416,7 @@ display_record (void *cls,
421 } 416 }
422 g_free (lname); 417 g_free (lname);
423 } 418 }
424 while (gtk_tree_model_iter_next (GTK_TREE_MODEL(contacts_liststore), 419 while (gtk_tree_model_iter_next (contacts_treemodel,
425 &iter)); 420 &iter));
426 } 421 }
427 422
@@ -497,15 +492,11 @@ GCG_CONTACTS_init ()
497 contacts_liststore 492 contacts_liststore
498 = GTK_LIST_STORE (GCG_get_main_window_object 493 = GTK_LIST_STORE (GCG_get_main_window_object
499 ("gnunet_conversation_gtk_contacts_liststore")); 494 ("gnunet_conversation_gtk_contacts_liststore"));
500 contacts_treemodel = GTK_TREE_MODEL (contacts_liststore); 495 contacts_treemodel
496 = GTK_TREE_MODEL (contacts_liststore);
501 contacts_treeview 497 contacts_treeview
502 = GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_treeview")); 498 = GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_treeview"));
503 // gtk_tree_view_set_activate_on_single_click (contacts_treeview, TRUE); 499 // gtk_tree_view_set_activate_on_single_click (contacts_treeview, TRUE);
504
505 zone_treemodel
506 = GTK_TREE_MODEL (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_liststore"));
507 zone_treeview
508 = GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_zone_treeview"));
509 ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ()); 500 ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ());
510} 501}
511 502