aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-05-26 08:59:30 +0000
committerChristian Grothoff <christian@grothoff.org>2014-05-26 08:59:30 +0000
commit36078baada6d2ac1130a6a0b1e40c6f40b9dabc8 (patch)
tree372d29d5a5c1187ef0b983162583678360c13d70
parentd873186d5e3dd45e68908c501ca31df2d770582e (diff)
downloadgnunet-gtk-36078baada6d2ac1130a6a0b1e40c6f40b9dabc8.tar.gz
gnunet-gtk-36078baada6d2ac1130a6a0b1e40c6f40b9dabc8.zip
-a bit more cleanup
-rw-r--r--src/conversation/gnunet-conversation-gtk.c55
-rw-r--r--src/conversation/gnunet-conversation-gtk_contacts.c98
-rw-r--r--src/conversation/gnunet-conversation-gtk_contacts.h22
3 files changed, 50 insertions, 125 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 481c2d61..622db57f 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -383,17 +383,13 @@ print_call_info ()
383 gpointer cl_caller; 383 gpointer cl_caller;
384 gpointer cl_call; 384 gpointer cl_call;
385 385
386 gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gtkiter, 386 gtk_tree_model_get (GTK_TREE_MODEL (active_liststore),
387 &gtkiter,
387 AL_caller, &cl_caller, 388 AL_caller, &cl_caller,
388 AL_caller_id, &str_data, 389 AL_caller_id, &str_data,
389 AL_caller_num, &int_data, 390 AL_caller_num, &int_data,
390 AL_call, &cl_call, 391 AL_call, &cl_call,
391 -1); 392 -1);
392 if (caller_selected == cl_caller)
393 {
394 currentlySelectedCallAddress = str_data;
395 break;
396 }
397 if (call_selected == cl_call) 393 if (call_selected == cl_call)
398 { 394 {
399 GCG_log (_("info for active outgoing call:%s number: %u row: %u"), 395 GCG_log (_("info for active outgoing call:%s number: %u row: %u"),
@@ -1529,28 +1525,19 @@ run (void *cls,
1529 main_window = GTK_WINDOW (GCG_get_main_window_object ("GNUNET_GTK_conversation_window")); 1525 main_window = GTK_WINDOW (GCG_get_main_window_object ("GNUNET_GTK_conversation_window"));
1530 main_window = 1526 main_window =
1531 GTK_WINDOW (GNUNET_GTK_plug_me 1527 GTK_WINDOW (GNUNET_GTK_plug_me
1532 ("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET (main_window))); 1528 ("GNUNET_CONVERSATION_GTK_PLUG",
1533 gtk_window_set_default_size (main_window, 700, 700); 1529 GTK_WIDGET (main_window)));
1534
1535 // active calls 1530 // active calls
1536 active_liststore = 1531 active_liststore =
1537 GTK_LIST_STORE (GCG_get_main_window_object ("gnunet_conversation_gtk_active_calls_liststore")); 1532 GTK_LIST_STORE (GCG_get_main_window_object ("gnunet_conversation_gtk_active_calls_liststore"));
1538 active_treeview = 1533 active_treeview =
1539 GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_active_calls_treeview")); 1534 GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_active_calls_treeview"));
1540 1535
1541
1542
1543 // gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
1544
1545
1546 // gtk_window_maximize (GTK_WINDOW (main_window));
1547
1548 if (NULL == getenv ("GNUNET_CONVERSATION_GTK_PLUG")) 1536 if (NULL == getenv ("GNUNET_CONVERSATION_GTK_PLUG"))
1549 GNUNET_GTK_tray_icon_create (ml, GTK_WINDOW (main_window), 1537 GNUNET_GTK_tray_icon_create (ml, GTK_WINDOW (main_window),
1550 "gnunet-conversation-gtk" 1538 "gnunet-conversation-gtk"
1551 /* FIXME: different icon? */ , 1539 /* FIXME: different icon? */ ,
1552 "gnunet-conversation-gtk"); 1540 "gnunet-conversation-gtk");
1553
1554 /* make GUI visible */ 1541 /* make GUI visible */
1555 if (!tray_only) 1542 if (!tray_only)
1556 { 1543 {
@@ -1559,33 +1546,26 @@ run (void *cls,
1559 } 1546 }
1560 1547
1561 /* get gui objects */ 1548 /* get gui objects */
1562 1549 if (debug_box_enabled)
1563 if(debug_box_enabled) 1550 gtk_widget_show (GTK_WIDGET (GCG_get_main_window_object ("GNUNET_CONVERSATION_log_box")));
1564 { 1551 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
1565 gtk_widget_show(GTK_WIDGET(GCG_get_main_window_object("GNUNET_CONVERSATION_log_box"))); 1552 &shutdown_task,
1566 }
1567 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
1568 NULL); 1553 NULL);
1569
1570 cfg = GNUNET_CONFIGURATION_dup (GCG_get_configuration ()); 1554 cfg = GNUNET_CONFIGURATION_dup (GCG_get_configuration ());
1571
1572 speaker = GNUNET_SPEAKER_create_from_hardware (cfg); 1555 speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
1573 mic = GNUNET_MICROPHONE_create_from_hardware (cfg); 1556 mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
1574
1575 b_contact = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_use_current_button")); 1557 b_contact = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_use_current_button"));
1576 b_accept = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_accept_button")); 1558 b_accept = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_accept_button"));
1577 b_hangup = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_hangup_button")); 1559 b_hangup = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_hangup_button"));
1578 b_suspend = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_suspend_button")); 1560 b_suspend = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_suspend_button"));
1579 b_resume = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_resume_button")); 1561 b_resume = GTK_WIDGET (GCG_get_main_window_object ("GNUNET_GTK_conversation_resume_button"));
1580
1581 if (NULL == ego_name) 1562 if (NULL == ego_name)
1582 { 1563 {
1583 ego_name = "phone-ego"; 1564 ego_name = "phone-ego";
1584 GCG_log (_("No ego given, using default: %s "), ego_name); 1565 GCG_log (_("No ego given, using default: %s "), ego_name);
1585
1586 } 1566 }
1587 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); 1567 id = GNUNET_IDENTITY_connect (cfg,
1588 1568 &identity_cb, NULL);
1589 GNUNET_CONVERSATION_GTK_CONTACTS_init (); 1569 GNUNET_CONVERSATION_GTK_CONTACTS_init ();
1590} 1570}
1591 1571
@@ -1604,34 +1584,35 @@ main (int argc, char *const *argv)
1604 {'p', "phone", "LINE", 1584 {'p', "phone", "LINE",
1605 gettext_noop ("sets the LINE to use for the phone"), 1585 gettext_noop ("sets the LINE to use for the phone"),
1606 1, &GNUNET_GETOPT_set_uint, &line}, 1586 1, &GNUNET_GETOPT_set_uint, &line},
1607
1608 {'e', "ego", "ego", 1587 {'e', "ego", "ego",
1609 gettext_noop ("select ego to use"), 1, 1588 gettext_noop ("select ego to use"), 1,
1610 &GNUNET_GETOPT_set_string, &ego_name}, 1589 &GNUNET_GETOPT_set_string, &ego_name},
1611
1612 {'d', "debug_box", "1 or 0", 1590 {'d', "debug_box", "1 or 0",
1613 gettext_noop ("enable debug box"), 1, 1591 gettext_noop ("enable debug box"), 1,
1614 &GNUNET_GETOPT_set_uint, &debug_box_enabled}, 1592 &GNUNET_GETOPT_set_uint, &debug_box_enabled},
1615
1616
1617 {'t', "tray", NULL, 1593 {'t', "tray", NULL,
1618 gettext_noop ("start in tray mode"), 0, 1594 gettext_noop ("start in tray mode"), 0,
1619 &GNUNET_GETOPT_set_one, &tray_only}, 1595 &GNUNET_GETOPT_set_one, &tray_only},
1620 GNUNET_GETOPT_OPTION_END 1596 GNUNET_GETOPT_OPTION_END
1621 }; 1597 };
1598 int ret;
1599
1622 if (GNUNET_OK != 1600 if (GNUNET_OK !=
1623 GNUNET_GTK_main_loop_start ("gnunet-conversation-gtk", 1601 GNUNET_GTK_main_loop_start ("gnunet-conversation-gtk",
1624 "GTK GUI for conversation", argc, argv, 1602 "GTK GUI for conversation",
1603 argc, argv,
1625 options, 1604 options,
1626 "gnunet_conversation_gtk_main_window.glade", 1605 "gnunet_conversation_gtk_main_window.glade",
1627 &run)) 1606 &run))
1628 return 1; 1607 ret = 1;
1608 else
1609 ret = 0;
1629 if (NULL != cfg) 1610 if (NULL != cfg)
1630 { 1611 {
1631 GNUNET_CONFIGURATION_destroy (cfg); 1612 GNUNET_CONFIGURATION_destroy (cfg);
1632 cfg = NULL; 1613 cfg = NULL;
1633 } 1614 }
1634 return 0; 1615 return ret;
1635} 1616}
1636 1617
1637 1618
diff --git a/src/conversation/gnunet-conversation-gtk_contacts.c b/src/conversation/gnunet-conversation-gtk_contacts.c
index 0316db5f..fec7dac1 100644
--- a/src/conversation/gnunet-conversation-gtk_contacts.c
+++ b/src/conversation/gnunet-conversation-gtk_contacts.c
@@ -26,61 +26,22 @@
26 */ 26 */
27#include "gnunet-conversation-gtk.h" 27#include "gnunet-conversation-gtk.h"
28 28
29
30//#include "gnunet/gnunet_gnsrecord_lib.h"
31
32
33
34///////////////////
35//addressbook
36//#include "gnunet_gtk.h"
37
38//#include "gnunet/gnunet_identity_service.h"
39//#include "gnunet/gnunet_namestore_service.h"
40//#include "gnunet/gnunet_gnsrecord_lib.h"
41
42/*************
43 * contacts *
44 *************/
45
46/** 29/**
47 * Our ego. 30 * Our ego.
48 */ 31 */
49static struct GNUNET_IDENTITY_Ego *contacts_ego; 32static struct GNUNET_IDENTITY_Ego *contacts_ego;
50 33
51
52
53//static struct GNUNET_CONFIGURATION_Handle *cfg1;
54//static struct GNUNET_CONFIGURATION_Handle *cfg2;
55
56
57
58char *currentlySelectedCallAddress;
59
60//static void
61//identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
62// const char *name);
63
64
65/** 34/**
66 * List of contacts (records). 35 * List of contacts (records).
67 */ 36 */
68static GtkListStore *contacts_liststore; 37static GtkListStore *contacts_liststore;
69 38
70
71/** 39/**
72 * list of zones 40 * list of zones
73 */ 41 */
74static GtkListStore *zone_liststore; 42static GtkListStore *zone_liststore;
75 43
76/** 44/**
77 * zone treestore
78 */
79/*
80static GtkTreeStore *zone_treestore;
81*/
82
83/**
84 * zone treeview 45 * zone treeview
85 */ 46 */
86static GtkTreeView *zone_treeview; 47static GtkTreeView *zone_treeview;
@@ -90,13 +51,6 @@ static GtkTreeView *zone_treeview;
90 */ 51 */
91static GtkTreeModel *zone_treemodel; 52static GtkTreeModel *zone_treemodel;
92 53
93
94
95/**
96 * List of contacts.
97 */
98//static GtkTreeStore *contacts_treestore;
99
100/** 54/**
101 * The main tree view for 'gns' that shows the records. 55 * The main tree view for 'gns' that shows the records.
102 */ 56 */
@@ -114,13 +68,12 @@ static struct GNUNET_NAMESTORE_ZoneIterator *list_it;
114 68
115 69
116static struct GNUNET_IDENTITY_Ego *currentAddressBookEgo; 70static struct GNUNET_IDENTITY_Ego *currentAddressBookEgo;
71
117/** 72/**
118 * Handle to identity service. 73 * Handle to identity service.
119 */ 74 */
120static struct GNUNET_IDENTITY_Handle *id; 75static struct GNUNET_IDENTITY_Handle *id;
121 76
122
123
124/** 77/**
125 * Handle to the namestore. 78 * Handle to the namestore.
126 */ 79 */
@@ -132,19 +85,9 @@ static struct GNUNET_NAMESTORE_Handle *ns;
132static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey; 85static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey;
133 86
134/** 87/**
135 * Public key of the zone we are currently editing.
136 */
137/*
138static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
139*/
140
141
142
143
144/**
145 * Name of the records to add/list/remove. 88 * Name of the records to add/list/remove.
146 */ 89 */
147 static char *name; 90static char *name;
148 91
149/** 92/**
150 * Queue entry for the 'add' operation. 93 * Queue entry for the 'add' operation.
@@ -157,7 +100,6 @@ static struct GNUNET_NAMESTORE_QueueEntry *add_qe;
157static struct GNUNET_NAMESTORE_QueueEntry *del_qe; 100static struct GNUNET_NAMESTORE_QueueEntry *del_qe;
158 101
159 102
160
161//////////////////////////// 103////////////////////////////
162static void 104static void
163display_record (void *cls, 105display_record (void *cls,
@@ -166,10 +108,9 @@ display_record (void *cls,
166 unsigned int rd_len, 108 unsigned int rd_len,
167 const struct GNUNET_GNSRECORD_Data *rd) 109 const struct GNUNET_GNSRECORD_Data *rd)
168{ 110{
169/* const char *typestring;*/ 111 char *s;
170 char *s, *type; 112 char *type;
171 unsigned int i; 113 unsigned int i;
172/* const char *ets;*/
173 struct GNUNET_TIME_Absolute at; 114 struct GNUNET_TIME_Absolute at;
174 struct GNUNET_TIME_Relative rt; 115 struct GNUNET_TIME_Relative rt;
175 GtkTreeIter display_iter; 116 GtkTreeIter display_iter;
@@ -320,6 +261,7 @@ add_continuation (void *cls, int32_t success, const char *emsg)
320 //test_finished (); 261 //test_finished ();
321} 262}
322 263
264
323/** 265/**
324 * Continuation called to notify client about result of the 266 * Continuation called to notify client about result of the
325 * operation. 267 * operation.
@@ -347,13 +289,15 @@ del_continuation (void *cls, int32_t success, const char *emsg)
347 // test_finished (); 289 // test_finished ();
348} 290}
349 291
350/* 292
293/**
351 * add a new contact 294 * add a new contact
352 * @param name 295 * @param name
353 * @param address 296 * @param address
354 */ 297 */
355static void 298static void
356add_contact (const gchar * name, const gchar * address) 299add_contact (const gchar *name,
300 const gchar *address)
357{ 301{
358// memmove(&address+1,&address+51,1); 302// memmove(&address+1,&address+51,1);
359 GtkTreeIter iter; 303 GtkTreeIter iter;
@@ -469,16 +413,16 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
469 } 413 }
470} 414}
471 415
416
472void 417void
473GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton * button, 418GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton *button,
474 gpointer * user_data) 419 gpointer *user_data)
475{ 420{
476 GtkEntry *addressEntry; 421 GtkEntry *addressEntry;
477// FPRINTF(stderr,"on current clicked %s\n",callerName); 422
478 //char *strippedAddress; 423 addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd"));
479 addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); 424 gtk_entry_set_text (addressEntry,
480 currentlySelectedCallAddress[52] = '\0'; 425 "FIXME");
481 gtk_entry_set_text(addressEntry, currentlySelectedCallAddress);
482 426
483} 427}
484 428
@@ -606,20 +550,19 @@ gnunet_conversation_gtk_contacts_zone_combobox_changed_cb (GtkComboBox *widget,
606 550
607 551
608////// 552//////
609extern void 553void
610GNUNET_CONVERSATION_GTK_CONTACTS_init () 554GNUNET_CONVERSATION_GTK_CONTACTS_init ()
611{ 555{
612 GtkTreeIter iterContactsInit; 556 GtkTreeIter iterContactsInit;
613 557
614
615
616
617 // contacts 558 // contacts
618 contacts_liststore = 559 contacts_liststore =
619 GTK_LIST_STORE (GCG_get_main_window_object 560 GTK_LIST_STORE (GCG_get_main_window_object
620 ("gnunet_conversation_gtk_contacts_liststore")); 561 ("gnunet_conversation_gtk_contacts_liststore"));
621 contacts_treeview = 562 contacts_treeview =
622 GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_treeview")); 563 GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_treeview"));
564
565 // gtk_tree_view_set_activate_on_single_click (contacts_treeview, TRUE);
623 contacts_treemodel = GTK_TREE_MODEL (contacts_liststore); 566 contacts_treemodel = GTK_TREE_MODEL (contacts_liststore);
624 567
625 // zone list 568 // zone list
@@ -646,7 +589,8 @@ GNUNET_CONVERSATION_GTK_CONTACTS_init ()
646 589
647} 590}
648 591
649extern void 592
593void
650GNUNET_CONVERSATION_GTK_CONTACTS_shutdown() 594GNUNET_CONVERSATION_GTK_CONTACTS_shutdown()
651{ 595{
652 596
diff --git a/src/conversation/gnunet-conversation-gtk_contacts.h b/src/conversation/gnunet-conversation-gtk_contacts.h
index 0e171c8a..a4c61d51 100644
--- a/src/conversation/gnunet-conversation-gtk_contacts.h
+++ b/src/conversation/gnunet-conversation-gtk_contacts.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors) 3 (C) 2010-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -19,11 +19,14 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file src/conversation/gnunet-conversation-gtk_history.h 22 * @file src/conversation/gnunet-conversation-gtk_contacts.h
23 * @brief 23 * @brief
24 * @author yids 24 * @author yids
25 * @author hark 25 * @author hark
26 */ 26 */
27#ifndef GNUNET_CONVERSATION_GTK_CONTACTS_H
28#define GNUNET_CONVERSATION_GTK_CONTACTS_H
29
27/* 30/*
28extern void 31extern void
29display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 32display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
@@ -31,20 +34,17 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
31 const struct GNUNET_GNSRECORD_Data *rd); 34 const struct GNUNET_GNSRECORD_Data *rd);
32*/ 35*/
33 36
34extern char *currentlySelectedCallAddress;
35
36/** 37/**
37 * function to initialize the contact list 38 * function to initialize the contact list
38*/ 39 */
39
40extern void 40extern void
41GNUNET_CONVERSATION_GTK_CONTACTS_init (); 41GNUNET_CONVERSATION_GTK_CONTACTS_init ();
42 42
43/**
44 * function to shutdown the contact list
45*/
46 43
44/**
45 * function to shutdown the contact list
46 */
47extern void 47extern void
48GNUNET_CONVERSATION_GTK_CONTACTS_shutdown(); 48GNUNET_CONVERSATION_GTK_CONTACTS_shutdown();
49 49
50 50#endif