[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33406 - gnunet-gtk/src/conversation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33406 - gnunet-gtk/src/conversation |
Date: |
Mon, 26 May 2014 21:47:13 +0200 |
Author: grothoff
Date: 2014-05-26 21:47:13 +0200 (Mon, 26 May 2014)
New Revision: 33406
Modified:
gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.h
gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
Log:
cleaning up history logic
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
2014-05-26 19:45:47 UTC (rev 33405)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
2014-05-26 19:47:13 UTC (rev 33406)
@@ -27,66 +27,78 @@
#include "gnunet-conversation-gtk.h"
#include "gnunet-conversation-gtk_history.h"
-/**
- * call history liststore // FIXME: which one is it?
- */
-static GtkListStore *history_liststore;
/**
- * call history treestore // FIXME: which one is it?
+ * Columns in the #ego_liststore.
*/
-static GtkTreeStore *history_treestore;
+enum HistoryListstoreValues
+{
+ /**
+ * Human-readable time of the event (gchar *)
+ */
+ HISTORY_LS_TIME = 0,
-/**
- * call histore treeview
- */
-static GtkTreeView *history_treeview;
+ /**
+ * Human-readable event type (gchar *)
+ */
+ HISTORY_LS_EVENT = 1,
+ /**
+ * Human-readable name of the contact involved (gchar *)
+ */
+ HISTORY_LS_CONTACT = 2
+};
+
+
/**
- * call history tree model
+ * Call history liststore
*/
-static GtkTreeModel *history_treemodel;
+static GtkListStore *history_liststore;
/**
- * adds a item to the call history
+ * Adds entry to the history.
*
- * @param type type of call: 0: accepted 1: rejected 2: outgoing call
- * @return void
+ * @param type type of the event
+ * @param contact_name name of the contact person
*/
void
-GCG_HISTORY_add (int type,
- char *contactName)
+GCG_HISTORY_add (enum GCG_HISTORY_Type type,
+ const char *contact_name)
{
GtkTreeIter iter;
- time_t t;
- char *event;
+ const char *event;
+ const char *ts;
switch (type)
{
- case CH_ACCEPTED:
+ case GCG_HISTORY_TYPE_ACCEPTED:
event = "Accepted";
break;
- case CH_REJECTED:
+ case GCG_HISTORY_TYPE_REJECTED:
event = "Rejected";
break;
- case CH_OUTGOING:
+ case GCG_HISTORY_TYPE_OUTGOING:
event = "Outgoing";
break;
- case CH_HANGUP:
+ case GCG_HISTORY_TYPE_HANGUP:
event = "Hangup";
break;
- case CH_MISSED:
+ case GCG_HISTORY_TYPE_MISSED:
event = "Missed";
break;
default:
event = "UNKNOWN";
break;
}
- time (&t);
- gtk_list_store_append (history_liststore, &iter);
- gtk_list_store_set (history_liststore, &iter, 1, event, 0, ctime (&t), 2,
- contactName, -1);
+ ts = GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_get ());
+ gtk_list_store_insert_with_values (history_liststore,
+ &iter,
+ -1,
+ HISTORY_LS_TIME, ts,
+ HISTORY_LS_EVENT, event,
+ HISTORY_LS_CONTACT, contact_name,
+ -1);
}
@@ -96,17 +108,9 @@
void
GCG_HISTORY_init ()
{
- // call history
history_liststore =
GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_history_liststore"));
- history_treeview =
- GTK_TREE_VIEW (GCG_get_main_window_object
- ("gnunet_conversation_gtk_history_treeview"));
- history_treestore =
- GTK_TREE_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_history_treestore"));
- history_treemodel = GTK_TREE_MODEL (history_treestore);
}
/* end of gnunet-conversation-gtk_history.c */
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.h
2014-05-26 19:45:47 UTC (rev 33405)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.h
2014-05-26 19:47:13 UTC (rev 33406)
@@ -29,28 +29,27 @@
/**
- * FIXME: used?
+ * Event types used by the history.
*/
-enum CallHistoryType
+enum GCG_HISTORY_Type
{
- CH_ACCEPTED,
- CH_REJECTED,
- CH_OUTGOING,
- CH_HANGUP,
- CH_MISSED
+ GCG_HISTORY_TYPE_ACCEPTED,
+ GCG_HISTORY_TYPE_REJECTED,
+ GCG_HISTORY_TYPE_OUTGOING,
+ GCG_HISTORY_TYPE_HANGUP,
+ GCG_HISTORY_TYPE_MISSED
};
/**
* Add an entry to the history.
*
- * FIXME: use `enum CallHistoryType` here?
- * @param type type of call: 0: accepted 1: rejected 2: outgoing call
- * @param contactName name of the contact person
+ * @param type type of the event
+ * @param contact_name name of the contact person
*/
void
-GCG_HISTORY_add (int type,
- char *contactName);
+GCG_HISTORY_add (enum GCG_HISTORY_Type type,
+ const char *contact_name);
/**
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-05-26
19:45:47 UTC (rev 33405)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-05-26
19:47:13 UTC (rev 33406)
@@ -1011,7 +1011,7 @@
-1 );
GCG_update_status_bar (_("We are calling `%s', his phone should be
ringing."),
peer_name);
- GCG_HISTORY_add (CH_OUTGOING,
+ GCG_HISTORY_add (GCG_HISTORY_TYPE_OUTGOING,
peer_name);
}
@@ -1066,7 +1066,7 @@
GNUNET_CONVERSATION_caller_pick_up (sel_caller,
&caller_event_handler, cl,
speaker, mic);
- GCG_HISTORY_add (CH_ACCEPTED, peer_name);
+ GCG_HISTORY_add (GCG_HISTORY_TYPE_ACCEPTED, peer_name);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33406 - gnunet-gtk/src/conversation,
gnunet <=