diff options
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk_history.c')
-rw-r--r-- | src/conversation/gnunet-conversation-gtk_history.c | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_history.c b/src/conversation/gnunet-conversation-gtk_history.c new file mode 100644 index 00000000..239f2b94 --- /dev/null +++ b/src/conversation/gnunet-conversation-gtk_history.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) | ||
4 | |||
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 | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | |||
22 | |||
23 | /** | ||
24 | * @file src/conversation/gnunet-conversation-gtk_history.c | ||
25 | * @brief | ||
26 | * @author yids | ||
27 | * @author hark | ||
28 | */ | ||
29 | |||
30 | #include "gnunet-conversation-gtk_common.h" | ||
31 | |||
32 | |||
33 | /******* | ||
34 | * history | ||
35 | ********/ | ||
36 | /** | ||
37 | * call history liststore | ||
38 | */ | ||
39 | static GtkListStore *history_liststore; | ||
40 | |||
41 | /** | ||
42 | * call history treestore | ||
43 | */ | ||
44 | static GtkTreeStore *history_treestore; | ||
45 | |||
46 | /** | ||
47 | * call histore treeview | ||
48 | */ | ||
49 | static GtkTreeView *history_treeview; | ||
50 | |||
51 | /** | ||
52 | * call history tree model | ||
53 | */ | ||
54 | static GtkTreeModel *history_treemodel; | ||
55 | |||
56 | |||
57 | /* | ||
58 | * | ||
59 | * adds a item to the call history | ||
60 | * | ||
61 | * @param type type of call: 0: accepted 1: rejected 2: outgoing call | ||
62 | * @return void | ||
63 | */ | ||
64 | |||
65 | extern void | ||
66 | GNUNET_CONVERSATION_GTK_history_add (int type, char *contactName) | ||
67 | { | ||
68 | GtkTreeIter iter; | ||
69 | time_t t; | ||
70 | char *event; | ||
71 | |||
72 | switch (type) | ||
73 | { | ||
74 | case CH_ACCEPTED: | ||
75 | event = "Accepted"; | ||
76 | break; | ||
77 | case CH_REJECTED: | ||
78 | event = "Rejected"; | ||
79 | break; | ||
80 | case CH_OUTGOING: | ||
81 | event = "Outgoing"; | ||
82 | break; | ||
83 | case CH_HANGUP: | ||
84 | event = "Hangup"; | ||
85 | break; | ||
86 | case CH_MISSED: | ||
87 | event = "Missed"; | ||
88 | break; | ||
89 | default: | ||
90 | event = "UNKNOWN"; | ||
91 | break; | ||
92 | } | ||
93 | time (&t); | ||
94 | gtk_list_store_append (history_liststore, &iter); | ||
95 | gtk_list_store_set (history_liststore, &iter, 1, event, 0, ctime (&t), 2, | ||
96 | contactName, -1); | ||
97 | } | ||
98 | |||
99 | extern void | ||
100 | GNUNET_CONVERSATION_GTK_history_init(){ | ||
101 | // call history | ||
102 | history_liststore = | ||
103 | GTK_LIST_STORE (get_object ("gnunet_conversation_gtk_history_liststore")); | ||
104 | history_treeview = | ||
105 | GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_history_treeview")); | ||
106 | history_treestore = | ||
107 | GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_history_treestore")); | ||
108 | history_treemodel = GTK_TREE_MODEL (history_treestore); | ||
109 | |||
110 | } | ||