gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32070 - gnunet-gtk/src/conversation
Date: Wed, 29 Jan 2014 12:36:08 +0100

Author: yids
Date: 2014-01-29 12:36:08 +0100 (Wed, 29 Jan 2014)
New Revision: 32070

Modified:
   gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
Log:
Added confirmation dialog for removing a contact


Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-01-29 
09:32:59 UTC (rev 32069)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c       2014-01-29 
11:36:08 UTC (rev 32070)
@@ -614,12 +614,13 @@
   }
   if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail)))
   {
-    LOG ("%s", _("Calls waiting:"));
+    
     for (cl = cl_head; NULL != cl; cl = cl->next)
     {
       if (cl == cl_active)
         continue;
-      UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id);
+      //UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id);
+      LOG ("%s", _("Calls waiting:"));
     }
   }
 }
@@ -790,7 +791,8 @@
     /* expected state, do rejection logic */
     GNUNET_assert (NULL != cl_active);
     GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
-    cl_active = NULL;
+    GNUNET_free (cl_active);
+//    cl_active = NULL;
     phone_state = PS_LISTEN;
     break;
   }
@@ -1321,7 +1323,7 @@
   //FPRINTF (stderr, "hangup clicked \n");
   do_reject (NULL);
   do_status ("");
-  history_add(3,peer_name);
+  //history_add(3,peer_name);
 }
 
 /**
@@ -1548,31 +1550,52 @@
 
 void
 GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
-                                           gpointer * user_data)
+               gpointer * user_data)
 {
   FPRINTF (stderr, "remove clicked \n");
   GtkTreeSelection *selection;
   GtkTreeModel     *model;
   GtkTreeIter       iter;
+  GtkDialog       *confirm;  
+  GtkWindow       *main_window;
+  GtkLabel *notification;
+  GtkHBox *content_area;
   
   selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview));
   if (gtk_tree_selection_get_selected(selection, &model, &iter))
   {
     gtk_tree_model_get (model, &iter, 0, &name, -1);
+    FPRINTF(stderr, "selected %s \n", name);
+    main_window = get_object ("GNUNET_GTK_conversation_window");
+    confirm =
+        gtk_dialog_new_with_buttons ("Removing contact", main_window,
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     _("Yes"), GTK_RESPONSE_ACCEPT,
+                                     _("No"), GTK_RESPONSE_CANCEL, NULL); 
+    content_area = gtk_dialog_get_content_area (GTK_DIALOG (confirm));
+    notification = gtk_label_new ("Do you really want to remove this 
contact?");
+    gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification));
+    gtk_widget_show_all (GTK_WIDGET(confirm));
+    switch (gtk_dialog_run(confirm))
+     {
+     case GTK_RESPONSE_ACCEPT:
+         zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);  
+         del_qe = GNUNET_NAMESTORE_records_store (ns,
+                                                 &zone_pkey,
+                                                 name,
+                                                 0, NULL,
+                                                 &del_continuation,
+                                                 NULL);
+         gtk_list_store_remove(contacts_liststore, &iter);
+         gtk_widget_destroy (GTK_WIDGET(confirm));
+         break;
+     case GTK_RESPONSE_CANCEL:
+         FPRINTF(stderr, "not removing \n");
+         gtk_widget_destroy (GTK_WIDGET(confirm));
+         break;
+     }
 
-  }
-  else
-  {
-    g_print ("no row selected.\n");
-  }
-  zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);  
-  del_qe = GNUNET_NAMESTORE_records_store (ns,
-                                          &zone_pkey,
-                                          name,
-                                          0, NULL,
-                                          &del_continuation,
-                                          NULL);
-  gtk_list_store_remove(contacts_liststore, &iter);
+   }
 }
 
 




reply via email to

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