diff options
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.c')
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 162 |
1 files changed, 33 insertions, 129 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index 38c8082a..e7b8cf7e 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -25,25 +25,9 @@ | |||
25 | * @author hark | 25 | * @author hark |
26 | */ | 26 | */ |
27 | #include "gnunet-conversation-gtk_common.h" | 27 | #include "gnunet-conversation-gtk_common.h" |
28 | |||
29 | //#include "gnunet-conversation-gtk.h" | ||
30 | |||
31 | #include "gnunet-conversation-gtk_history.h" | 28 | #include "gnunet-conversation-gtk_history.h" |
32 | #include "gnunet-conversation-gtk_contacts.h" | 29 | #include "gnunet-conversation-gtk_contacts.h" |
33 | //#include "gnunet-conversation-gtk_phone.h" | ||
34 | |||
35 | |||
36 | /*********** | ||
37 | * macro's * | ||
38 | ***********/ | ||
39 | |||
40 | //#define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ## __VA_ARGS__)) | ||
41 | 30 | ||
42 | //#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format, ## __VA_ARGS__)) | ||
43 | |||
44 | //#define get_object(name) GNUNET_CONVERSATION_GTK_get_main_window_object(name) | ||
45 | |||
46 | //#define LOG(format, ...) log_message(g_strdup_printf (format, ## __VA_ARGS__)) | ||
47 | 31 | ||
48 | struct GNUNET_CONVERSATION_Caller *caller_selected = NULL; | 32 | struct GNUNET_CONVERSATION_Caller *caller_selected = NULL; |
49 | /************* | 33 | /************* |
@@ -63,14 +47,12 @@ GIG_get_configuration (); | |||
63 | * Our configurations. | 47 | * Our configurations. |
64 | */ | 48 | */ |
65 | static struct GNUNET_CONFIGURATION_Handle *cfg; | 49 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
50 | |||
66 | /** | 51 | /** |
67 | * Name of our ego. | 52 | * Name of our ego. |
68 | */ | 53 | */ |
69 | static char *ego_name; | 54 | static char *ego_name; |
70 | 55 | ||
71 | |||
72 | //static struct GNUNET_CONFIGURATION_Handle *cfg1; | ||
73 | //static struct GNUNET_CONFIGURATION_Handle *cfg2; | ||
74 | /** | 56 | /** |
75 | * Be verbose. | 57 | * Be verbose. |
76 | */ | 58 | */ |
@@ -82,17 +64,6 @@ static int verbose = 1; | |||
82 | */ | 64 | */ |
83 | static int tray_only; | 65 | static int tray_only; |
84 | 66 | ||
85 | /** | ||
86 | * Head of operations. | ||
87 | */ | ||
88 | //static struct OperationContext *oc_head; | ||
89 | |||
90 | /** | ||
91 | * Tail of operations. | ||
92 | */ | ||
93 | //static struct OperationContext *oc_tail; | ||
94 | |||
95 | |||
96 | 67 | ||
97 | /************* | 68 | /************* |
98 | * phone * | 69 | * phone * |
@@ -110,27 +81,19 @@ struct GNUNET_CONTAINER_MultiHashMapIterator *iter; | |||
110 | char *callerName; | 81 | char *callerName; |
111 | 82 | ||
112 | /** | 83 | /** |
113 | * peer id of a contact | 84 | * peer id of a contact |
114 | */ | 85 | */ |
115 | char *peer_id; | 86 | char *peer_id; |
116 | 87 | ||
117 | /** | 88 | /** |
118 | * incoming call popup window, global because must be destroyed when other end hangs up | ||
119 | */ | ||
120 | GtkDialog *dialog; | ||
121 | |||
122 | /** | ||
123 | * List of active calls | 89 | * List of active calls |
124 | */ | 90 | */ |
125 | static GtkListStore *active_liststore; | 91 | static GtkListStore *active_liststore; |
126 | 92 | ||
127 | /** | 93 | /** |
128 | * List of active calls | 94 | * List of active calls |
129 | */ | 95 | */ |
130 | static GtkTreeView *active_treeview; | 96 | static GtkTreeView *active_treeview; |
131 | |||
132 | |||
133 | |||
134 | 97 | ||
135 | /** | 98 | /** |
136 | * List of incoming calls | 99 | * List of incoming calls |
@@ -170,8 +133,6 @@ struct CallList | |||
170 | 133 | ||
171 | }; | 134 | }; |
172 | 135 | ||
173 | |||
174 | |||
175 | /** | 136 | /** |
176 | * Phone handle | 137 | * Phone handle |
177 | */ | 138 | */ |
@@ -181,46 +142,33 @@ static struct GNUNET_CONVERSATION_Phone *phone; | |||
181 | * Call handle (for active outgoing call). | 142 | * Call handle (for active outgoing call). |
182 | */ | 143 | */ |
183 | static struct GNUNET_CONVERSATION_Call *call; | 144 | static struct GNUNET_CONVERSATION_Call *call; |
184 | //static struct GtkTreeIter gcall; | ||
185 | 145 | ||
186 | /** | 146 | /** |
187 | * Caller handle (for active incoming call). | 147 | * Caller handle (for active incoming call). |
188 | */ | 148 | */ |
189 | static struct CallList *cl_active; | 149 | static struct CallList *cl_active; |
190 | //static GtkTreeIter gcl_active; | ||
191 | 150 | ||
192 | /** | 151 | /** |
193 | * Head of calls waiting to be accepted. | 152 | * Head of calls waiting to be accepted. |
194 | */ | 153 | */ |
195 | static struct CallList *cl_head; | 154 | static struct CallList *cl_head; |
196 | //gtk | ||
197 | //static GtkTreeIter gcl_head; | ||
198 | |||
199 | /** | ||
200 | * currently selected call | ||
201 | */ | ||
202 | //static GtkTreeIter gcl_selected; | ||
203 | 155 | ||
204 | /** | 156 | /** |
205 | * Tail of calls waiting to be accepted. | 157 | * Tail of calls waiting to be accepted. |
206 | */ | 158 | */ |
207 | static struct CallList *cl_tail; | 159 | static struct CallList *cl_tail; |
208 | //static GtkTreeIter gcl_tail; | ||
209 | 160 | ||
210 | /** | 161 | /** |
211 | * Desired phone line. | 162 | * Desired phone line. |
212 | */ | 163 | */ |
213 | static unsigned int line; | 164 | static unsigned int line; |
214 | 165 | ||
215 | //static unsigned int line1; | ||
216 | /** | 166 | /** |
217 | * debug box enabled | 167 | * debug box enabled |
218 | */ | 168 | */ |
219 | 169 | ||
220 | static unsigned int debug_box_enabled; | 170 | static unsigned int debug_box_enabled; |
221 | 171 | ||
222 | |||
223 | |||
224 | /** | 172 | /** |
225 | * Our speaker. | 173 | * Our speaker. |
226 | */ | 174 | */ |
@@ -260,6 +208,7 @@ static unsigned int caller_num_gen; | |||
260 | * GNS address for this phone. | 208 | * GNS address for this phone. |
261 | */ | 209 | */ |
262 | static char *address; | 210 | static char *address; |
211 | |||
263 | /******************* | 212 | /******************* |
264 | * identity select * | 213 | * identity select * |
265 | *******************/ | 214 | *******************/ |
@@ -271,11 +220,6 @@ static char *address; | |||
271 | static GtkListStore *zone_liststore; | 220 | static GtkListStore *zone_liststore; |
272 | 221 | ||
273 | /** | 222 | /** |
274 | * zone treestore | ||
275 | */ | ||
276 | static GtkTreeStore *zone_treestore; | ||
277 | |||
278 | /** | ||
279 | * zone treeview | 223 | * zone treeview |
280 | */ | 224 | */ |
281 | static GtkTreeView *zone_treeview; | 225 | static GtkTreeView *zone_treeview; |
@@ -285,12 +229,6 @@ static GtkTreeView *zone_treeview; | |||
285 | */ | 229 | */ |
286 | static GtkTreeModel *zone_treemodel; | 230 | static GtkTreeModel *zone_treemodel; |
287 | 231 | ||
288 | |||
289 | /** | ||
290 | * Global return value | ||
291 | */ | ||
292 | static int ret; | ||
293 | |||
294 | /** | 232 | /** |
295 | * Our ego. | 233 | * Our ego. |
296 | */ | 234 | */ |
@@ -302,22 +240,17 @@ static struct GNUNET_IDENTITY_Ego *caller_id; | |||
302 | */ | 240 | */ |
303 | static struct GNUNET_GTK_MainLoop *ml; | 241 | static struct GNUNET_GTK_MainLoop *ml; |
304 | 242 | ||
305 | |||
306 | |||
307 | |||
308 | |||
309 | ////////////////////////////////////////////////// | ||
310 | /************ | 243 | /************ |
311 | * extern's * | 244 | * extern's * |
312 | * **********/ | 245 | * **********/ |
313 | 246 | ||
314 | 247 | ||
315 | /** | 248 | /** |
316 | * * Get an object from the main window. | 249 | * Get an object from the main window. |
317 | * * | 250 | * |
318 | * * @param name name of the object | 251 | * @param name name of the object |
319 | * * @return NULL on error | 252 | * @return NULL on error |
320 | * */ | 253 | */ |
321 | extern GObject * | 254 | extern GObject * |
322 | GNUNET_CONVERSATION_GTK_get_main_window_object (const char *name) | 255 | GNUNET_CONVERSATION_GTK_get_main_window_object (const char *name) |
323 | { | 256 | { |
@@ -1364,8 +1297,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1364 | 1297 | ||
1365 | GNUNET_CONVERSATION_GTK_history_init(); | 1298 | GNUNET_CONVERSATION_GTK_history_init(); |
1366 | 1299 | ||
1367 | zone_treeview = | 1300 | //zone_treeview = |
1368 | GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_zone_treeview")); | 1301 | // GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_zone_treeview")); |
1369 | 1302 | ||
1370 | //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); | 1303 | //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); |
1371 | 1304 | ||
@@ -1393,10 +1326,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1393 | } | 1326 | } |
1394 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, | 1327 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, |
1395 | NULL); | 1328 | NULL); |
1396 | 1329 | ||
1397 | |||
1398 | cfg = GIG_get_configuration (); | 1330 | cfg = GIG_get_configuration (); |
1399 | //cfg = GNUNET_CONFIGURATION_dup (c); | ||
1400 | 1331 | ||
1401 | speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration ()); | 1332 | speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration ()); |
1402 | mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration ()); | 1333 | mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration ()); |
@@ -1409,7 +1340,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1409 | } | 1340 | } |
1410 | id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); | 1341 | id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); |
1411 | 1342 | ||
1412 | //GNUNET_CONVERSATION_GTK_CONTACTS_init (); | 1343 | GNUNET_CONVERSATION_GTK_CONTACTS_init (); |
1413 | } | 1344 | } |
1414 | 1345 | ||
1415 | 1346 | ||
@@ -1450,7 +1381,6 @@ main (int argc, char *const *argv) | |||
1450 | &run)) | 1381 | &run)) |
1451 | return 1; | 1382 | return 1; |
1452 | return 0; | 1383 | return 0; |
1453 | // FPRINTF (stderr, "line %i", line); | ||
1454 | } | 1384 | } |
1455 | 1385 | ||
1456 | /** | 1386 | /** |
@@ -1472,40 +1402,28 @@ GNUNET_CONVERSATION_GTK_on_call_clicked () | |||
1472 | } | 1402 | } |
1473 | 1403 | ||
1474 | /** | 1404 | /** |
1475 | * clicked | 1405 | * hangup clicked |
1476 | */ | 1406 | */ |
1477 | void | 1407 | void |
1478 | GNUNET_CONVERSATION_GTK_on_hangup_clicked () | 1408 | GNUNET_CONVERSATION_GTK_on_hangup_clicked () |
1479 | { | 1409 | { |
1480 | //update_status() | ||
1481 | //disable_button("GNUNET_CONVERSATION_GTK_call_button"); | ||
1482 | //FPRINTF (stderr, "hangup clicked \n"); | ||
1483 | |||
1484 | // enable_button ("GNUNET_GTK_conversation_call_button"); | ||
1485 | |||
1486 | |||
1487 | //FPRINTF (stderr, "hangup clicked \n"); | ||
1488 | |||
1489 | do_reject (caller_selected); | 1410 | do_reject (caller_selected); |
1490 | |||
1491 | do_status (); | 1411 | do_status (); |
1492 | //history_add(3,peer_name); | 1412 | //history_add(3,peer_name); |
1493 | } | 1413 | } |
1494 | 1414 | ||
1495 | /** | 1415 | /** |
1496 | * clicked | 1416 | * accept clicked |
1497 | */ | 1417 | */ |
1498 | void | 1418 | void |
1499 | GNUNET_CONVERSATION_GTK_on_accept_clicked () | 1419 | GNUNET_CONVERSATION_GTK_on_accept_clicked () |
1500 | { | 1420 | { |
1501 | //FPRINTF (stderr, "accept clicked \n"); | ||
1502 | do_accept (caller_selected); | 1421 | do_accept (caller_selected); |
1503 | // hide_infobar (); | ||
1504 | } | 1422 | } |
1505 | 1423 | ||
1506 | 1424 | ||
1507 | /** | 1425 | /** |
1508 | * clicked | 1426 | * reject clicked |
1509 | */ | 1427 | */ |
1510 | void | 1428 | void |
1511 | GNUNET_CONVERSATION_GTK_on_reject_clicked () | 1429 | GNUNET_CONVERSATION_GTK_on_reject_clicked () |
@@ -1514,7 +1432,7 @@ GNUNET_CONVERSATION_GTK_on_reject_clicked () | |||
1514 | } | 1432 | } |
1515 | 1433 | ||
1516 | /** | 1434 | /** |
1517 | * clicked | 1435 | * pause clicked |
1518 | */ | 1436 | */ |
1519 | void | 1437 | void |
1520 | GNUNET_CONVERSATION_GTK_on_pause_clicked () | 1438 | GNUNET_CONVERSATION_GTK_on_pause_clicked () |
@@ -1523,7 +1441,7 @@ GNUNET_CONVERSATION_GTK_on_pause_clicked () | |||
1523 | } | 1441 | } |
1524 | 1442 | ||
1525 | /** | 1443 | /** |
1526 | * clicked | 1444 | * resume clicked |
1527 | */ | 1445 | */ |
1528 | void | 1446 | void |
1529 | GNUNET_CONVERSATION_GTK_on_resume_clicked () | 1447 | GNUNET_CONVERSATION_GTK_on_resume_clicked () |
@@ -1532,7 +1450,7 @@ GNUNET_CONVERSATION_GTK_on_resume_clicked () | |||
1532 | } | 1450 | } |
1533 | 1451 | ||
1534 | /** | 1452 | /** |
1535 | * clicked | 1453 | * status clicked |
1536 | */ | 1454 | */ |
1537 | void | 1455 | void |
1538 | GNUNET_CONVERSATION_GTK_on_status_clicked () | 1456 | GNUNET_CONVERSATION_GTK_on_status_clicked () |
@@ -1540,22 +1458,12 @@ GNUNET_CONVERSATION_GTK_on_status_clicked () | |||
1540 | do_status (); | 1458 | do_status (); |
1541 | } | 1459 | } |
1542 | 1460 | ||
1543 | 1461 | /* | |
1544 | 1462 | * test function | |
1545 | /* end of gnunet-conversation-gtk.c */ | 1463 | */ |
1546 | void | 1464 | void |
1547 | GNUNET_contact_test () | 1465 | GNUNET_contact_test () |
1548 | { | 1466 | { |
1549 | /* | ||
1550 | history_add (0, "test"); | ||
1551 | history_add (1, "test"); | ||
1552 | history_add (2, "test"); | ||
1553 | history_add (3, "test"); | ||
1554 | history_add (4, "test"); | ||
1555 | // struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc; | ||
1556 | // edc = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginEnvironment); | ||
1557 | */ | ||
1558 | |||
1559 | GtkTreeIter iter; | 1467 | GtkTreeIter iter; |
1560 | char *caller_id = "testje"; | 1468 | char *caller_id = "testje"; |
1561 | int caller_num = 10; | 1469 | int caller_num = 10; |
@@ -1573,30 +1481,26 @@ enum { | |||
1573 | &iter, -1, | 1481 | &iter, -1, |
1574 | 0, "test", | 1482 | 0, "test", |
1575 | -1); | 1483 | -1); |
1576 | // static struct GNUNET_IDENTITY_Handle *sh; | ||
1577 | // GNUNET_IDENTITY_disconnect (id); | ||
1578 | // &print_ego; | ||
1579 | //sh = GNUNET_IDENTITY_connect (cfg, &print_ego, NULL); | ||
1580 | // GNUNET_NAMESTORE_zone_iterator_next(list_it); | ||
1581 | } | 1484 | } |
1582 | 1485 | ||
1583 | 1486 | /* | |
1487 | * @brief outgoing ego selector changed | ||
1488 | */ | ||
1584 | void | 1489 | void |
1585 | gnunet_conversation_gtk_outgoing_zone_combobox_changed_cb (GtkComboBox *widget, | 1490 | gnunet_conversation_gtk_outgoing_zone_combobox_changed_cb (GtkComboBox *widget, |
1586 | gpointer user_data) | 1491 | gpointer user_data) |
1587 | { | 1492 | { |
1588 | GtkTreeIter contacts_zone_iter; | 1493 | GtkTreeIter iter; |
1589 | struct GNUNET_IDENTITY_Ego *tempEgo; | 1494 | struct GNUNET_IDENTITY_Ego *tempEgo; |
1590 | char *tempName; | 1495 | char *tempName; |
1591 | struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey; | 1496 | struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey; |
1592 | GtkTreeSelection *selection; | 1497 | GtkTreeSelection *selection; |
1593 | GtkTreeIter iterA; | ||
1594 | 1498 | ||
1595 | 1499 | ||
1596 | gtk_combo_box_get_active_iter(widget, &contacts_zone_iter); | 1500 | gtk_combo_box_get_active_iter(widget, &iter); |
1597 | 1501 | ||
1598 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), | 1502 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), |
1599 | &contacts_zone_iter, | 1503 | &iter, |
1600 | 0, &tempName, | 1504 | 0, &tempName, |
1601 | 1, &tempEgo, | 1505 | 1, &tempEgo, |
1602 | -1); | 1506 | -1); |