[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33386 - gnunet-gtk/src/conversation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33386 - gnunet-gtk/src/conversation |
Date: |
Mon, 26 May 2014 10:47:02 +0200 |
Author: grothoff
Date: 2014-05-26 10:47:02 +0200 (Mon, 26 May 2014)
New Revision: 33386
Removed:
gnunet-gtk/src/conversation/gnunet-conversation-gtk_common.h
Modified:
gnunet-gtk/src/conversation/Makefile.am
gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
Log:
-a bit of code cleanup, doxygen fixes, fixing logging to eliminate memory leaks
Modified: gnunet-gtk/src/conversation/Makefile.am
===================================================================
--- gnunet-gtk/src/conversation/Makefile.am 2014-05-26 08:43:57 UTC (rev
33385)
+++ gnunet-gtk/src/conversation/Makefile.am 2014-05-26 08:47:02 UTC (rev
33386)
@@ -13,8 +13,7 @@
gnunet_conversation_gtk_SOURCES = \
gnunet-conversation-gtk.c \
- gnunet-conversation-gtk.h \
- gnunet-conversation-gtk_common.h \
+ gnunet-conversation-gtk.h \
gnunet-conversation-gtk_phone.c \
gnunet-conversation-gtk_phone.h \
gnunet-conversation-gtk_contacts.c \
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-05-26
08:43:57 UTC (rev 33385)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-05-26
08:47:02 UTC (rev 33386)
@@ -24,67 +24,12 @@
* @author yids
* @author hark
*/
-#include "gnunet-conversation-gtk_common.h"
+#include "gnunet-conversation-gtk.h"
#include "gnunet-conversation-gtk_history.h"
#include "gnunet-conversation-gtk_contacts.h"
-struct GNUNET_CONVERSATION_Caller *caller_selected = NULL;
-struct GNUNET_CONVERSATION_Call *call_selected = NULL;
-
-/*************
- * common *
- *************/
-/**
- * * Handle to our main loop.
- * */
-static struct GNUNET_GTK_MainLoop *ml;
-
/**
- * Get our configuration.
- *
- * @return configuration handle
- */
-const struct GNUNET_CONFIGURATION_Handle *
-GIG_get_configuration ();
-
-/**
- * Our configurations.
- */
-static struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Name of our ego.
- */
-static char *ego_name;
-
-/**
- * Be verbose.
- */
-static int verbose = 1;
-
-
-/**
- * Should gnunet-identity-gtk start in tray mode?
- */
-static int tray_only;
-
-
-/*************
- * phone *
- *************/
-
-/**
- * List of active calls
- */
-static GtkListStore *active_liststore;
-
-/**
- * List of active calls
- */
-static GtkTreeView *active_treeview;
-
-/**
* List of incoming calls
*/
struct CallList
@@ -121,13 +66,59 @@
unsigned int caller_num;
};
- /**
- * Unique number of call (outgoing)
- */
- unsigned int call_counter;
/**
+ *
+ */
+static struct GNUNET_CONVERSATION_Caller *caller_selected;
+
+/**
+ *
+ */
+static struct GNUNET_CONVERSATION_Call *call_selected;
+
+/**
+ * Handle to our main loop.
+ */
+static struct GNUNET_GTK_MainLoop *ml;
+
+/**
+ * Our configurations.
+ */
+static struct GNUNET_CONFIGURATION_Handle *cfg;
+
+/**
+ * Name of our ego.
+ */
+static char *ego_name;
+
+/**
+ * Be verbose.
+ */
+static int verbose = 1;
+
+/**
+ * Should gnunet-identity-gtk start in tray mode?
+ */
+static int tray_only;
+
+/**
+ * List of active calls
+ */
+static GtkListStore *active_liststore;
+
+/**
+ * List of active calls
+ */
+static GtkTreeView *active_treeview;
+
+/**
+ * Unique number of call (outgoing)
+ */
+static unsigned int call_counter;
+
+/**
* Phone handle
*/
static struct GNUNET_CONVERSATION_Phone *phone;
@@ -160,7 +151,6 @@
/**
* debug box enabled
*/
-
static unsigned int debug_box_enabled;
/**
@@ -203,37 +193,33 @@
*/
static char *address;
-GtkWidget *b_contact, *b_accept, *b_hangup, *b_suspend, *b_resume;
+static GtkWidget *b_contact;
+static GtkWidget *b_accept;
-/*******************
- * identity select *
- *******************/
+static GtkWidget *b_hangup;
+static GtkWidget *b_suspend;
+static GtkWidget *b_resume;
+
/**
* list of zones
*/
static GtkListStore *zone_liststore;
/**
- * zone tree model
- */
-//static GtkTreeModel *zone_treemodel;
-
-/**
* Our ego.
*/
static struct GNUNET_IDENTITY_Ego *caller_id;
-void GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed ();
+void
+GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed (void);
-void set_status_icon (const char *icon_name);
-/************
- * extern's *
- * **********/
+static void
+set_status_icon (const char *icon_name);
/**
@@ -242,109 +228,102 @@
* @param name name of the object
* @return NULL on error
*/
-extern GObject *
-GNUNET_CONVERSATION_GTK_get_main_window_object (const char *name)
+GObject *
+GCG_get_main_window_object (const char *name)
{
- return GNUNET_GTK_main_loop_get_object (ml, name);
+ return GNUNET_GTK_main_loop_get_object (ml, name);
}
/**
* log a message to gtk log textbuffer
- * @param Message to be logged
+ *
+ * @param message format string for message to be logged
+ * @param ... arguments for the format string
*/
-
-extern void
-GNUNET_CONVERSATION_GTK_log_message (const char *message)
+void
+GCG_log (const char *message,
+ ...)
{
- //
- // log
- //
GtkTextBuffer *logbuff;
GtkTextView *log_view;
GtkTextIter iter;
gchar *fmsg;
+ va_list ap;
- log_view = GTK_TEXT_VIEW (get_object ("GNUNET_GTK_conversation_log"));
-
+ log_view = GTK_TEXT_VIEW (GCG_get_main_window_object
("GNUNET_GTK_conversation_log"));
logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
-
- fmsg = g_strdup_printf (" %s \n", message);
-
- gtk_text_buffer_get_start_iter (logbuff, &iter);
-
- gtk_text_buffer_insert (logbuff, &iter, fmsg, -1);
+ va_start (ap, message);
+ fmsg = g_strdup_vprintf (message,
+ ap);
+ va_end (ap);
+ gtk_text_buffer_get_start_iter (logbuff,
+ &iter);
+ gtk_text_buffer_insert (logbuff,
+ &iter,
+ fmsg,
+ -1);
g_free (fmsg);
+}
-}
-
/**
- * update status
+ * update status bar
*
- * @param message Message to put in statusbar
+ * @param message format string for message to put in statusbar
+ * @param ... arguments for the format string
*/
-
-static void
-update_status (const gchar * message)
+void
+GCG_update_status (const gchar *message,
+ ...)
{
-
GtkStatusbar *status_bar;
guint status_bar_context;
-
gchar *buff;
+ va_list ap;
- status_bar = GTK_STATUSBAR (get_object
("GNUNET_GTK_conversation_statusbar"));
+ status_bar = GTK_STATUSBAR (GCG_get_main_window_object
("GNUNET_GTK_conversation_statusbar"));
status_bar_context = gtk_statusbar_get_context_id (status_bar, "blaat");
-
-
- buff = g_strdup_printf ("%s", message);
-
+ va_start (ap, message);
+ buff = g_strdup_vprintf (message,
+ ap);
+ va_end (ap);
gtk_statusbar_push (GTK_STATUSBAR (status_bar),
GPOINTER_TO_INT (status_bar_context), buff);
g_free (buff);
-
- GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed();
-
-
+ GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed (); // FIXME: why
do this here?
}
/**
- * update statusbar
+ * update status based on current phone state.
*
* @param args arguments given to the command
*/
static void
do_status ()
{
- struct CallList *cl;
-
switch (phone_state)
{
case PS_LOOKUP_EGO:
- UPDATE_STATUS (_
- ("We are currently trying to locate the private key for the
ego `%s'."),
- ego_name);
+ GCG_update_status (_("We are currently trying to locate the private key
for the ego `%s'."),
+ ego_name);
set_status_icon ("gnunet-conversation-gtk-tray-pending");
break;
case PS_LISTEN:
- UPDATE_STATUS (_
- ("We are listening for incoming calls for ego `%s' on line
%u."),
- ego_name, line);
+ GCG_update_status (_("We are listening for incoming calls for ego `%s' on
line %u."),
+ ego_name,
+ line);
set_status_icon ("gnunet-conversation-gtk-tray-available");
-
break;
case PS_ACCEPTED:
- UPDATE_STATUS (_("You are having a conversation with `%s'.\n"), peer_name);
+ GCG_update_status (_("You are having a conversation with `%s'.\n"),
+ peer_name);
set_status_icon ("gnunet-conversation-call-active");
-
break;
case PS_ERROR:
- UPDATE_STATUS (_
- ("We had an internal error setting up our phone line. You
can still make calls."));
+ GCG_update_status (_("We had an internal error setting up our phone line.
You can still make calls."));
set_status_icon ("gnunet-conversation-offline");
-
break;
}
if (NULL != call)
@@ -352,282 +331,252 @@
switch (call_state)
{
case CS_RESOLVING:
- UPDATE_STATUS (_
- ("We are trying to find the network address to call
`%s'."),
- peer_name);
+ GCG_update_status (_("We are trying to find the network address to call
`%s'."),
+ peer_name);
set_status_icon ("gnunet-conversation-gtk-tray-call-pending");
-
break;
case CS_RINGING:
- UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
- peer_name);
+ GCG_update_status (_("We are calling `%s', his phone should be
ringing."),
+ peer_name);
set_status_icon ("gnunet-conversation-gtk-tray-call-ringing");
-
break;
case CS_CONNECTED:
- UPDATE_STATUS (_("You are having a conversation with `%s'."), peer_name);
+ GCG_update_status (_("You are having a conversation with `%s'."),
+ peer_name);
set_status_icon ("gnunet-conversation-gtk-tray-call-active");
-
break;
case CS_SUSPENDED:
+ GCG_update_status (_("Conversation suspended, you can accept or initiate
another call now."),
+ peer_name);
set_status_icon ("gnunet-conversation-gtk-tray-call-suspended");
-
- /* ok to accept incoming call right now */
break;
}
}
- if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail)))
- {
+ if ( ( (NULL == call) ||
+ (CS_SUSPENDED == call_state) ) &&
+ (NULL != cl_head) &&
+ ( (cl_head != cl_active) ||
+ (cl_head != cl_tail) ) )
set_status_icon ("gnunet-conversation-gtk-tray-call-incoming");
-
- for (cl = cl_head; NULL != cl; cl = cl->next)
- {
- if (cl == cl_active)
- continue;
- //UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id);
-// LOG ("%s", _("Calls waiting:"));
- }
- }
}
-
-/*
+/**
* @brief print info for currently selected call
*/
static void
-print_call_info()
+print_call_info ()
{
- GtkTreeIter gtkiter;
- gboolean valid;
- gint row_count = 0;
+ GtkTreeIter gtkiter;
+ gboolean valid;
+ gint row_count = 0;
- valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter );
-
- if (!valid)
- GNUNET_break(0);
-
- while (valid)
+ valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (active_liststore),
+ >kiter);
+ if (! valid)
+ GNUNET_break(0);
+
+ while (valid)
+ {
+ gchar *str_data;
+ gint int_data;
+ gpointer cl_caller;
+ gpointer cl_call;
+
+ gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), >kiter,
+ AL_caller, &cl_caller,
+ AL_caller_id, &str_data,
+ AL_caller_num, &int_data,
+ AL_call, &cl_call,
+ -1);
+ if (caller_selected == cl_caller)
{
- gchar *str_data;
- gint int_data;
- gpointer cl_caller;
- gpointer cl_call;
-
- gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), >kiter,
- AL_caller, &cl_caller,
- AL_caller_id, &str_data,
- AL_caller_num, &int_data,
- AL_call, &cl_call,
- -1);
- if (caller_selected == cl_caller)
- {
- // LOG (_("info for active call:%s number: %u row: %u"),
str_data,int_data,row_count);
- currentlySelectedCallAddress = str_data;
-// FPRINTF(stderr,"cal addr: %s\n",currentlySelectedCallAddress);
- break ;
- }
- if (call_selected == cl_call)
- {
- LOG (_("info for active outgoing call:%s number: %u row: %u"),
str_data,int_data,row_count);
- break;
- }
+ currentlySelectedCallAddress = str_data;
+ break;
+ }
+ if (call_selected == cl_call)
+ {
+ GCG_log (_("info for active outgoing call:%s number: %u row: %u"),
+ str_data,
+ int_data,
+ row_count);
+ break;
+ }
g_free (str_data);
row_count++;
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore),
>kiter);
- }
-
-
-
+ }
}
-
-/*
+/**
* @brief sets caller_selected, and enables or disables the active call list
buttons
*/
static void
update_active_call_list_buttons()
{
- gchar *caller_id;
- gpointer cl_caller;
- gpointer cl_call;
- gint cl_caller_state;
- gint cl_type;
- //gint cl_caller_type;
- GtkTreeSelection *active_selection;
- GtkTreeIter gcl_selected;
-// active_liststore_selection =
get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_selection");
+ gchar *caller_id;
+ gpointer cl_caller;
+ gpointer cl_call;
+ gint cl_caller_state;
+ gint cl_type;
+ //gint cl_caller_type;
+ GtkTreeSelection *active_selection;
+ GtkTreeIter gcl_selected;
+ // active_liststore_selection =
GCG_get_main_window_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_selection");
- // reset references to selected call/caller
- //caller_selected = NULL;
- //call_selected = NULL;
- LOG("reset caller selected");
- active_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW
(active_treeview));
+ // reset references to selected call/caller
+ //caller_selected = NULL;
+ //call_selected = NULL;
+ GCG_log("reset caller selected");
+ active_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW
(active_treeview));
+ if (gtk_tree_selection_get_selected (active_selection,
+ NULL,
+ &gcl_selected))
+ {
+ // get selected call
+ gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected,
+ AL_caller, &cl_caller, // reference to incoming call
+ AL_caller_id, &caller_id,
+ AL_caller_state, &cl_caller_state,
+ AL_type, &cl_type,
+ AL_call, &cl_call, // reference to outgoing call
+ -1);
+ // check if selected call is a incoming or outgoing call
+ switch (cl_type)
+ {
+ case CALL_IN:
+ call_selected = NULL;
+ caller_selected = cl_caller;
+ GNUNET_break (NULL != caller_selected);
+ break;
+ case CALL_OUT:
+ caller_selected = NULL;
+ call_selected = cl_call;
+ GCG_log("outgoing selected");
+ GNUNET_break (NULL != call_selected);
+ break;
+ default:
+ GNUNET_break(0);
+ break;
+ }
+
gtk_widget_show(GTK_WIDGET(GCG_get_main_window_object("GNUNET_GTK_conversation_active_call_list_buttons")));
+ GCG_log("caller state: %u phone_state: %u",
+ cl_caller_state,
+ phone_state);
+ switch (cl_caller_state)
+ {
+ /* buttons:
+ * contact
+ * accept
+ * hangup
+ * suspend
+ * resume
+ *
+ * TODO: check if there is incoming or outgoing call,
+ * disable resume and accept buttons.
+ * or suspend that other call
+ */
+ case CT_active:
+ // hangup, pause
+ //GCG_log("CT_active state: %u ",cl_caller_state);
+ gtk_widget_set_sensitive (b_contact, TRUE);
+ gtk_widget_set_sensitive (b_accept, FALSE);
+ gtk_widget_set_sensitive (b_hangup, TRUE);
+ gtk_widget_set_sensitive (b_suspend, TRUE);
+ gtk_widget_set_sensitive (b_resume, FALSE);
+ break;
+ case CT_ringing:
+ // pickup, phonebook
+ //GCG_log("CT_ring show button");
+ gtk_widget_set_sensitive (b_contact, TRUE);
+ if (phone_state == PS_LISTEN)
+ {
+ gtk_widget_set_sensitive (b_accept, TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (b_accept, FALSE);
+ }
+ gtk_widget_set_sensitive (b_hangup, FALSE);
+ gtk_widget_set_sensitive (b_suspend, FALSE);
+ gtk_widget_set_sensitive (b_resume, FALSE);
+ break;
+ case CT_rejected:
+ //add to phonebook
+ //GCG_log("CT_rejected ");
+ gtk_widget_set_sensitive (b_contact, TRUE);
+ gtk_widget_set_sensitive (b_accept, FALSE);
+ gtk_widget_set_sensitive (b_hangup, FALSE);
+ gtk_widget_set_sensitive (b_suspend, FALSE);
+ gtk_widget_set_sensitive (b_resume, FALSE);
+ break;
+ case CT_suspended:
+ // resume, hangup
+ //GCG_log("CT_suspended ");
+ gtk_widget_set_sensitive (b_contact, TRUE);
+ gtk_widget_set_sensitive (b_accept, FALSE);
+ gtk_widget_set_sensitive (b_hangup, TRUE);
+ gtk_widget_set_sensitive (b_suspend, FALSE);
+ if (phone_state == PS_LISTEN)
+ {
+ GCG_log("enable resume button");
+ gtk_widget_set_sensitive (b_resume, TRUE);
+ }
+ else
+ {
+ GCG_log("do not disable resume button (for test)");
+ gtk_widget_set_sensitive (b_resume, TRUE);
+ }
+ break;
+ case CT_other:
+ //add to phonebook
+ //GCG_log("CT_rejected ");
+ gtk_widget_set_sensitive (b_contact, TRUE);
+ gtk_widget_set_sensitive (b_accept, TRUE);
+ gtk_widget_set_sensitive (b_hangup, TRUE);
+ gtk_widget_set_sensitive (b_suspend, TRUE);
+ gtk_widget_set_sensitive (b_resume, TRUE);
+ break;
+ default:
+ GNUNET_break(0);
+ break;
+ }
+ print_call_info();
+ }
+ else
+ {
+ GCG_log("nothing selected");
+
//gtk_widget_hide(GTK_WIDGET(GCG_get_main_window_object("GNUNET_GTK_conversation_active_call_list_buttons"
)));
+ }
+}
- if (gtk_tree_selection_get_selected(active_selection,NULL,&gcl_selected))
- {
- // get selected call
- gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected,
- AL_caller, &cl_caller, // reference to incoming
call
- AL_caller_id, &caller_id,
- AL_caller_state, &cl_caller_state,
- AL_type, &cl_type,
- AL_call, &cl_call, // reference to outgoing call
- -1);
-
- // check if selected call is a incoming or outgoing call
- switch (cl_type)
- {
- case CALL_IN:
- call_selected = NULL;
- caller_selected = cl_caller;
- if (caller_selected == NULL){
- GNUNET_break(0);
- }
-
- break;
- case CALL_OUT:
- caller_selected = NULL;
- call_selected = cl_call;
- LOG("outgoing selected");
- if (call_selected == NULL){
- GNUNET_break(0);
- }
- break;
- default:
- GNUNET_break(0);
- break;
- }
-
-
-
-
gtk_widget_show(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons"
)));
-
- LOG("caller state: %u phone_state: %u",cl_caller_state, phone_state);
-
- switch (cl_caller_state)
- {
- /* buttons:
- * contact
- * accept
- * hangup
- * suspend
- * resume
- *
- * TODO: check if there is incoming or outgoing call,
- * disable resume and accept buttons.
- * or suspend that other call
- */
-
- case CT_active:
- // hangup, pause
- //LOG("CT_active state: %u ",cl_caller_state);
- gtk_widget_set_sensitive(b_contact, 1);
- gtk_widget_set_sensitive(b_accept, 0);
- gtk_widget_set_sensitive(b_hangup, 1);
- gtk_widget_set_sensitive(b_suspend, 1);
- gtk_widget_set_sensitive(b_resume, 0);
- break;
- case CT_ringing:
- // pickup, phonebook
- //LOG("CT_ring show button");
- gtk_widget_set_sensitive(b_contact, 1);
- if (phone_state == PS_LISTEN)
- {
- gtk_widget_set_sensitive(b_accept, 1);
- }else{
- gtk_widget_set_sensitive(b_accept, 0);
- }
-
-
- gtk_widget_set_sensitive(b_hangup, 0);
- gtk_widget_set_sensitive(b_suspend, 0);
- gtk_widget_set_sensitive(b_resume, 0);
- break;
- case CT_rejected:
- //add to phonebook
- //LOG("CT_rejected ");
- gtk_widget_set_sensitive(b_contact, 1);
- gtk_widget_set_sensitive(b_accept, 0);
- gtk_widget_set_sensitive(b_hangup, 0);
- gtk_widget_set_sensitive(b_suspend, 0);
- gtk_widget_set_sensitive(b_resume, 0);
-
- break;
- case CT_suspended:
- // resume, hangup
- //LOG("CT_suspended ");
- gtk_widget_set_sensitive(b_contact, 1 );
- gtk_widget_set_sensitive(b_accept, 0);
- gtk_widget_set_sensitive(b_hangup, 1);
- gtk_widget_set_sensitive(b_suspend, 0);
-
- if (phone_state == PS_LISTEN)
- {
- LOG("enable resume button");
- gtk_widget_set_sensitive(b_resume, 1);
- }else{
- LOG("do not disable resume button (for test)");
- gtk_widget_set_sensitive(b_resume, 1);
- }
- break;
- case CT_other:
- //add to phonebook
- //LOG("CT_rejected ");
- gtk_widget_set_sensitive(b_contact, 1);
- gtk_widget_set_sensitive(b_accept, 1);
- gtk_widget_set_sensitive(b_hangup, 1);
- gtk_widget_set_sensitive(b_suspend, 1);
- gtk_widget_set_sensitive(b_resume,1);
-
- break;
-
- default:
- GNUNET_break(0);
- break;
- }
- print_call_info();
- }
- else
- {
-
- LOG("nothing selected");
-
-
//gtk_widget_hide(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons"
)));
-
- }
-
-} //end function
-
-/*
+/**
* @brief executed when selecting a different item in active call list
*/
-
void
GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed()
{
- update_active_call_list_buttons();
+ update_active_call_list_buttons();
}
void
disable_list_buttons()
{
- gtk_widget_set_sensitive(b_contact, 0);
- gtk_widget_set_sensitive(b_accept, 0);
- gtk_widget_set_sensitive(b_hangup, 0);
- gtk_widget_set_sensitive(b_suspend, 0);
- gtk_widget_set_sensitive(b_resume, 0);
+ gtk_widget_set_sensitive (b_contact, FALSE);
+ gtk_widget_set_sensitive (b_accept, FALSE);
+ gtk_widget_set_sensitive (b_hangup, FALSE);
+ gtk_widget_set_sensitive (b_suspend, FALSE);
+ gtk_widget_set_sensitive (b_resume, FALSE);
}
-
-/*
+/**
* set_status_icon
- *
+ *
* available icons:
* gnunet-conversation-gtk-tray-pending
* gnunet-conversation-gtk-tray-available
@@ -639,122 +588,113 @@
* gnunet-conversation-gtk-tray-call-incoming
*
*/
-
void
set_status_icon (const char *icon_name)
{
GtkImage *status_icon;
- status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon"));
-
- gtk_image_set_from_icon_name (status_icon, icon_name, GTK_ICON_SIZE_BUTTON);
-
- //LOG (_("Tray icon changed to: `%s' "), icon_name);
-
- GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status");
+ status_icon = GTK_IMAGE (GCG_get_main_window_object
("GNUNET_GTK_status_icon"));
+ gtk_image_set_from_icon_name (status_icon,
+ icon_name,
+ GTK_ICON_SIZE_BUTTON);
+ GNUNET_GTK_tray_icon_change (icon_name,
+ "gnunet-conversation-gtk-status");
}
-/*
+/**
* set button text
+ *
* @param button_name name of button
* @param label label on the button
*/
-
void
-set_button_text (const char *button_name, const char *label)
+set_button_text (const char *button_name,
+ const char *label)
{
- //GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET (get_object (button_name));
+ button = GTK_WIDGET (GCG_get_main_window_object (button_name));
gtk_widget_hide (button);
}
-/*
+
+/**
* disable button
*/
-
void
disable_button (const char *button_name)
{
- //GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET (get_object (button_name));
+ button = GTK_WIDGET (GCG_get_main_window_object (button_name));
gtk_widget_hide (button);
}
-/*
+
+/**
* enable button
*/
-
void
enable_button (const char *button_name)
{
//GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET (get_object (button_name));
+ button = GTK_WIDGET (GCG_get_main_window_object (button_name));
gtk_widget_show (button);
}
+
/**
* set state of outgoing call
*/
void
-set_outgoing_call_state(struct GNUNET_CONVERSATION_Call *call, int state)
+set_outgoing_call_state (struct GNUNET_CONVERSATION_Call *call,
+ int state)
{
- LOG("set state to: %u", state);
GtkTreeIter gtkiter;
gint valid = 0;
gint cl_type;
- //FPRINTF (stderr,"set incoming call state:%u caller: ",state);
-// LOG (_("set incoming call state:%u caller: "),state);
-
- valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter );
-
- if (!valid)
- GNUNET_break(0);
-
- while (valid)
- {
- gchar *cl_caller_id;
- gint cl_caller_num;
- gpointer cl_call;
+ GCG_log("set state to: %u", state);
+ valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter);
- gtk_tree_model_get ( GTK_TREE_MODEL( active_liststore ), >kiter,
- AL_call, &cl_call,
- AL_caller_id,&cl_caller_id,
- AL_caller_num,&cl_caller_num,
- AL_type, &cl_type,
- -1);
+ if (!valid)
+ GNUNET_break(0);
+ while (valid)
+ {
+ gchar *cl_caller_id;
+ gint cl_caller_num;
+ gpointer cl_call;
- if (cl_type == CALL_OUT) {
-
- if (call == NULL) // function called by phone event handler
- {
- LOG("event handler");
- gtk_list_store_set(active_liststore, >kiter,
- AL_call_state, state,
- -1);
- switch (state)
- {
-
+ gtk_tree_model_get ( GTK_TREE_MODEL( active_liststore ), >kiter,
+ AL_call, &cl_call,
+ AL_caller_id,&cl_caller_id,
+ AL_caller_num,&cl_caller_num,
+ AL_type, &cl_type,
+ -1);
+ if (cl_type == CALL_OUT)
+ {
+ if (call == NULL) // function called by phone event handler
+ {
+ GCG_log("event handler");
+ gtk_list_store_set(active_liststore, >kiter,
+ AL_call_state, state,
+ -1);
+ switch (state)
+ {
/**
* We are the caller and are now ringing the other party (GNS lookup
* succeeded).
*/
- case GNUNET_CONVERSATION_EC_CALL_RINGING:
-
- break;
-
+ case GNUNET_CONVERSATION_EC_CALL_RINGING:
+ break;
/**
* We are the caller and are now ready to talk as the callee picked
up.
*/
- case GNUNET_CONVERSATION_EC_CALL_PICKED_UP:
- break;
+ case GNUNET_CONVERSATION_EC_CALL_PICKED_UP:
+ break;
/**
* We are the caller and failed to locate a phone record in GNS.
* After this invocation, the respective call handle will be
@@ -762,119 +702,102 @@
* #GNUNET_CONVERSATION_call_stop or any other function on the
* call object.
*/
- case GNUNET_CONVERSATION_EC_CALL_GNS_FAIL:
+ case GNUNET_CONVERSATION_EC_CALL_GNS_FAIL:
gtk_list_store_remove(active_liststore,>kiter);
- disable_list_buttons();
- break;
-
+ disable_list_buttons();
+ break;
/**
* We are the caller and the callee called
* #GNUNET_CONVERSATION_caller_hang_up. After this invocation, the
* respective call handle will be automatically destroyed and the
* client must no longer call #GNUNET_CONVERSATION_call_stop.
*/
- case GNUNET_CONVERSATION_EC_CALL_HUNG_UP:
- gtk_list_store_remove(active_liststore,>kiter);
- disable_list_buttons();
- break;
-
+ case GNUNET_CONVERSATION_EC_CALL_HUNG_UP:
+ gtk_list_store_remove(active_liststore,>kiter);
+ disable_list_buttons();
+ break;
/**
* We are the caller and the callee suspended the call. Note that
* both sides can independently suspend and resume calls; a call is
* only "working" of both sides are active.
*/
- case GNUNET_CONVERSATION_EC_CALL_SUSPENDED:
- break;
-
+ case GNUNET_CONVERSATION_EC_CALL_SUSPENDED:
+ break;
/**
* We are the caller and the callee suspended the call. Note that
* both sides can independently suspend and resume calls; a call is
* only "working" of both sides are active.
*/
- case GNUNET_CONVERSATION_EC_CALL_RESUMED:
- break;
-
+ case GNUNET_CONVERSATION_EC_CALL_RESUMED:
+ break;
/**
* We had an error handing the call, and are now restarting it
* (back to lookup). This happens, for example, if the peer
* is restarted during a call.
*/
- case GNUNET_CONVERSATION_EC_CALL_ERROR:
- break;
+ case GNUNET_CONVERSATION_EC_CALL_ERROR:
+ break;
+ default:
+ break;
+ }
+ }
+ else if (call == cl_call) // function called for specific call
+ {
+ //GCG_log (_("setting state for call:%u row: %u state:
%u"),cl_caller_num,row_count,state);
- default:
- break;
- }
+ switch (state)
+ {
+ case CT_hangup:
+ //GCG_log("remove line cause hangup");
+ gtk_list_store_remove(active_liststore,>kiter);
+ disable_list_buttons();
+ break;
+ case CT_rejected:
+ //GCG_log("remove line cause rejected");
+ gtk_list_store_remove(active_liststore,>kiter);
+ disable_list_buttons();
+ break;
+ default:
+ gtk_list_store_set(active_liststore, >kiter,
+ AL_caller_state, state,
+ -1);
+ break;
+ }//end switch
+ }//end call=cl_call
+ } //end cl_type
+ g_free (cl_caller_id);
+ valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore),
>kiter);
+ }//end while
+ GCG_update_status ("");
+}
-
-
-
- }
- else if (call == cl_call) // function called for specific call
- {
- //LOG (_("setting state for call:%u row: %u state:
%u"),cl_caller_num,row_count,state);
-
- switch (state)
- {
- case CT_hangup:
- //LOG("remove line cause hangup");
- gtk_list_store_remove(active_liststore,>kiter);
- disable_list_buttons();
- break;
-
- case CT_rejected:
- //LOG("remove line cause rejected");
- gtk_list_store_remove(active_liststore,>kiter);
- disable_list_buttons();
- break;
- default:
-
- gtk_list_store_set(active_liststore, >kiter,
- AL_caller_state, state,
- -1);
- break;
-
- }//end switch
- }//end call=cl_call
- } //end cl_type
- g_free (cl_caller_id);
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore),
>kiter);
-
- }//end while
-
- //update statsbar
- update_status("");
-
-
-
-}
-
/**
* set call state of a incoming call
*/
static void
-set_incoming_call_state(struct GNUNET_CONVERSATION_Caller *caller, int state)
+set_incoming_call_state (struct GNUNET_CONVERSATION_Caller *caller,
+ int state)
{
GtkTreeIter gtkiter;
gint valid = 0;
//FPRINTF (stderr,"set incoming call state:%u caller: ",state);
-// LOG (_("set incoming call state:%u caller: "),state);
-
- valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter );
-
- if (!valid)
+// GCG_log (_("set incoming call state:%u caller: "),state);
+
+ valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter );
+
+ if (!valid)
GNUNET_break(0);
-
+
while (valid)
{
gchar *cl_caller_id;
gint cl_caller_num;
gpointer cl_caller;
- gtk_tree_model_get ( GTK_TREE_MODEL( active_liststore ), >kiter,
+ gtk_tree_model_get ( GTK_TREE_MODEL( active_liststore ), >kiter,
AL_caller, &cl_caller,
AL_caller_id,&cl_caller_id,
AL_caller_num,&cl_caller_num
@@ -882,47 +805,41 @@
if (caller == cl_caller)
{
- //LOG (_("setting state for call:%u row: %u state:
%u"),cl_caller_num,row_count,state);
+ //GCG_log (_("setting state for call:%u row: %u state:
%u"),cl_caller_num,row_count,state);
switch (state)
{
case CT_hangup:
- //LOG("remove line cause hangup");
+ //GCG_log("remove line cause hangup");
gtk_list_store_remove(active_liststore,>kiter);
disable_list_buttons();
- break;
+ break;
case CT_rejected:
- //LOG("remove line cause rejected");
+ //GCG_log("remove line cause rejected");
gtk_list_store_remove(active_liststore,>kiter);
disable_list_buttons();
- break;
+ break;
default:
-
+
gtk_list_store_set(active_liststore, >kiter,
AL_caller_state, state,
-1);
break;
-
- }//end switch
+
+ }//end switch
}//endif
-
+
g_free (cl_caller_id);
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore),
>kiter);
-
+
}//end while
-
- //update statsbar
- update_status("");
-
-
+ GCG_update_status("");
}
-
-
/**
* Function called with an event emitted by a phone.
*
@@ -932,27 +849,25 @@
* @param caller_id name of the caller in GNS
*/
static void
-phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code,
+phone_event_handler (void *cls,
+ enum GNUNET_CONVERSATION_PhoneEventCode code,
struct GNUNET_CONVERSATION_Caller *caller,
const char *caller_id)
{
+ GtkTreeIter gtkiter;
+ GtkTreeIter gtkiter1;
+ gboolean valid;
- //gtk
- GtkTreeIter gtkiter;
- GtkTreeIter gtkiter1;
- gboolean valid;
-
-
switch (code)
{
case GNUNET_CONVERSATION_EC_PHONE_RING:
//increment call #
- caller_num_gen++;
-
+ caller_num_gen++;
- LOG (_("A Incoming call from `%s' with number %u\n"), caller_id,
+
+ GCG_log (_("A Incoming call from `%s' with number %u\n"), caller_id,
caller_num_gen);
-
+
//old
struct CallList *cl;
@@ -961,15 +876,15 @@
cl->caller_id = GNUNET_strdup (caller_id);
cl->caller_num = caller_num_gen;
GNUNET_CONTAINER_DLL_insert (cl_head, cl_tail, cl);
- //gtk
+ //gtk
gtk_list_store_append (active_liststore, >kiter);
- gtk_list_store_set (active_liststore, >kiter,
- AL_caller_id, caller_id,
+ gtk_list_store_set (active_liststore, >kiter,
+ AL_caller_id, caller_id,
AL_caller, caller,
AL_caller_num, caller_num_gen,
AL_caller_state, CT_ringing,
- AL_type, CALL_IN
+ AL_type, CALL_IN
,-1);
@@ -977,12 +892,12 @@
case GNUNET_CONVERSATION_EC_PHONE_HUNG_UP:
//gtk
-
- valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter1 );
-
+
+ valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ),
>kiter1 );
+
if (!valid)
GNUNET_break(0);
-
+
while (valid)
{
//FPRINTF(stderr,"GNUNET_CONVERSATION_EC_PHONE_HUNG_UP: while valid");
@@ -990,28 +905,28 @@
gchar *str_data;
gint int_data;
gpointer cl_caller;
-
- gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), >kiter1,
+
+ gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), >kiter1,
AL_caller, &cl_caller,
AL_caller_id,&str_data,
AL_caller_num,&int_data,-1);
if (caller == cl_caller)
{
- LOG (_("phone hung up:%s number: %u "), str_data,int_data);
+ GCG_log (_("phone hung up:%s number: %u "), str_data,int_data);
set_incoming_call_state(caller,CT_rejected);
break ;
}
g_free (str_data);
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore),
>kiter1);
}
-
-
+
+
phone_state = PS_LISTEN;
//add to call history list
//history_add(CH_HANGUP, cl->caller_id);
-
+
break;
}
@@ -1026,25 +941,29 @@
* @param code type of the event issued by the caller
*/
static void
-caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code)
+caller_event_handler (void *cls,
+ enum GNUNET_CONVERSATION_CallerEventCode code)
{
- if (cls == NULL){
- LOG("caller_event_handler: cls == NULL");
- GNUNET_break(0);
- } else {
+ if (cls == NULL)
+ {
+ GCG_log("caller_event_handler: cls == NULL");
+ GNUNET_break(0);
+ }
+ else
+ {
struct CallList *cl = cls;
switch (code)
{
case GNUNET_CONVERSATION_EC_CALLER_SUSPEND:
- //TODO: should this be cls? not cl->caller
+ //TODO: should this be cls? not cl->caller
set_incoming_call_state(cl->caller,CT_suspended);
- LOG (_("Call from `%s' suspended by other user\n"), cl->caller_id);
+ GCG_log (_("Call from `%s' suspended by other user\n"), cl->caller_id);
break;
case GNUNET_CONVERSATION_EC_CALLER_RESUME:
set_incoming_call_state(cl->caller,CT_active);
- LOG (_("Call from `%s' resumed by other user\n"), cl->caller_id);
+ GCG_log (_("Call from `%s' resumed by other user\n"), cl->caller_id);
break;
}
}
@@ -1062,7 +981,7 @@
GtkLabel *label;
if (NULL == caller_id)
{
- LOG (_("Ego `%s' no longer available, phone is now down.\n"), ego_name);
+ GCG_log (_("Ego `%s' no longer available, phone is now down.\n"),
ego_name);
phone_state = PS_LOOKUP_EGO;
return;
}
@@ -1073,7 +992,7 @@
/* FIXME: get record and print full GNS record info later here... */
if (NULL == phone)
{
- LOG ("%s", _("Failed to setup phone (internal error)\n"));
+ GCG_log ("%s", _("Failed to setup phone (internal error)\n"));
phone_state = PS_ERROR;
}
else
@@ -1084,13 +1003,14 @@
GNUNET_GNSRECORD_value_to_string (rd.record_type, rd.data,
rd.data_size);
- LOG (_("address: `%s' \n"), address);
+ GCG_log (_("address: `%s' \n"), address);
- label = GTK_LABEL(get_object("GNUNET_CONVERSATION_GTK_my_address"));
+ label =
GTK_LABEL(GCG_get_main_window_object("GNUNET_CONVERSATION_GTK_my_address"));
gtk_label_set_text(label, address);
if (verbose)
- LOG (_("Phone active on line %u\n"), (unsigned int) line);
+ GCG_log (_("Phone active on line %u\n"),
+ (unsigned int) line);
phone_state = PS_LISTEN;
}
do_status();
@@ -1104,50 +1024,51 @@
* @param code type of the event on the call
*/
static void
-call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
+call_event_handler (void *cls,
+ enum GNUNET_CONVERSATION_CallEventCode code)
{
- //struct OutgoingCallClosure *cl = cls;
-
- //LOG("call event handler code: %u num: %u", code, cl->call_num);
+ //struct OutgoingCallClosure *cl = cls;
+ //GCG_log("call event handler code: %u num: %u", code, cl->call_num);
+
//if (cls == NULL){
set_outgoing_call_state(NULL, code);
//GNUNET_break(0);
- //} else
+ //} else
//{
switch (code)
{
case GNUNET_CONVERSATION_EC_CALL_RINGING:
GNUNET_break (CS_RESOLVING == call_state);
- LOG (_("Resolved address of `%s'. Now ringing other party."),
peer_name);
+ GCG_log (_("Resolved address of `%s'. Now ringing other party."),
peer_name);
// set_outgoing_call_state(cls, CT_ringing);
call_state = CS_RINGING;
break;
case GNUNET_CONVERSATION_EC_CALL_PICKED_UP:
GNUNET_break (CS_RINGING == call_state);
- LOG (_("Connection established to `%s'"), peer_name);
+ GCG_log (_("Connection established to `%s'"), peer_name);
call_state = CS_CONNECTED;
break;
case GNUNET_CONVERSATION_EC_CALL_GNS_FAIL:
GNUNET_break (CS_RESOLVING == call_state);
- LOG (_("Failed to resolve %s in ego `%s'"), peer_name, ego_name);
+ GCG_log (_("Failed to resolve %s in ego `%s'"), peer_name, ego_name);
call = NULL;
break;
case GNUNET_CONVERSATION_EC_CALL_HUNG_UP:
- LOG ("%s", _("Call terminated"));
+ GCG_log ("%s", _("Call terminated"));
call = NULL;
break;
case GNUNET_CONVERSATION_EC_CALL_SUSPENDED:
GNUNET_break (CS_CONNECTED == call_state);
- LOG (_("Connection to `%s' suspended (by other user)\n"), peer_name);
+ GCG_log (_("Connection to `%s' suspended (by other user)\n"),
peer_name);
break;
case GNUNET_CONVERSATION_EC_CALL_RESUMED:
GNUNET_break (CS_CONNECTED == call_state);
- LOG (_("Connection to `%s' resumed (by other user)\n"), peer_name);
+ GCG_log (_("Connection to `%s' resumed (by other user)\n"), peer_name);
break;
case GNUNET_CONVERSATION_EC_CALL_ERROR:
- LOG ("GNUNET_CONVERSATION_EC_CALL_ERROR %s", peer_name);
+ GCG_log ("GNUNET_CONVERSATION_EC_CALL_ERROR %s", peer_name);
}
//}
}
@@ -1164,24 +1085,24 @@
{
if (NULL == caller_id)
{
- LOG (_("Ego `%s' not available\n"), ego_name);
+ GCG_log (_("Ego `%s' not available\n"), ego_name);
return;
}
if (NULL != call)
{
- LOG (_("You are calling someone else already, hang up first!\n"));
+ GCG_log (_("You are calling someone else already, hang up first!\n"));
return;
}
switch (phone_state)
{
case PS_LOOKUP_EGO:
- LOG (_("Ego `%s' not available\n"), ego_name);
+ GCG_log (_("Ego `%s' not available\n"), ego_name);
return;
case PS_LISTEN:
/* ok to call! */
break;
case PS_ACCEPTED:
- LOG (_
+ GCG_log (_
("You are answering call from `%s', hang up or suspend that call
first!\n"),
peer_name);
GNUNET_break(0);
@@ -1192,7 +1113,7 @@
}
//GNUNET_free_non_null (peer_name);
peer_name = GNUNET_strdup (arg);
- LOG (_("now calling: %s"), peer_name);
+ GCG_log (_("now calling: %s"), peer_name);
call_state = CS_RESOLVING;
GNUNET_assert (NULL == call);
@@ -1204,7 +1125,7 @@
// add call to active call list
GtkTreeIter gtkiter;
-
+
gtk_list_store_append (active_liststore, >kiter);
gtk_list_store_set (active_liststore, >kiter,
@@ -1218,10 +1139,10 @@
AL_call_state, CS_RESOLVING,
-1
);
-
- UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
- peer_name);
+
+ GCG_update_status (_("We are calling `%s', his phone should be ringing."),
+ peer_name);
GNUNET_CONVERSATION_GTK_history_add (CH_OUTGOING, peer_name);
}
@@ -1240,7 +1161,7 @@
if ((NULL != call) && (CS_SUSPENDED != call_state))
{
- LOG (_("You are calling someone else already, hang up first!\n"));
+ GCG_log (_("You are calling someone else already, hang up first!\n"));
GNUNET_break(0);
return;
}
@@ -1253,7 +1174,7 @@
/* this is the expected state */
break;
case PS_ACCEPTED:
- LOG (_
+ GCG_log (_
("You are answering call from `%s', hang up or suspend that call
first!\n"),
peer_name);
GNUNET_break(0);
@@ -1265,7 +1186,7 @@
phone_state = PS_ACCEPTED;
set_incoming_call_state(sel_caller,CT_active);
-
+
for (cl = cl_head; cl; cl = cl->next)
{
/* FIXME: this may not be unique enough to identify the right item!
@@ -1282,49 +1203,40 @@
}
-
-
-
-
-
-
/**
* Suspending a call
*
* @param args arguments given to the command
*/
-
static void
do_suspend ()
{
-
/*
switch (phone_state)
{
case PS_LOOKUP_EGO:
case PS_LISTEN:
case PS_ERROR:
- LOG ("%s", _(" There is no call that could be suspended right now.
(PS_ERROR)"));
+ GCG_log ("%s", _(" There is no call that could be suspended right now.
(PS_ERROR)"));
return;
case PS_ACCEPTED:
- // expected state, do rejection logic
+ // expected state, do rejection logic
break;
}
*/
if (call_selected != NULL && caller_selected != NULL)
{
- LOG("this shoud not be possible");
+ GCG_log("this shoud not be possible");
GNUNET_break(0);
}
- else
+ else
{
-
// outgoing
if (NULL != call_selected)
{
GNUNET_CONVERSATION_call_suspend (call_selected);
set_outgoing_call_state(call_selected,CT_suspended);
-
+
return;
}
@@ -1354,23 +1266,23 @@
{
case PS_LOOKUP_EGO:
case PS_ERROR:
- LOG ("%s", _("There is no call that could be resumed right
now.(PS_ERROR)"));
+ GCG_log ("%s", _("There is no call that could be resumed right
now.(PS_ERROR)"));
return;
case PS_LISTEN:
break;
case PS_ACCEPTED:
- LOG (_("Already talking with `%s', cannot resume a call right now."),
+ GCG_log (_("Already talking with `%s', cannot resume a call right now."),
peer_name);
return;
}
////
if (call_selected != NULL && caller_selected != NULL)
{
- LOG("this shoud not be possible");
+ GCG_log("this shoud not be possible");
GNUNET_break(0);
return;
}
- else
+ else
{
// outgoing
@@ -1378,7 +1290,7 @@
{
GNUNET_CONVERSATION_call_resume (call_selected, speaker, mic);
set_outgoing_call_state(call_selected,CT_active);
-
+
return;
}
@@ -1395,7 +1307,7 @@
}
//
-////
+////
}
@@ -1407,7 +1319,7 @@
static void
do_reject ()
{
-
+
if (call_selected == NULL && caller_selected == NULL){
GNUNET_break(0);
}else {
@@ -1416,10 +1328,10 @@
if (NULL != call_selected)
{
set_outgoing_call_state(call_selected,CT_hangup);
-
+
GNUNET_CONVERSATION_call_stop(call);
//GNUNET_CONVERSATION_call_stop (call_selected);
-
+
call = NULL;
call_selected = NULL;
return;
@@ -1441,10 +1353,6 @@
}
-
-
-
-
/**
* Function called by identity service with information about egos.
*
@@ -1454,37 +1362,31 @@
* @param name name of the ego
*/
static void
-identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
+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);
- fprintf (stderr, "main identity_cb: %s \n", name);
-
-
- gtk_list_store_insert_with_values (zone_liststore,
+ 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);
-
+ -1);
}
-
-
if (NULL == name)
return;
if (ego == caller_id)
{
if (verbose)
- LOG (_("Name of our ego changed to `%s'\n"), name);
- //GNUNET_free (ego_name);
+ GCG_log (_("Name of our ego changed to `%s'\n"),
+ name);
+ GNUNET_free_non_null (ego_name);
ego_name = GNUNET_strdup (name);
return;
}
@@ -1493,18 +1395,20 @@
if (NULL == ego)
{
if (verbose)
- LOG (_("Our ego `%s' was deleted!\n"), ego_name);
+ 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);
-
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "CONVERSATION",
+ "LINE",
+ line);
if (NULL == phone)
- start_phone();
+ start_phone();
}
/**
@@ -1513,7 +1417,7 @@
* @return configuration handle
*/
const struct GNUNET_CONFIGURATION_Handle *
-GIG_get_configuration ()
+GCG_get_configuration ()
{
/* FIXME: Configuration handle returned is const, but we DO alter the config
*/
return GNUNET_GTK_main_loop_get_configuration (ml);
@@ -1536,7 +1440,7 @@
//struct OperationContext *oc;
/*
- GIG_advertise_shutdown_ ();
+ GCG_advertise_shutdown_ ();
while (NULL != (oc = oc_head))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1559,8 +1463,6 @@
}
-
-
/**
* Callback invoked if the application is supposed to exit.
*
@@ -1568,7 +1470,8 @@
* @param user_data unused
*/
void
-GNUNET_GTK_conversation_quit_cb (GObject * object, gpointer user_data)
+GNUNET_GTK_conversation_quit_cb (GObject *object,
+ gpointer user_data)
{
if (NULL != call)
{
@@ -1591,7 +1494,7 @@
// ns = NULL;
//}
GNUNET_CONVERSATION_GTK_CONTACTS_shutdown();
-
+
GNUNET_SPEAKER_destroy (speaker);
speaker = NULL;
GNUNET_MICROPHONE_destroy (mic);
@@ -1601,10 +1504,6 @@
phone_state = PS_ERROR;
GNUNET_SCHEDULER_shutdown ();
-
-
- //return 0;
-
}
@@ -1616,35 +1515,34 @@
* @param tc schedule context
*/
static void
-run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GtkWindow *main_window;
- //line = 0;
-
ml = cls;
if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
return;
GNUNET_GTK_set_icon_search_path ();
GNUNET_GTK_setup_nls ();
/* setup main window */
- main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
+ main_window = GTK_WINDOW (GCG_get_main_window_object
("GNUNET_GTK_conversation_window"));
main_window =
GTK_WINDOW (GNUNET_GTK_plug_me
("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET (main_window)));
gtk_window_set_default_size (main_window, 700, 700);
-
+
// active calls
active_liststore =
- GTK_LIST_STORE (get_object
("gnunet_conversation_gtk_active_calls_liststore"));
+ GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_active_calls_liststore"));
active_treeview =
- GTK_TREE_VIEW (get_object
("gnunet_conversation_gtk_active_calls_treeview"));
+ GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_active_calls_treeview"));
-//gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
+ // gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
-
+
// gtk_window_maximize (GTK_WINDOW (main_window));
if (NULL == getenv ("GNUNET_CONVERSATION_GTK_PLUG"))
@@ -1664,33 +1562,30 @@
if(debug_box_enabled)
{
- gtk_widget_show(GTK_WIDGET(get_object("GNUNET_CONVERSATION_log_box")));
+
gtk_widget_show(GTK_WIDGET(GCG_get_main_window_object("GNUNET_CONVERSATION_log_box")));
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
-
- cfg = GIG_get_configuration ();
+ cfg = GNUNET_CONFIGURATION_dup (GCG_get_configuration ());
+
speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
- b_contact = GTK_WIDGET (get_object
("GNUNET_GTK_conversation_use_current_button"));
- b_accept = GTK_WIDGET (get_object
("GNUNET_GTK_conversation_accept_button"));
- b_hangup = GTK_WIDGET (get_object
("GNUNET_GTK_conversation_hangup_button"));
- b_suspend = GTK_WIDGET (get_object
("GNUNET_GTK_conversation_suspend_button"));
- b_resume = GTK_WIDGET (get_object
("GNUNET_GTK_conversation_resume_button"));
+ b_contact = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_use_current_button"));
+ b_accept = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_accept_button"));
+ b_hangup = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_hangup_button"));
+ b_suspend = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_suspend_button"));
+ b_resume = GTK_WIDGET (GCG_get_main_window_object
("GNUNET_GTK_conversation_resume_button"));
-
-
-
if (NULL == ego_name)
{
ego_name = "phone-ego";
- LOG (_("No ego given, using default: %s "), ego_name);
+ GCG_log (_("No ego given, using default: %s "), ego_name);
}
id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
-
+
GNUNET_CONVERSATION_GTK_CONTACTS_init ();
}
@@ -1731,9 +1626,15 @@
"gnunet_conversation_gtk_main_window.glade",
&run))
return 1;
+ if (NULL != cfg)
+ {
+ GNUNET_CONFIGURATION_destroy (cfg);
+ cfg = NULL;
+ }
return 0;
}
+
/**
* call clicked
*/
@@ -1742,7 +1643,7 @@
{
GtkEntry *address_entry;
- address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address"));
+ address_entry = GTK_ENTRY (GCG_get_main_window_object
("GNUNET_GTK_conversation_address"));
do_call (gtk_entry_get_text(address_entry));
//disable_button ("GNUNET_GTK_conversation_accept_button");
@@ -1775,7 +1676,7 @@
} else {
GNUNET_break(0);
}
- do_status();
+ do_status();
}
@@ -1826,7 +1727,7 @@
{
GtkTreeIter iter;
char *caller_id = "testje";
- int caller_num = 10;
+ int caller_num = 10;
enum {
AL_caller_id, // *gchar
@@ -1841,7 +1742,7 @@
&iter, -1,
0, "test",
-1);
-}
+}
/*
* @brief outgoing ego selector changed
@@ -1864,7 +1765,7 @@
0, &tempName,
1, &tempEgo,
-1);
- //LOG(stderr,"outgoing ego: %s", tempName);
+ //GCG_log(stderr,"outgoing ego: %s", tempName);
// caller_id = tempEgo;
/*
if ( NULL != phone)
@@ -1880,12 +1781,12 @@
* @brief active call list type data function
*/
void
- active_calls_type_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer user_data)
- {
+active_calls_type_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer user_data)
+ {
gint state;
gchar buf[20];
@@ -1893,8 +1794,8 @@
g_snprintf(buf, sizeof(buf), "status %u", state);
g_object_set(renderer, "text", buf, NULL);
/* set 'cell-background' property of the cell renderer */
-
- switch (state)
+
+ switch (state)
{
case CT_active:
g_object_set(renderer,
@@ -1926,12 +1827,12 @@
default:
GNUNET_break(0);
break;
- }
+ }
//gtk_tree_model_get(model, iter, AL_caller_state, &state, -1);
-
+
//g_snprintf(buf, sizeof(buf), "state: %u", state);
-
+
//g_object_set(renderer, "text", buf, NULL);
//
// if (foo->is_important)
@@ -1942,7 +1843,7 @@
}
-/*
+/**
* @brief second test button
*/
void
@@ -1951,15 +1852,15 @@
GtkTreeViewColumn *column;
// GtkCellRenderer *cell;
GtkCellRenderer *renderer;
- //LOG("test");
-// treeview = get_object(ml,"gnunet_conversation_gtk_active_calls_treeview");
+ //GCG_log("test");
+// treeview =
GCG_get_main_window_object(ml,"gnunet_conversation_gtk_active_calls_treeview");
-// column = get_object(ml,"GNUNET_CONVERSATION_GTK_caller_typeColumn");
+// column =
GCG_get_main_window_object(ml,"GNUNET_CONVERSATION_GTK_caller_typeColumn");
//cell = gtk_cell_renderer_text_new();
-// cell = get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_type");
+// cell =
GCG_get_main_window_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_type");
// gtk_tree_view_column_set_cell_data_func(column, cell,
active_calls_type_data_function, NULL, NULL );
- column = GTK_TREE_VIEW_COLUMN(get_object("caller_testcolumn"));
+ column =
GTK_TREE_VIEW_COLUMN(GCG_get_main_window_object("caller_testcolumn"));
gtk_tree_view_column_set_title(column, "test stateC");
renderer = gtk_cell_renderer_text_new();
@@ -1974,8 +1875,7 @@
"cell-background-set", TRUE,
NULL);
gtk_tree_view_column_add_attribute(column, renderer, "text",
AL_caller_state);
- gtk_tree_view_column_set_cell_data_func(column, renderer,
active_calls_type_data_function, NULL, NULL );
-
+ gtk_tree_view_column_set_cell_data_func(column, renderer,
active_calls_type_data_function, NULL, NULL );
}
-
+/* end of gnunet-conversation-gtk.c */
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.h 2014-05-26
08:43:57 UTC (rev 33385)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.h 2014-05-26
08:47:02 UTC (rev 33386)
@@ -25,28 +25,171 @@
#ifndef GNUNET_CONVERSATION_GTK_H
#define GNUNET_CONVERSATION_GTK_H
- /** Get our configuration.
+#include <stdbool.h>
+#include <stdint.h>
+#include "gnunet_gtk.h"
+#include <gnunet/gnunet_identity_service.h>
+#include <gnunet/gnunet_namestore_service.h>
+#include <gnunet/gnunet_conversation_service.h>
+#include <gnunet/gnunet_speaker_lib.h>
+#include <gnunet/gnunet_microphone_lib.h>
+#include <gnunet/gnunet_identity_service.h>
+#include <gnunet/gnunet_namestore_service.h>
+#include <gnunet/gnunet_gnsrecord_lib.h>
+
+
+/**
+ * active calls treeview columns
+ */
+enum ActiveCallsTreeViewColumns
+{
+ AL_caller_id, //*gchar
+ AL_caller, //*
+ AL_caller_num, //gint
+ AL_type, //gint
+ AL_caller_state, //gint
+ AL_call, //*
+ AL_call_state, //gint
+ AL_call_num //gint
+};
+
+
+/**
+ * callerstate (state of incoming call)
+ */
+enum CallerState
+{
+ CT_active,
+ CT_suspended,
+ CT_ringing,
+ CT_dead,
+ CT_hangup,
+ CT_rejected,
+ CT_other
+};
+
+
+/**
+ * type of call
+ */
+enum TypeOfCall
+{
+ CALL_IN,
+ CALL_OUT
+};
+
+
+/**
+ * Possible states of the phone.
+ */
+enum PhoneState
+{
+ /**
+ * We're waiting for our own idenitty.
+ */
+ PS_LOOKUP_EGO,
+
+ /**
+ * We're listening for calls
+ */
+ PS_LISTEN,
+
+ /**
+ * We accepted an incoming phone call.
+ */
+ PS_ACCEPTED,
+
+ /**
+ * Internal error
+ */
+ PS_ERROR
+};
+
+
+/**
+ * States for current outgoing call.
+ */
+enum CallState
+{
+ /**
+ * We are looking up some other participant.
+ */
+ CS_RESOLVING,
+
+ /**
+ * We are now ringing the other participant.
+ */
+ CS_RINGING,
+
+ /**
+ * The other party accepted our call and we are now connected.
+ */
+ CS_CONNECTED,
+
+ /**
+ * The call is currently suspended (by us).
+ */
+ CS_SUSPENDED
+};
+
+
+enum CallHistoryType
+{
+ CH_ACCEPTED,
+ CH_REJECTED,
+ CH_OUTGOING,
+ CH_HANGUP,
+ CH_MISSED
+};
+
+
+/**
+ * Get our configuration.
*
* @return configuration handle
- **/
+ */
+extern const struct GNUNET_CONFIGURATION_Handle *
+GCG_get_configuration (void);
-extern struct GNUNET_CONFIGURATION_Handle *
-GIG_get_configuration ();
-
+/**
+ * Get an object from the main window.
+ *
+ * @param name name of the object
+ * @return NULL on error
+ */
extern GObject *
-GNUNET_CONVERSATION_GTK_get_main_window_object (const char *);
+GCG_get_main_window_object (const char *);
/**
+ * update status bar
+ *
+ * @param message format string for message to put in statusbar
+ * @param ... arguments for the format string
+ */
+void
+GCG_update_status (const gchar *message,
+ ...);
+
+
+#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format,
## __VA_ARGS__))
+
+
+/**
* log a message to gtk log textbuffer
- * @param Message to be logged
+ *
+ * @param message format string for message to be logged
+ * @param ... arguments for the format string
*/
-
extern void
-GNUNET_CONVERSATION_GTK_log_message (const char *);
+GCG_log (const char *message,
+ ...);
+
extern void
do_call(const char*);
+
+
#endif
Deleted: gnunet-gtk/src/conversation/gnunet-conversation-gtk_common.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_common.h
2014-05-26 08:43:57 UTC (rev 33385)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_common.h
2014-05-26 08:47:02 UTC (rev 33386)
@@ -1,136 +0,0 @@
-/*
- * temporary header file
- */
-
-#include <stdbool.h>
-#include <stdint.h>
-//#include <gnunet/gnunet_util_lib.h>
-
-#include "gtk/gtk.h"
-#include "gnunet_gtk.h"
-#include <time.h>
-
-#include "gnunet_gtk.h"
-#include "gnunet/gnunet_identity_service.h"
-#include "gnunet/gnunet_namestore_service.h"
-#include "gnunet/gnunet_conversation_service.h"
-#include "gnunet/gnunet_speaker_lib.h"
-#include "gnunet/gnunet_microphone_lib.h"
-
-#include "gnunet/gnunet_identity_service.h"
-#include "gnunet/gnunet_namestore_service.h"
-#include "gnunet/gnunet_gnsrecord_lib.h"
-/*
- * macro's
- */
-#define UPDATE_STATUS(format, ...) update_status(g_strdup_printf (format, ##
__VA_ARGS__))
-
-#define UPDATE_INFOBAR(format, ...) set_infobar_text(g_strdup_printf (format,
## __VA_ARGS__))
-
-#define LOG(format, ...) GNUNET_CONVERSATION_GTK_log_message(g_strdup_printf
(format, ## __VA_ARGS__))
-
-#define get_object(name) GNUNET_CONVERSATION_GTK_get_main_window_object(name)
-
-
-
-/*
- * active calls treevieuw columns
- */
-
-enum {
- AL_caller_id, //*gchar
- AL_caller, //*
- AL_caller_num, //gint
- AL_type, //gint
- AL_caller_state, //gint
- AL_call, //*
- AL_call_state, //gint
- AL_call_num //gint
-};
-/**
- * callerstate (state of incoming call)
- */
-
-enum {
- CT_active,
- CT_suspended,
- CT_ringing,
- CT_dead,
- CT_hangup,
- CT_rejected,
- CT_other
-};
-
-/**
- * type of call
- */
-enum {
- CALL_IN,
- CALL_OUT
-};
-
-/**
- * Possible states of the phone.
- */
-enum PhoneState
-{
- /**
- * We're waiting for our own idenitty.
- */
- PS_LOOKUP_EGO,
-
- /**
- * We're listening for calls
- */
- PS_LISTEN,
-
- /**
- * We accepted an incoming phone call.
- */
- PS_ACCEPTED,
-
- /**
- * Internal error
- */
- PS_ERROR
-};
-
-/**
- * States for current outgoing call.
- */
-enum CallState
-{
- /**
- * We are looking up some other participant.
- */
- CS_RESOLVING,
-
- /**
- * We are now ringing the other participant.
- */
- CS_RINGING,
-
- /**
- * The other party accepted our call and we are now connected.
- */
- CS_CONNECTED,
-
- /**
- * The call is currently suspended (by us).
- */
- CS_SUSPENDED
-};
-
-
-
-
-enum CallHistoryType
-{
- CH_ACCEPTED,
- CH_REJECTED,
- CH_OUTGOING,
- CH_HANGUP,
- CH_MISSED
-};
-
-
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
2014-05-26 08:43:57 UTC (rev 33385)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
2014-05-26 08:47:02 UTC (rev 33386)
@@ -20,11 +20,10 @@
/**
* @file src/conversation/gnunet-conversation-gtk_contacts.c
- * @brief
+ * @brief
* @author yids
* @author hark
*/
-#include "gnunet-conversation-gtk_common.h"
#include "gnunet-conversation-gtk.h"
@@ -43,10 +42,6 @@
/*************
* contacts *
*************/
-/**
- * Our configurations.
- */
-static struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our ego.
@@ -165,8 +160,10 @@
////////////////////////////
static void
-display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey
*zone_key,
- const char *rname, unsigned int rd_len,
+display_record (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+ const char *rname,
+ unsigned int rd_len,
const struct GNUNET_GNSRECORD_Data *rd)
{
/* const char *typestring;*/
@@ -180,7 +177,7 @@
if (NULL == rname)
{
-
+
list_it = NULL;
//test_finished ();
return;
@@ -239,7 +236,7 @@
GNUNET_free (s);
}
// FPRINTF (stdout, "%s", "\n");
-
+
GNUNET_NAMESTORE_zone_iterator_next (list_it);
// GNUNET_NAMESTORE_zone_iteration_stop(list_it);
@@ -256,7 +253,9 @@
* @param name name of the ego
*/
static void
-identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
+identity_cb (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
const char *name)
{
/*
@@ -264,9 +263,9 @@
char *s;
*/
GtkTreeIter iter;
-
- if (NULL != ego)
- {
+
+ if (NULL != ego)
+ {
/*
GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
@@ -279,17 +278,18 @@
&iter, -1,
0, name,
1, ego,
- -1);
+ -1);
}
contacts_ego = ego;
-
+
// zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
- ns = GNUNET_NAMESTORE_connect (cfg);
-
+ ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ());
}
+
+
/**
* Continuation called to notify client about result of the
* operation.
@@ -312,10 +312,10 @@
fprintf (stderr, _("Adding record failed: %s\n"),
(GNUNET_NO == success) ? "record exists" : emsg);
if (GNUNET_NO != success)
- LOG("GNUNET_NO != success");
+ GCG_log("GNUNET_NO != success");
//ret = 1;
}
- LOG("blaat");
+ GCG_log("blaat");
//ret = 0;
//test_finished ();
}
@@ -362,19 +362,19 @@
static void *data;
static size_t data_size;
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
-
+
struct GNUNET_IDENTITY_Ego *tempEgo;
char *tempName;
GtkTreeIter testIter;
- gtk_combo_box_get_active_iter(GTK_COMBO_BOX
(GNUNET_CONVERSATION_GTK_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_combobox")), &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);
rde = &rd;
zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo);
@@ -401,24 +401,22 @@
gtk_list_store_set (contacts_liststore, &iter, 1, "PKEY", 0, name, -1);
}
}
-/*
+
+
+/**
* executed when clicked on add contact
* @param button
* @param user_data
*/
-
void
GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
gpointer * user_data)
{
+ GtkEntry *nameEntry;
+ GtkEntry *addressEntry;
- GtkEntry *nameEntry, *addressEntry;
-
- nameEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object
("GNUNET_GTK_conversation_nameAdd"));
- addressEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object
("GNUNET_GTK_conversation_addressAdd"));
- FPRINTF(stderr,"name %s \n", gtk_entry_get_text (nameEntry));
- FPRINTF(stderr,"addr %s \n", gtk_entry_get_text (addressEntry));
-
+ nameEntry = GTK_ENTRY (GCG_get_main_window_object
("GNUNET_GTK_conversation_nameAdd"));
+ addressEntry = GTK_ENTRY (GCG_get_main_window_object
("GNUNET_GTK_conversation_addressAdd"));
add_contact (gtk_entry_get_text
(nameEntry),gtk_entry_get_text(addressEntry));
}
@@ -439,7 +437,7 @@
{
gtk_tree_model_get (model, &iter, 0, &name, -1);
//FPRINTF (stderr, "selected %s \n", name);
- main_window = GTK_WINDOW (GNUNET_CONVERSATION_GTK_get_main_window_object
("GNUNET_GTK_conversation_window"));
+ main_window = GTK_WINDOW (GCG_get_main_window_object
("GNUNET_GTK_conversation_window"));
confirm =
GTK_DIALOG (gtk_dialog_new_with_buttons
("Removing contact", main_window,
@@ -477,11 +475,11 @@
{
GtkEntry *addressEntry;
// FPRINTF(stderr,"on current clicked %s\n",callerName);
- //char *strippedAddress;
- addressEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object
("GNUNET_GTK_conversation_addressAdd"));
+ //char *strippedAddress;
+ addressEntry = GTK_ENTRY (GCG_get_main_window_object
("GNUNET_GTK_conversation_addressAdd"));
currentlySelectedCallAddress[52] = '\0';
gtk_entry_set_text(addressEntry, currentlySelectedCallAddress);
-
+
}
@@ -526,7 +524,7 @@
g_print ("ego name %s\n", callAddress);
GtkEntry *address_entry;
- address_entry = GTK_ENTRY ( GNUNET_CONVERSATION_GTK_get_main_window_object
("GNUNET_GTK_conversation_address"));
+ address_entry = GTK_ENTRY ( GCG_get_main_window_object
("GNUNET_GTK_conversation_address"));
gtk_entry_set_text (address_entry, callAddress);
do_call (callAddress);
}
@@ -547,7 +545,7 @@
}
*/
/*
-static void
+static void
setCurrentAddressbookEgo(void *cls, struct GNUNET_IDENTITY_Ego *ego)
{
currentAddressBookEgo = ego;
@@ -571,10 +569,10 @@
struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey;
//GtkTreeSelection *selection;
//GtkTreeIter iterA;
-
- gtk_combo_box_get_active_iter(widget, &contacts_zone_iter);
+ gtk_combo_box_get_active_iter(widget, &contacts_zone_iter);
+
gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
&contacts_zone_iter,
0, &tempName,
@@ -587,62 +585,64 @@
GNUNET_IDENTITY_ego_lookup (cfg,
tempName,
setCurrentAddressbookEgo,
- NULL);
-*/
+ 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);
}
-
-//////
+
+//////
extern void
GNUNET_CONVERSATION_GTK_CONTACTS_init ()
{
GtkTreeIter iterContactsInit;
- cfg = GIG_get_configuration ();
+
// contacts
contacts_liststore =
- GTK_LIST_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object
+ GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_liststore"));
contacts_treeview =
- GTK_TREE_VIEW (GNUNET_CONVERSATION_GTK_get_main_window_object
("gnunet_conversation_gtk_treeview"));
+ GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_treeview"));
contacts_treemodel = GTK_TREE_MODEL (contacts_liststore);
// zone list
zone_liststore =
- GTK_LIST_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_liststore"));
+ GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_liststore"));
// zone_treestore =
-// GTK_TREE_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object
("gnunet_conversation_gtk_contacts_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 (get_object ("gnunet_conversation_gtk_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
(GNUNET_CONVERSATION_GTK_get_main_window_object
("gnunet_conversation_gtk_contacts_zone_combobox")), &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 (cfg, &identity_cb, NULL);
+ 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 (get_object
("gnunet_conversation_gtk_contacts_zone_combobox")), 1);
-// gtk_combo_box_set_active(GTK_WIDGET (get_object
(ml,"gnunet_conversation_gtk_outgoing_zone_combobox")), 1);
+// 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);
}
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
2014-05-26 08:43:57 UTC (rev 33385)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_history.c
2014-05-26 08:47:02 UTC (rev 33386)
@@ -17,17 +17,12 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
-
-
/**
* @file src/conversation/gnunet-conversation-gtk_history.c
- * @brief
+ * @brief
* @author yids
* @author hark
*/
-
-#include "gnunet-conversation-gtk_common.h"
#include "gnunet-conversation-gtk.h"
@@ -101,11 +96,11 @@
GNUNET_CONVERSATION_GTK_history_init(){
// call history
history_liststore =
- GTK_LIST_STORE (get_object
("gnunet_conversation_gtk_history_liststore"));
+ GTK_LIST_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_history_liststore"));
history_treeview =
- GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_history_treeview"));
+ GTK_TREE_VIEW (GCG_get_main_window_object
("gnunet_conversation_gtk_history_treeview"));
history_treestore =
- GTK_TREE_STORE (get_object
("gnunet_conversation_gtk_history_treestore"));
+ GTK_TREE_STORE (GCG_get_main_window_object
("gnunet_conversation_gtk_history_treestore"));
history_treemodel = GTK_TREE_MODEL (history_treestore);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33386 - gnunet-gtk/src/conversation,
gnunet <=