From 87436dc094f656a0f96752063b30b46bb123328e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Jun 2014 13:30:32 +0000 Subject: -fix crashes, simplify code --- contrib/gnunet_conversation_gtk_main_window.glade | 25 +++++--- .../gnunet-conversation-gtk_contacts.c | 7 ++ src/conversation/gnunet-conversation-gtk_egos.c | 5 ++ src/conversation/gnunet-conversation-gtk_phone.c | 75 ++-------------------- 4 files changed, 33 insertions(+), 79 deletions(-) diff --git a/contrib/gnunet_conversation_gtk_main_window.glade b/contrib/gnunet_conversation_gtk_main_window.glade index 31028399..3fa116ef 100644 --- a/contrib/gnunet_conversation_gtk_main_window.glade +++ b/contrib/gnunet_conversation_gtk_main_window.glade @@ -1,7 +1,6 @@ - - + @@ -22,12 +21,12 @@ - + - + + + - - @@ -99,6 +98,7 @@ + False True False _View @@ -109,6 +109,7 @@ False + False True False _History @@ -118,6 +119,7 @@ + False True False _Logs @@ -281,6 +283,7 @@ True True True + False True True @@ -299,6 +302,7 @@ False True True + False True @@ -316,6 +320,7 @@ False True True + False True @@ -422,6 +427,7 @@ False True True + False 0.4699999988079071 @@ -440,6 +446,7 @@ False True True + False @@ -457,6 +464,7 @@ False True True + False @@ -474,6 +482,7 @@ False True True + False False @@ -492,7 +501,7 @@ - False + True True 2 @@ -579,7 +588,7 @@ True True - + gnunet_conversation_gtk_contacts_liststore False 0 diff --git a/src/conversation/gnunet-conversation-gtk_contacts.c b/src/conversation/gnunet-conversation-gtk_contacts.c index e8bb80d6..01c674df 100644 --- a/src/conversation/gnunet-conversation-gtk_contacts.c +++ b/src/conversation/gnunet-conversation-gtk_contacts.c @@ -116,6 +116,13 @@ gnunet_conversation_gtk_contact_list_treeview_row_activated_cb (GtkTreeView *tr } +void +gnunet_conversation_gtk_contact_list_value_renderer_edited_cb () +{ + GNUNET_break (0); // not implemented +} + + /** * Process a record that was stored or modified the namestore by * adding/modifying/removing it in the liststore. diff --git a/src/conversation/gnunet-conversation-gtk_egos.c b/src/conversation/gnunet-conversation-gtk_egos.c index 5136a938..9c6cc432 100644 --- a/src/conversation/gnunet-conversation-gtk_egos.c +++ b/src/conversation/gnunet-conversation-gtk_egos.c @@ -104,6 +104,11 @@ identity_cb (void *cls, GtkTreePath *path; GtkComboBox *cb; + if (NULL == ctx) + { + /* end of initial iteration, ignore */ + return; + } rr = *ctx; if (NULL == rr) { diff --git a/src/conversation/gnunet-conversation-gtk_phone.c b/src/conversation/gnunet-conversation-gtk_phone.c index 210c8c56..95275615 100644 --- a/src/conversation/gnunet-conversation-gtk_phone.c +++ b/src/conversation/gnunet-conversation-gtk_phone.c @@ -98,33 +98,6 @@ enum TypeOfConversation }; -/** - * Possible states of the phone. - */ -enum PhoneState -{ - /** - * We're waiting for the user to select a caller ID. - */ - 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 incoming call. */ @@ -298,11 +271,6 @@ static struct GNUNET_SPEAKER_Handle *speaker; */ static struct GNUNET_MICROPHONE_Handle *mic; -/** - * Our phone's current state. - */ -static enum PhoneState phone_state; - /** * Counts the number of incoming calls we have had so far. @@ -427,8 +395,7 @@ do_status () return; } if ( (NULL == active_in) && - (NULL == active_out) && - (PS_LISTEN == phone_state) ) + (NULL == active_out) ) { GCG_update_status_bar ("%s", _("We are listening for incoming calls")); @@ -448,7 +415,7 @@ check_call_sensitivity () { gboolean sens; - sens = (PS_LISTEN == phone_state); + sens = (NULL == active_in) && (NULL == active_out); if (0 == strlen (gtk_entry_get_text (address_entry))) sens = FALSE; gtk_widget_set_sensitive (b_call, sens); @@ -750,7 +717,6 @@ phone_event_handler (void *cls, &iter); } GNUNET_break (valid); - phone_state = PS_LISTEN; break; } do_status(); @@ -860,14 +826,12 @@ GNUNET_CONVERSATION_GTK_on_accept_clicked (GtkButton *button, GtkTreeModel *model; if ( (NULL != active_in) || - (NULL != active_out) || - (PS_LISTEN != phone_state) ) + (NULL != active_out) ) { /* accept button should not have been sensitive! */ GNUNET_break (0); return; } - phone_state = PS_ACCEPTED; sel = gtk_tree_view_get_selection (active_treeview); if (! gtk_tree_selection_get_selected (sel, &model, @@ -887,7 +851,6 @@ GNUNET_CONVERSATION_GTK_on_accept_clicked (GtkButton *button, GNUNET_break (0); return; } - phone_state = PS_ACCEPTED; active_in = ic; set_incoming_call_state (ic, IN_STATE_CONNECTED); @@ -950,7 +913,6 @@ GNUNET_CONVERSATION_GTK_on_reject_clicked (GtkButton *button, set_incoming_call_state (ic, IN_STATE_NONE); destroy_in (ic); - phone_state = PS_LISTEN; /* FIXME: or error... */ do_status (); return; } @@ -970,7 +932,6 @@ GNUNET_CONVERSATION_GTK_on_reject_clicked (GtkButton *button, set_outgoing_call_state (oc, OUT_STATE_NONE); destroy_out (oc); - phone_state = PS_LISTEN; /* FIXME: or error... */ do_status (); return; } @@ -1018,9 +979,7 @@ GNUNET_CONVERSATION_GTK_on_resume_clicked (GtkButton *button, GtkTreeModel *model; if ( (NULL != active_in) || - (NULL != active_out) || - (! (PS_LISTEN == phone_state) || - (PS_ERROR == phone_state) ) ) + (NULL != active_out) ) { /* resume button should have been inactive */ GNUNET_break(0); @@ -1043,7 +1002,6 @@ GNUNET_CONVERSATION_GTK_on_resume_clicked (GtkButton *button, -1); if (NULL != ic) { - phone_state = PS_ACCEPTED; active_in = ic; set_incoming_call_state (ic, IN_STATE_CONNECTED); @@ -1058,7 +1016,6 @@ GNUNET_CONVERSATION_GTK_on_resume_clicked (GtkButton *button, } if (NULL != oc) { - phone_state = PS_ACCEPTED; active_out = oc; GNUNET_CONVERSATION_call_resume (oc->call, speaker, mic); @@ -1127,7 +1084,6 @@ GNUNET_CONVERSATION_GTK_on_pause_clicked (GtkButton *button, set_outgoing_call_state (active_out, os); active_out = NULL; - phone_state = PS_LISTEN; gtk_widget_hide (b_suspend); gtk_widget_hide (b_hangup); gtk_widget_show (b_call); @@ -1143,7 +1099,6 @@ GNUNET_CONVERSATION_GTK_on_pause_clicked (GtkButton *button, { /* incoming */ GNUNET_CONVERSATION_caller_suspend (active_in->caller); - phone_state = PS_LISTEN; is = active_in->state; switch (active_in->state) { @@ -1228,7 +1183,6 @@ GNUNET_CONVERSATION_GTK_on_hangup_clicked (GtkButton *button, IN_STATE_NONE); destroy_in (active_in); active_in = NULL; - phone_state = PS_LISTEN; gtk_widget_hide (b_suspend); gtk_widget_hide (b_hangup); gtk_widget_show (b_call); @@ -1460,23 +1414,6 @@ GSC_PHONE_make_call (const char *arg) arg); return; } - switch (phone_state) - { - case PS_LOOKUP_EGO: - GCG_log ("%s\n", - _("Caller ID unavailable, cannot initiate call.")); - return; - case PS_LISTEN: - /* ok to call! */ - break; - case PS_ACCEPTED: - /* `call` should be non-NULL */ - GNUNET_break (0); - return; - case PS_ERROR: - /* ok to call, we got an ego just could not init the phone */ - break; - } call_counter++; oc = GNUNET_new (struct OutgoingCall); oc->peer_name = GNUNET_strdup (arg); @@ -1578,7 +1515,6 @@ gnunet_conversation_gtk_ego_combobox_changed_cb (GtkComboBox *widget, GCG_log ("%s\n", _("No ego selected, phone is now down.")); GCG_set_status_icon ("gnunet-conversation-gtk-tray-pending"); - phone_state = PS_LOOKUP_EGO; check_call_sensitivity (); return; } @@ -1594,7 +1530,6 @@ gnunet_conversation_gtk_ego_combobox_changed_cb (GtkComboBox *widget, GCG_log ("%s", _("Failed to setup phone (internal error)\n")); GCG_set_status_icon ("gnunet-conversation-offline"); - phone_state = PS_ERROR; check_call_sensitivity (); return; } @@ -1603,7 +1538,6 @@ gnunet_conversation_gtk_ego_combobox_changed_cb (GtkComboBox *widget, /* FIXME: publish record to GNS! */ GCG_log ("%s\n", _("Phone active")); - phone_state = PS_LISTEN; check_call_sensitivity (); do_status(); } @@ -1672,7 +1606,6 @@ GCG_PHONE_shutdown () speaker = NULL; GNUNET_MICROPHONE_destroy (mic); mic = NULL; - phone_state = PS_ERROR; } /* end of gnunet-conversation-gtk_phone.c */ -- cgit v1.2.3