gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33403 - gnunet-gtk/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r33403 - gnunet-gtk/src/conversation
Date: Mon, 26 May 2014 21:28:04 +0200

Author: grothoff
Date: 2014-05-26 21:28:04 +0200 (Mon, 26 May 2014)
New Revision: 33403

Added:
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_visibility.c
Modified:
   gnunet-gtk/src/conversation/Makefile.am
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
   gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.h
Log:
add view toggle logic, more work on phone logic

Modified: gnunet-gtk/src/conversation/Makefile.am
===================================================================
--- gnunet-gtk/src/conversation/Makefile.am     2014-05-26 19:14:02 UTC (rev 
33402)
+++ gnunet-gtk/src/conversation/Makefile.am     2014-05-26 19:28:04 UTC (rev 
33403)
@@ -26,6 +26,7 @@
   gnunet-conversation-gtk_log.h \
   gnunet-conversation-gtk_phone.c \
   gnunet-conversation-gtk_phone.h \
+  gnunet-conversation-gtk_visibility.c \
   gnunet-conversation-gtk_zones.c \
   gnunet-conversation-gtk_zones.h \
   gnunet-conversation-gtk_about.c

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-05-26 19:14:02 UTC (rev 33402)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_contacts.c      
2014-05-26 19:28:04 UTC (rev 33403)
@@ -105,7 +105,7 @@
   }
   g_free (name);
   g_free (type);
-  GSC_do_call (address);
+  GSC_PHONE_make_call (address);
   GNUNET_free (address);
 }
 

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-05-26 
19:14:02 UTC (rev 33402)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.c 2014-05-26 
19:28:04 UTC (rev 33403)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2010-2013 Christian Grothoff (and other contributing authors)
+     (C) 2010-2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -20,7 +20,7 @@
 
 /**
  * @file src/conversation/gnunet-conversation-gtk_phone.c
- * @brief
+ * @brief main logic to manage phone calls
  * @author yids
  * @author hark
  * @author Christian Grothoff
@@ -253,18 +253,22 @@
  */
 static char *address;
 
-static GtkWidget *b_contact;
+static GtkWidget *b_add_contact;
 
 static GtkWidget *b_accept;
 
-static GtkWidget *b_hangup;
+static GtkWidget *b_refuse;
 
-static GtkWidget *b_suspend;
+static GtkWidget *b_suspend; // pause
 
 static GtkWidget *b_resume;
 
+static GtkWidget *b_call; // connect
 
+static GtkWidget *b_hangup; // disconnect up
 
+
+
 /**
  * Update status based on current phone state.
  *
@@ -446,7 +450,7 @@
     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_add_contact, TRUE);
       gtk_widget_set_sensitive (b_accept, FALSE);
       gtk_widget_set_sensitive (b_hangup, TRUE);
       gtk_widget_set_sensitive (b_suspend, TRUE);
@@ -455,7 +459,7 @@
     case CT_ringing:
       // pickup, phonebook
       //GCG_log("CT_ring show button");
-      gtk_widget_set_sensitive (b_contact, TRUE);
+      gtk_widget_set_sensitive (b_add_contact, TRUE);
       if (phone_state == PS_LISTEN)
       {
         gtk_widget_set_sensitive (b_accept, TRUE);
@@ -471,7 +475,7 @@
     case CT_rejected:
       //add to phonebook
       //GCG_log("CT_rejected ");
-      gtk_widget_set_sensitive (b_contact, TRUE);
+      gtk_widget_set_sensitive (b_add_contact, TRUE);
       gtk_widget_set_sensitive (b_accept, FALSE);
       gtk_widget_set_sensitive (b_hangup, FALSE);
       gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -480,7 +484,7 @@
     case CT_suspended:
       // resume, hangup
       //GCG_log("CT_suspended ");
-      gtk_widget_set_sensitive (b_contact, TRUE);
+      gtk_widget_set_sensitive (b_add_contact, TRUE);
       gtk_widget_set_sensitive (b_accept, FALSE);
       gtk_widget_set_sensitive (b_hangup, TRUE);
       gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -498,7 +502,7 @@
     case CT_other:
       //add to phonebook
       //GCG_log("CT_rejected ");
-      gtk_widget_set_sensitive (b_contact, TRUE);
+      gtk_widget_set_sensitive (b_add_contact, TRUE);
       gtk_widget_set_sensitive (b_accept, TRUE);
       gtk_widget_set_sensitive (b_hangup, TRUE);
       gtk_widget_set_sensitive (b_suspend, TRUE);
@@ -532,7 +536,7 @@
 static void
 disable_list_buttons()
 {
-  gtk_widget_set_sensitive (b_contact, FALSE);
+  gtk_widget_set_sensitive (b_add_contact, FALSE);
   gtk_widget_set_sensitive (b_accept, FALSE);
   gtk_widget_set_sensitive (b_hangup, FALSE);
   gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -977,7 +981,7 @@
  * @param arg arguments given to the command
  */
 void
-GSC_do_call (const char *arg)
+GSC_PHONE_make_call (const char *arg)
 {
   GtkEntry *address_entry;
   struct GNUNET_IDENTITY_Ego *caller_id;
@@ -1366,12 +1370,11 @@
 {
   GtkEntry *address_entry;
 
-  address_entry = GTK_ENTRY (GCG_get_main_window_object 
("GNUNET_GTK_conversation_address"));
+  address_entry = GTK_ENTRY (GCG_get_main_window_object
+                             ("GNUNET_GTK_conversation_address"));
 
-  GSC_do_call (gtk_entry_get_text(address_entry));
-  //disable_button ("GNUNET_GTK_conversation_accept_button");
+  GSC_PHONE_make_call (gtk_entry_get_text (address_entry));
   do_status ();
-//  free(to_addr);
 }
 
 
@@ -1394,6 +1397,9 @@
 }
 
 
+/**
+ * Initialize phone subsystem.
+ */
 void
 GCG_PHONE_init ()
 {
@@ -1403,16 +1409,20 @@
   speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
   mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
   /* get gui objects */
-  b_contact = GTK_WIDGET (GCG_get_main_window_object
-                          ("GNUNET_GTK_conversation_use_current_button"));
+  b_add_contact = GTK_WIDGET (GCG_get_main_window_object
+                              ("gnunet_conversation_gtk_add_contact_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"));
+                          ("gnunet_conversation_gtk_accept_button"));
+  b_refuse  = GTK_WIDGET (GCG_get_main_window_object
+                          ("gnunet_conversation_gtk_hangup_button"));
   b_suspend = GTK_WIDGET (GCG_get_main_window_object
-                          ("GNUNET_GTK_conversation_suspend_button"));
+                          ("gnunet_conversation_gtk_suspend_button"));
   b_resume  = GTK_WIDGET (GCG_get_main_window_object
-                          ("GNUNET_GTK_conversation_resume_button"));
+                          ("gnunet_conversation_gtk_resume_button"));
+  b_call = GTK_WIDGET (GCG_get_main_window_object
+                          ("gnunet_conversation_gtk_call_button"));
+  b_hangup = GTK_WIDGET (GCG_get_main_window_object
+                         ("gnunet_conversation_gtk_hangup_button"));
 
   active_liststore =
      GTK_LIST_STORE (GCG_get_main_window_object
@@ -1423,25 +1433,23 @@
 }
 
 
+/**
+ * Shutdown phone subsystem.
+ */
 void
 GCG_PHONE_shutdown ()
 {
-//TODO: make this work
-  //struct OperationContext *oc;
+  struct CallList *cl;
 
-/*
-  GCG_advertise_shutdown_ ();
-  while (NULL != (oc = oc_head))
+  while (NULL != (cl = cl_head))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-               _("Operation not completed due to shutdown\n"));
-    GNUNET_IDENTITY_cancel (oc->op);
-    GNUNET_CONTAINER_DLL_remove (oc_head,
-                                oc_tail,
-                                oc);
-    GNUNET_free (oc);
+    GNUNET_CONVERSATION_caller_hang_up (cl->caller);
+    GNUNET_CONTAINER_DLL_remove (cl_head,
+                                 cl_tail,
+                                 cl);
+    // FIXME: release other memory?
+    GNUNET_free (cl);
   }
-  */
   if (NULL != call)
   {
     GNUNET_CONVERSATION_call_stop (call);
@@ -1460,3 +1468,5 @@
   peer_name = NULL;
   phone_state = PS_ERROR;
 }
+
+/* end of gnunet-conversation-gtk_phone.c */

Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.h 2014-05-26 
19:14:02 UTC (rev 33402)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_phone.h 2014-05-26 
19:28:04 UTC (rev 33403)
@@ -23,25 +23,31 @@
  * @brief main logic to manage phone calls
  * @author yids
  * @author hark
+ * @author Christian Grothoff
  */
 #ifndef GNUNET_CONVERSATION_GTK_PHONE_H
 #define GNUNET_CONVERSATION_GTK_PHONE_H
 
 
-
 /**
  * Initiate a call to the given address.
  *
  * @param address address to call
  */
 void
-GSC_do_call (const char *address);
+GSC_PHONE_make_call (const char *address);
 
 
+/**
+ * Initialize phone subsystem.
+ */
 void
 GCG_PHONE_init (void);
 
 
+/**
+ * Shutdown phone subsystem.
+ */
 void
 GCG_PHONE_shutdown (void);
 

Added: gnunet-gtk/src/conversation/gnunet-conversation-gtk_visibility.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk_visibility.c            
                (rev 0)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk_visibility.c    
2014-05-26 19:28:04 UTC (rev 33403)
@@ -0,0 +1,82 @@
+/*
+     This file is part of GNUnet.
+     (C) 2010-2014 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 3, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/conversation/gnunet-conversation-gtk_visibility.c
+ * @brief show or hide widgets based on view options
+ * @author Christian Grothoff
+ */
+#include "gnunet-conversation-gtk.h"
+
+
+/**
+ * Toggle the visibility of a widget based on the checkeness
+ * of a menu item.
+ *
+ * @param toggled_widget name of widget to toggle
+ * @param toggle_menu name of menu entry
+ */
+static void
+toggle_view (const char *toggled_widget,
+            const char *toggle_menu)
+{
+  GtkCheckMenuItem *mi;
+  GtkWidget *widget;
+
+  widget = GTK_WIDGET (GCG_get_main_window_object (toggled_widget));
+  mi = GTK_CHECK_MENU_ITEM (GCG_get_main_window_object (toggle_menu));
+  if (gtk_check_menu_item_get_active (mi))
+    gtk_widget_show (widget);
+  else
+    gtk_widget_hide (widget);
+}
+
+
+/**
+ * Log view is toggled.
+ *
+ * @param dummy widget triggering the event
+ * @param data main window builder (unused)
+ */
+void
+gnunet_conversation_gtk_view_log_checkmenuitem_toggled_cb (GtkWidget * dummy,
+                                                           gpointer data)
+{
+  toggle_view ("gnunet_conversation_gtk_log_frame",
+               "gnunet_conversation_gtk_view_log_checkmenuitem");
+}
+
+
+/**
+ * History view is toggled.
+ *
+ * @param dummy widget triggering the event
+ * @param data main window builder (unused)
+ */
+void
+gnunet_conversation_gtk_view_history_checkmenuitem_toggled_cb (GtkWidget * 
dummy,
+                                                               gpointer data)
+{
+  toggle_view ("gnunet_conversation_gtk_history_frame",
+               "gnunet_conversation_gtk_view_history_checkmenuitem");
+}
+
+
+/* end of gnunet-conversation-gtk_visibility.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]