[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33390 - gnunet-gtk/src/conversation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33390 - gnunet-gtk/src/conversation |
Date: |
Mon, 26 May 2014 12:02:44 +0200 |
Author: grothoff
Date: 2014-05-26 12:02:44 +0200 (Mon, 26 May 2014)
New Revision: 33390
Modified:
gnunet-gtk/src/conversation/Makefile.am
gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.h
Log:
use monitor instead of iterator for contact book management
Modified: gnunet-gtk/src/conversation/Makefile.am
===================================================================
--- gnunet-gtk/src/conversation/Makefile.am 2014-05-26 09:32:54 UTC (rev
33389)
+++ gnunet-gtk/src/conversation/Makefile.am 2014-05-26 10:02:44 UTC (rev
33390)
@@ -16,6 +16,8 @@
gnunet-conversation-gtk.h \
gnunet-conversation-gtk_phone.c \
gnunet-conversation-gtk_phone.h \
+ gnunet-conversation-gtk_egos.c \
+ gnunet-conversation-gtk_egos.h \
gnunet-conversation-gtk_contacts.c \
gnunet-conversation-gtk_contacts.h \
gnunet-conversation-gtk_history.c \
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-05-26
09:32:54 UTC (rev 33389)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-05-26
10:02:44 UTC (rev 33390)
@@ -27,6 +27,7 @@
#include "gnunet-conversation-gtk.h"
#include "gnunet-conversation-gtk_history.h"
#include "gnunet-conversation-gtk_contacts.h"
+#include "gnunet-conversation-gtk_egos.h"
/**
@@ -164,11 +165,6 @@
static struct GNUNET_MICROPHONE_Handle *mic;
/**
- * Handle to identity service.
- */
-static struct GNUNET_IDENTITY_Handle *id;
-
-/**
* Name of conversation partner (if any).
*/
static char *peer_name;
@@ -1315,99 +1311,46 @@
static void
do_reject ()
{
-
- if (call_selected == NULL && caller_selected == NULL){
- GNUNET_break(0);
- }else {
-
- // if selected call is outgoing, stop it
- if (NULL != call_selected)
+ if (call_selected == NULL && caller_selected == NULL)
{
- set_outgoing_call_state(call_selected,CT_hangup);
+ GNUNET_break(0);
+ }
+ else
+ {
+ // if selected call is outgoing, stop it
+ if (NULL != call_selected)
+ {
+ set_outgoing_call_state(call_selected,CT_hangup);
- GNUNET_CONVERSATION_call_stop(call);
- //GNUNET_CONVERSATION_call_stop (call_selected);
+ GNUNET_CONVERSATION_call_stop(call);
+ //GNUNET_CONVERSATION_call_stop (call_selected);
- call = NULL;
- call_selected = NULL;
- return;
- } else
-
- // if selected call is incoming, hang it up
- if (NULL != caller_selected)
- {
- set_incoming_call_state(caller_selected,CT_hangup);
- //FPRINTF(stderr,"hangup: %u", caller_selected);
- GNUNET_CONVERSATION_caller_hang_up(caller_selected);
- //cl_active = NULL;
- phone_state = PS_LISTEN;
- caller_selected = NULL;
- } else {
- GNUNET_break(0);
+ call = NULL;
+ call_selected = NULL;
+ return;
+ }
+ else
+ {
+ // if selected call is incoming, hang it up
+ if (NULL != caller_selected)
+ {
+ set_incoming_call_state(caller_selected,CT_hangup);
+ //FPRINTF(stderr,"hangup: %u", caller_selected);
+ GNUNET_CONVERSATION_caller_hang_up(caller_selected);
+ //cl_active = NULL;
+ phone_state = PS_LISTEN;
+ caller_selected = NULL;
+ }
+ else
+ {
+ GNUNET_break(0);
+ }
+ }
}
- }
}
/**
- * Function called by identity service with information about egos.
- *
- * @param cls NULL
- * @param ego ego handle
- * @param ctx unused
- * @param name name of the ego
- */
-static void
-identity_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- struct GNUNET_CRYPTO_EcdsaPublicKey pk;
- GtkTreeIter iter;
-
- if (NULL != ego)
- {
- GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
- gtk_list_store_insert_with_values (zone_liststore,
- &iter, -1,
- 0, name,
- 1, ego,
- -1);
- }
- if (NULL == name)
- return;
- if (ego == caller_id)
- {
- if (verbose)
- GCG_log (_("Name of our ego changed to `%s'\n"),
- name);
- GNUNET_free_non_null (ego_name);
- ego_name = GNUNET_strdup (name);
- return;
- }
- if (0 != strcmp (name, ego_name))
- return;
- if (NULL == ego)
- {
- if (verbose)
- GCG_log (_("Our ego `%s' was deleted!\n"),
- ego_name);
- caller_id = NULL;
- return;
- }
- caller_id = ego;
-
- // do not remove this, it tells the phone which line to use
- GNUNET_CONFIGURATION_set_value_number (cfg,
- "CONVERSATION",
- "LINE",
- line);
- if (NULL == phone)
- start_phone();
-}
-
-/**
* Get our configuration.
*
* @return configuration handle
@@ -1420,8 +1363,6 @@
}
-
-
/**
* Task run on shutdown.
*
@@ -1429,7 +1370,8 @@
* @param tc scheduler context, unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
//TODO: make this work
@@ -1447,12 +1389,9 @@
oc);
GNUNET_free (oc);
}
- if (NULL != identity)
- {
- GNUNET_IDENTITY_disconnect (identity);
- identity = NULL;
- }
*/
+ GCG_CONTACTS_shutdown();
+ GCG_EGOS_shutdown();
GNUNET_GTK_tray_icon_destroy ();
GNUNET_GTK_main_loop_quit (ml);
ml = NULL;
@@ -1479,18 +1418,6 @@
GNUNET_CONVERSATION_phone_destroy (phone);
phone = NULL;
}
- if (NULL != id)
- {
- GNUNET_IDENTITY_disconnect (id);
- id = NULL;
- }
- //if (NULL != ns)
- //{
- // GNUNET_NAMESTORE_disconnect (ns);
- // ns = NULL;
- //}
- GNUNET_CONVERSATION_GTK_CONTACTS_shutdown();
-
GNUNET_SPEAKER_destroy (speaker);
speaker = NULL;
GNUNET_MICROPHONE_destroy (mic);
@@ -1498,7 +1425,6 @@
ego_name = NULL;
//GNUNET_free_non_null (peer_name);
phone_state = PS_ERROR;
-
GNUNET_SCHEDULER_shutdown ();
}
@@ -1552,6 +1478,11 @@
&shutdown_task,
NULL);
cfg = GNUNET_CONFIGURATION_dup (GCG_get_configuration ());
+ if (0 != line)
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "CONVERSATION",
+ "LINE",
+ line);
speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
b_contact = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_use_current_button"));
@@ -1564,9 +1495,8 @@
ego_name = "phone-ego";
GCG_log (_("No ego given, using default: %s "), ego_name);
}
- id = GNUNET_IDENTITY_connect (cfg,
- &identity_cb, NULL);
- GNUNET_CONVERSATION_GTK_CONTACTS_init ();
+ GCG_EGOS_init ();
+ GCG_CONTACTS_init ();
}
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
2014-05-26 09:32:54 UTC (rev 33389)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
2014-05-26 10:02:44 UTC (rev 33390)
@@ -25,8 +25,28 @@
* @author hark
*/
#include "gnunet-conversation-gtk.h"
+#include "gnunet-conversation-gtk_contacts.h"
+#include "gnunet-conversation-gtk_egos.h"
+
/**
+ * Columns in the #contacts_liststore.
+ */
+enum ContactsListstoreValues
+{
+ /**
+ * Human-readable name of the label in the zone.
+ */
+ CONTACTS_LS_NAME = 0,
+
+ /**
+ * Type of the label (as a 'const char *')
+ */
+ CONTACTS_LS_TYPE = 1
+};
+
+
+/**
* Our ego.
*/
static struct GNUNET_IDENTITY_Ego *contacts_ego;
@@ -37,11 +57,6 @@
static GtkListStore *contacts_liststore;
/**
- * list of zones
- */
-static GtkListStore *zone_liststore;
-
-/**
* zone treeview
*/
static GtkTreeView *zone_treeview;
@@ -61,18 +76,10 @@
*/
static GtkTreeModel *contacts_treemodel;
-/*
- * List iterator for the 'list' operation.
- */
-static struct GNUNET_NAMESTORE_ZoneIterator *list_it;
-
-
-static struct GNUNET_IDENTITY_Ego *currentAddressBookEgo;
-
/**
- * Handle to identity service.
+ * Monitor to view information in our current zone.
*/
-static struct GNUNET_IDENTITY_Handle *id;
+static struct GNUNET_NAMESTORE_ZoneMonitor *zone_mon;
/**
* Handle to the namestore.
@@ -100,138 +107,8 @@
static struct GNUNET_NAMESTORE_QueueEntry *del_qe;
-////////////////////////////
-static void
-display_record (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
- const char *rname,
- unsigned int rd_len,
- const struct GNUNET_GNSRECORD_Data *rd)
-{
- char *s;
- char *type;
- unsigned int i;
- struct GNUNET_TIME_Absolute at;
- struct GNUNET_TIME_Relative rt;
- GtkTreeIter display_iter;
-
- if (NULL == rname)
- {
-
- list_it = NULL;
- //test_finished ();
- return;
- }
-
- for (i = 0; i < rd_len; i++)
- {
-
- if ((GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
- (0 != strcmp (rname, "+")))
- continue;
-/* typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);*/
- s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, rd[i].data,
- rd[i].data_size);
- if (NULL == s)
- {
- FPRINTF (stdout, _("\tCorrupt or unsupported record of type %u\n"),
- (unsigned int) rd[i].record_type);
- continue;
- }
- if (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
- {
- rt.rel_value_us = rd[i].expiration_time;
-/* ets = GNUNET_STRINGS_relative_time_to_string (rt, GNUNET_YES);*/
- }
- else
- {
- at.abs_value_us = rd[i].expiration_time;
-/* ets = GNUNET_STRINGS_absolute_time_to_string (at);*/
- }
- if (rd[i].record_type == 65536)
- {
- type = "PKEY";
- } // if pubkey record
- if (rd[i].record_type == 65542)
- {
- type = "PHONE";
- }
-// FPRINTF (stdout, "%s", rname);
- if (rd[i].record_type == 65536 || rd[i].record_type == 65542)
- {
- gtk_list_store_append (contacts_liststore, &display_iter);
- gtk_list_store_set (contacts_liststore, &display_iter, 1, type, 0,
rname, -1);
- }
-
-/* FPRINTF (stdout,
- "\t%s: %s (%s)\t%s\t%s\t%s\n",
- typestring,
- s,
- ets,
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE)) ?
"PRIVATE" : "PUBLIC",
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ?
"SHADOW" : "",
- (0 != (rd[i].flags & GNUNET_GNSRECORD_RF_PENDING)) ?
"PENDING" : "");
-*/
- //gtk_widget_show(contacts_liststore);
- GNUNET_free (s);
- }
-// FPRINTF (stdout, "%s", "\n");
-
- GNUNET_NAMESTORE_zone_iterator_next (list_it);
-// GNUNET_NAMESTORE_zone_iteration_stop(list_it);
-
-}
-
-
-
/**
- * Function called by identity service with information about egos.
- *
- * @param cls NULL
- * @param ego ego handle
- * @param ctx unused
- * @param name name of the ego
- */
-static void
-identity_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
-/*
- struct GNUNET_CRYPTO_EcdsaPublicKey pk;
- char *s;
-*/
- GtkTreeIter iter;
-
- if (NULL != ego)
- {
-/*
- GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
- s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
-*/
- fprintf (stderr, "contacts idenity_cb: %s \n", name);
-
-
- /* FIXME: this should be done in gnunet-conversation-gtk.c */
- gtk_list_store_insert_with_values (zone_liststore,
- &iter, -1,
- 0, name,
- 1, ego,
- -1);
-
- }
-
- contacts_ego = ego;
-
-
-// zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
- ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ());
-}
-
-
-/**
* Continuation called to notify client about result of the
* operation.
*
@@ -242,7 +119,9 @@
* @param emsg NULL on success, otherwise an error message
*/
static void
-add_continuation (void *cls, int32_t success, const char *emsg)
+add_continuation (void *cls,
+ int32_t success,
+ const char *emsg)
{
struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
@@ -273,7 +152,9 @@
* @param emsg NULL on success, otherwise an error message
*/
static void
-del_continuation (void *cls, int32_t success, const char *emsg)
+del_continuation (void *cls,
+ int32_t success,
+ const char *emsg)
{
del_qe = NULL;
if (GNUNET_NO == success)
@@ -292,6 +173,7 @@
/**
* add a new contact
+ *
* @param name
* @param address
*/
@@ -299,29 +181,20 @@
add_contact (const gchar *name,
const gchar *address)
{
-// memmove(&address+1,&address+51,1);
GtkTreeIter iter;
struct GNUNET_GNSRECORD_Data rd;
struct GNUNET_GNSRECORD_Data *rde;
static void *data;
static size_t data_size;
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
+ struct GNUNET_IDENTITY_Ego *ego;
- struct GNUNET_IDENTITY_Ego *tempEgo;
- char *tempName;
- GtkTreeIter testIter;
- gtk_combo_box_get_active_iter(GTK_COMBO_BOX (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_combobox")), &testIter);
-
- gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
- &testIter,
- 0, &tempName,
- 1, &tempEgo,
- -1);
-
-
- GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address),
&pkey);
+ ego = GCG_EGOS_get_selected_ego ();
+ zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (address,
+ strlen (address),
+ &pkey);
rde = &rd;
- zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo);
rd.data = &pkey;
rd.data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
@@ -364,6 +237,7 @@
add_contact (gtk_entry_get_text
(nameEntry),gtk_entry_get_text(addressEntry));
}
+
void
GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
gpointer * user_data)
@@ -414,6 +288,9 @@
}
+/**
+ * FIXME: what was clicked where?
+ */
void
GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton *button,
gpointer *user_data)
@@ -427,198 +304,197 @@
}
-/*
- * row activated
+/**
+ * A row was activated in the contacts list. Initiate call.
+ *
* @return void
*/
-
void
GNUNET_CONVERSATION_GTK_row_activated ()
{
- gchar *callAddress;
+ char *address;
gchar *type;
-
-// FPRINTF (stderr, "row activated \n");
-
GtkTreeSelection *selection;
-
GtkTreeIter iterA;
+ GtkEntry *address_entry;
-
selection = gtk_tree_view_get_selection (contacts_treeview);
-
gtk_tree_selection_get_selected (selection, &contacts_treemodel, &iterA);
- gtk_tree_model_get (contacts_treemodel, &iterA, 0, &name, 1, &type, -1);
-// g_print ("ego name %s\n", ego_name);
-// g_print ("selected row is: %s\n", name);
-// g_print ("selected rowtype is: %s\n", type);
+ gtk_tree_model_get (contacts_treemodel,
+ &iterA,
+ CONTACTS_LS_NAME, &name,
+ CONTACTS_LS_TYPE, &type,
+ -1);
+ if (0 == strcmp (type, "PKEY"))
+ {
+ GNUNET_asprintf (&address, "call.%s.gnu", name);
+ }
+ else
+ {
+ GNUNET_assert (0 == strcmp (type, "PHONE"));
+ GNUNET_asprintf (&address, "%s.gnu", name);
+ }
+ g_free (type);
+ address_entry = GTK_ENTRY (GCG_get_main_window_object
("GNUNET_GTK_conversation_address"));
+ gtk_entry_set_text (address_entry,
+ address);
+ do_call (address);
+ GNUNET_free (address);
+}
- g_print ("type @row active%s", type);
- if (strcmp (type, "PKEY") == 0)
+
+/**
+ * Process a record that was stored or modified the namestore by
+ * adding/modifying/removing it in the liststore.
+ *
+ * @param cls closure
+ * @param zone private key of the zone; NULL on disconnect
+ * @param label label of the records; NULL on disconnect
+ * @param rd_count number of entries in @a rd array, 0 if label was deleted
+ * @param rd array of records with data to store
+ */
+static void
+display_record (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+ const char *rname,
+ unsigned int rd_len,
+ const struct GNUNET_GNSRECORD_Data *rd)
+{
+ unsigned int i;
+ GtkTreeIter iter;
+ gboolean do_display;
+ const char *type;
+
+ if (NULL == zone_key)
{
- GNUNET_asprintf (&callAddress, "call.%s.gnu", name);
+ /* disconnect, clear (and possibly freeze) view */
+ gtk_list_store_clear (contacts_liststore);
+ return;
}
- if (strcmp (type, "PHONE") == 0)
+ do_display = FALSE;
+ for (i = 0; i < rd_len; i++)
{
- GNUNET_asprintf (&callAddress, "%s.gnu", name);
+ switch (rd[i].record_type)
+ {
+ case GNUNET_GNSRECORD_TYPE_PKEY:
+ type = "PKEY";
+ do_display = TRUE;
+ break;
+ case GNUNET_GNSRECORD_TYPE_PHONE:
+ type = "PHONE";
+ do_display = TRUE;
+ break;
+ default:
+ /* ignore, not useful for conversation */
+ break;
+ }
}
-// else { GNUNET_asprintf(&callAddress, "%s", peer_id);}
+ /* FIXME: check if exists, if so, update or delete */
- g_print ("ego name %s\n", callAddress);
- GtkEntry *address_entry;
- address_entry = GTK_ENTRY ( GCG_get_main_window_object
("GNUNET_GTK_conversation_address"));
- gtk_entry_set_text (address_entry, callAddress);
- do_call (callAddress);
+ /* insert new record */
+ if (! do_display)
+ return;
+ gtk_list_store_append (contacts_liststore,
+ &iter);
+ gtk_list_store_set (contacts_liststore,
+ &iter,
+ CONTACTS_LS_NAME, rname,
+ CONTACTS_LS_TYPE, type,
+ -1);
}
-/*
+
+/**
+ * Function called once the monitor has caught up with the current
+ * state of the database. Will be called AGAIN after each disconnect
+ * (record monitor called with 'NULL' for zone_key) once we're again
+ * in sync.
+ *
+ * Could be used to optimize visuals if we block GTK updates while the
+ * list is not in sync.
+ *
+ * @param cls closure
+ */
static void
-print_ego (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *identifier)
+unfreeze_view (void *cls)
{
- struct GNUNET_CRYPTO_EcdsaPublicKey pk;
- char *s;
- GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
- s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
- fprintf (stdout, "%s \n", identifier);
-// GNUNET_free (s);
+ // tbd
}
-*/
-/*
-static void
-setCurrentAddressbookEgo(void *cls, struct GNUNET_IDENTITY_Ego *ego)
-{
- currentAddressBookEgo = ego;
-}
-*/
+
/**
* A different zone was selected in the zone toggle bar. Load the
* appropriate zone.
*
- * @param widget button that was toggled (could be to "on" or "off", we only
react to "on")
+ * @param widget combobox that was changed, unused
* @param user_data builder, unused
*/
void
gnunet_conversation_gtk_contacts_zone_combobox_changed_cb (GtkComboBox *widget,
- gpointer user_data)
+ gpointer user_data)
{
- GtkTreeIter contacts_zone_iter;
- struct GNUNET_IDENTITY_Ego *tempEgo;
- char *tempName;
- struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey;
- //GtkTreeSelection *selection;
- //GtkTreeIter iterA;
+ struct GNUNET_IDENTITY_Ego *ego;
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *temp_zone_pkey;
-
- gtk_combo_box_get_active_iter(widget, &contacts_zone_iter);
-
- gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
- &contacts_zone_iter,
- 0, &tempName,
- 1, &tempEgo,
- -1);
-// FPRINTF(stderr,"blat: %s\n", tempName);
- temp_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo);
- gtk_list_store_clear(contacts_liststore);
-/*
- GNUNET_IDENTITY_ego_lookup (cfg,
- tempName,
- setCurrentAddressbookEgo,
- NULL);
-*/
- //selection = gtk_tree_view_get_selection (zone_treeview);
-
- //gtk_tree_selection_get_selected (selection, &zone_treemodel, &iterA);
-
- //gtk_tree_model_get_iter_first(zone_treemodel, &iterA);
- //gtk_tree_model_get (zone_treemodel, &iterA, 0, &tempName, 1, &tempEgo, -1);
-
-
- list_it =
- GNUNET_NAMESTORE_zone_iteration_start (ns, &temp_zone_pkey,
&display_record,
- NULL);
-
-// GNUNET_IDENTITY_disconnect (id);
-
+ ego = GCG_EGOS_get_selected_ego ();
+ temp_zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego);
+ if (NULL != zone_mon)
+ {
+ GNUNET_NAMESTORE_zone_monitor_stop (zone_mon);
+ zone_mon = NULL;
+ }
+ gtk_list_store_clear (contacts_liststore);
+ zone_mon = GNUNET_NAMESTORE_zone_monitor_start (GCG_get_configuration (),
+ temp_zone_pkey,
+ GNUNET_YES,
+ &display_record,
+ &unfreeze_view,
+ NULL);
}
-
-//////
+/**
+ * Initialize the contact list
+ */
void
-GNUNET_CONVERSATION_GTK_CONTACTS_init ()
+GCG_CONTACTS_init ()
{
- GtkTreeIter iterContactsInit;
-
- // contacts
- contacts_liststore =
- GTK_LIST_STORE (GCG_get_main_window_object
+ contacts_liststore
+ = GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_liststore"));
- contacts_treeview =
- GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_treeview"));
-
+ contacts_treemodel = GTK_TREE_MODEL (contacts_liststore);
+ contacts_treeview
+ = GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_treeview"));
// gtk_tree_view_set_activate_on_single_click (contacts_treeview, TRUE);
- contacts_treemodel = GTK_TREE_MODEL (contacts_liststore);
- // zone list
- zone_liststore =
- GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_liststore"));
-
-// zone_treestore =
-// GTK_TREE_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_treestore"));
- zone_treemodel = GTK_TREE_MODEL (zone_liststore);
- zone_treeview =
- GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_zone_treeview"));
-
- gtk_tree_model_get_iter_first(zone_treemodel, &iterContactsInit);
- gtk_tree_model_iter_next(zone_treemodel, &iterContactsInit);
-
- gtk_combo_box_set_active_iter(GTK_COMBO_BOX (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_combobox")), &iterContactsInit);
-
- id = GNUNET_IDENTITY_connect (GCG_get_configuration (),
- &identity_cb,
- NULL);
-// zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
-// gtk_combo_box_set_active(GTK_WIDGET (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_combobox")), 1);
-// gtk_combo_box_set_active(GTK_WIDGET (GCG_get_main_window_object
(ml,"gnunet_conversation_gtk_outgoing_zone_combobox")), 1);
-
+ zone_treemodel
+ = GTK_TREE_MODEL (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_liststore"));
+ zone_treeview
+ = GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_zone_treeview"));
+ ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ());
}
+/**
+ * Shutdown the contact list
+ */
void
-GNUNET_CONVERSATION_GTK_CONTACTS_shutdown()
+GCG_CONTACTS_shutdown ()
{
-
- if (NULL != id)
+ if (NULL != zone_mon)
{
- GNUNET_IDENTITY_disconnect (id);
- id = NULL;
- } else {
- GNUNET_break(0);
+ GNUNET_NAMESTORE_zone_monitor_stop (zone_mon);
+ zone_mon = NULL;
}
-
- if (NULL != list_it)
- {
- FPRINTF(stderr,"LIST_IT == NULL");
-// GNUNET_NAMESTORE_zone_iteration_stop(list_it);
- }
if (NULL != ns)
{
GNUNET_NAMESTORE_disconnect (ns);
ns = NULL;
- } else {
- GNUNET_break(0);
}
-
GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey);
-
}
+/* end of gnunet-conversation-gtk_contacts.c */
-
-
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.h
2014-05-26 09:32:54 UTC (rev 33389)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.h
2014-05-26 10:02:44 UTC (rev 33390)
@@ -27,24 +27,17 @@
#ifndef GNUNET_CONVERSATION_GTK_CONTACTS_H
#define GNUNET_CONVERSATION_GTK_CONTACTS_H
-/*
-extern void
-display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey
*zone_key,
- const char *rname, unsigned int rd_len,
- const struct GNUNET_GNSRECORD_Data *rd);
-*/
-
/**
- * function to initialize the contact list
+ * Initialize the contact list
*/
extern void
-GNUNET_CONVERSATION_GTK_CONTACTS_init ();
+GCG_CONTACTS_init (void);
/**
- * function to shutdown the contact list
+ * Shutdown the contact list
*/
extern void
-GNUNET_CONVERSATION_GTK_CONTACTS_shutdown();
+GCG_CONTACTS_shutdown(void);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33390 - gnunet-gtk/src/conversation,
gnunet <=