[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32123 - in gnunet-gtk: contrib src/conversation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32123 - in gnunet-gtk: contrib src/conversation |
Date: |
Thu, 30 Jan 2014 18:29:08 +0100 |
Author: hark
Date: 2014-01-30 18:29:08 +0100 (Thu, 30 Jan 2014)
New Revision: 32123
Modified:
gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
Log:
different tray icons on different phone states
Modified: gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
2014-01-30 16:58:20 UTC (rev 32122)
+++ gnunet-gtk/contrib/gnunet_conversation_gtk_main_window.glade
2014-01-30 17:29:08 UTC (rev 32123)
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkListStore" id="gnunet_conversation_gtk_contacts_liststore">
- <columns>
- <!-- column-name contactName -->
- <column type="gchararray"/>
- <!-- column-name contactType -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkWindow" id="GNUNET_GTK_conversation_window">
<property name="can_focus">False</property>
<property name="events">GDK_BUTTON_PRESS_MASK |
GDK_STRUCTURE_MASK</property>
@@ -147,7 +139,17 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkImage" id="GNUNET_GTK_status_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text"
translatable="yes">Status indicator</property>
+ <property name="icon_name">bluefish</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
<child>
<placeholder/>
@@ -422,6 +424,14 @@
</object>
</child>
</object>
+ <object class="GtkListStore" id="gnunet_conversation_gtk_contacts_liststore">
+ <columns>
+ <!-- column-name contactName -->
+ <column type="gchararray"/>
+ <!-- column-name contactType -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkTreeStore" id="gnunet_conversation_gtk_contacts_treestore">
<columns>
<!-- column-name contactName -->
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.c
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-01-30
16:58:20 UTC (rev 32122)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.c 2014-01-30
17:29:08 UTC (rev 32123)
@@ -78,9 +78,9 @@
GtkTextIter iter;
gchar *fmsg;
- log_view = GTK_TEXT_VIEW(get_object ("GNUNET_GTK_conversation_log"));
+ log_view = GTK_TEXT_VIEW (get_object ("GNUNET_GTK_conversation_log"));
- logbuff = GTK_TEXT_BUFFER(gtk_text_view_get_buffer (log_view));
+ logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
fmsg = g_strdup_printf (" %s \n", message);
@@ -117,7 +117,7 @@
gchar *buff;
- status_bar = GTK_STATUSBAR(get_object ("GNUNET_GTK_conversation_statusbar"));
+ status_bar = GTK_STATUSBAR (get_object
("GNUNET_GTK_conversation_statusbar"));
status_bar_context = gtk_statusbar_get_context_id (status_bar, "blaat");
@@ -146,24 +146,24 @@
switch (type)
{
- case CH_ACCEPTED:
- event = "Accepted";
- break;
- case CH_REJECTED:
- event = "Rejected";
- break;
- case CH_OUTGOING:
- event = "Outgoing";
- break;
- case CH_HANGUP:
- event = "Hangup";
- break;
- case CH_MISSED:
- event = "Missed";
- break;
- default:
- event = "UNKNOWN";
- break;
+ case CH_ACCEPTED:
+ event = "Accepted";
+ break;
+ case CH_REJECTED:
+ event = "Rejected";
+ break;
+ case CH_OUTGOING:
+ event = "Outgoing";
+ break;
+ case CH_HANGUP:
+ event = "Hangup";
+ break;
+ case CH_MISSED:
+ event = "Missed";
+ break;
+ default:
+ event = "UNKNOWN";
+ break;
}
time (&t);
gtk_list_store_append (history_liststore, &iter);
@@ -183,7 +183,7 @@
//GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET(get_object (button_name));
+ button = GTK_WIDGET (get_object (button_name));
gtk_widget_hide (button);
}
@@ -211,7 +211,7 @@
//GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET(get_object (button_name));
+ button = GTK_WIDGET (get_object (button_name));
gtk_widget_hide (button);
}
@@ -225,7 +225,7 @@
//GtkButton *button;
GtkWidget *button;
- button = GTK_WIDGET(get_object (button_name));
+ button = GTK_WIDGET (get_object (button_name));
gtk_widget_show (button);
}
@@ -322,7 +322,7 @@
phone_state = PS_LISTEN;
}
GNUNET_free (cl);
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
break;
}
@@ -484,8 +484,8 @@
GNUNET_CONVERSATION_call_start (cfg, caller_id, arg, speaker, mic,
&call_event_handler, NULL);
UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
- peer_name);
- history_add(2,peer_name);
+ peer_name);
+ history_add (CH_ACCEPTED, peer_name);
}
@@ -513,7 +513,7 @@
break;
case PS_LISTEN:
/* this is the expected state */
- break;
+ break;
case PS_ACCEPTED:
LOG (_
("You are answering call from `%s', hang up or suspend that call
first!\n"),
@@ -543,14 +543,14 @@
LOG (_("There is no incoming call `%s' to accept right now!\n"), args);
return;
}
- cl_active = cl;
- GNUNET_free_non_null (peer_name);
- peer_name = GNUNET_strdup (cl->caller_id);
- phone_state = PS_ACCEPTED;
- GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl,
+ cl_active = cl;
+ GNUNET_free_non_null (peer_name);
+ peer_name = GNUNET_strdup (cl->caller_id);
+ phone_state = PS_ACCEPTED;
+ GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl,
speaker, mic);
- history_add (0, peer_name);
+ history_add (CH_ACCEPTED, peer_name);
}
@@ -576,19 +576,25 @@
UPDATE_STATUS (_
("We are currently trying to locate the private key for the
ego `%s'."),
ego_name);
-
+ set_status_icon ("gnunet-conversation-tray-pending");
break;
case PS_LISTEN:
UPDATE_STATUS (_
("We are listening for incoming calls for ego `%s' on line
%u."),
ego_name, line);
+ set_status_icon ("gnunet-conversation-tray-available");
+
break;
case PS_ACCEPTED:
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."));
+ set_status_icon ("gnunet-conversation-offline");
+
break;
}
if (NULL != call)
@@ -599,22 +605,30 @@
UPDATE_STATUS (_
("We are trying to find the network address to call
`%s'."),
peer_name);
+ set_status_icon ("gnunet-conversation-tray-call-pending");
+
break;
case CS_RINGING:
UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
peer_name);
+ set_status_icon ("gnunet-conversation-tray-call-ringing");
+
break;
case CS_CONNECTED:
- UPDATE_STATUS (_("You are having a conversation with `%s'."),
- peer_name);
+ UPDATE_STATUS (_("You are having a conversation with `%s'."), peer_name);
+ set_status_icon ("gnunet-conversation-tray-call-active");
+
break;
case CS_SUSPENDED:
+ set_status_icon ("gnunet-conversation-tray-call-suspended");
+
/* ok to accept incoming call right now */
break;
}
}
if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail)))
{
+ set_status_icon ("gnunet-conversation-tray-call-incoming");
for (cl = cl_head; NULL != cl; cl = cl->next)
{
@@ -789,14 +803,15 @@
break;
case PS_ACCEPTED:
/* expected state, do rejection logic */
+ history_add (CH_REJECTED, peer_name);
GNUNET_assert (NULL != cl_active);
GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
GNUNET_free (cl_active);
+
// cl_active = NULL;
phone_state = PS_LISTEN;
break;
}
- history_add (1, peer_name);
}
@@ -902,7 +917,7 @@
add_continuation (void *cls, int32_t success, const char *emsg)
{
- struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
+ struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
*qe = NULL;
if (GNUNET_YES != success)
@@ -927,26 +942,20 @@
* @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)
{
- fprintf (stderr,
- _("Deleting record failed, record does not exist%s%s\n"),
- (NULL != emsg) ? ": " : "",
- (NULL != emsg) ? emsg : "");
+ fprintf (stderr, _("Deleting record failed, record does not exist%s%s\n"),
+ (NULL != emsg) ? ": " : "", (NULL != emsg) ? emsg : "");
}
if (GNUNET_SYSERR == success)
{
- fprintf (stderr,
- _("Deleting record failed%s%s\n"),
- (NULL != emsg) ? ": " : "",
- (NULL != emsg) ? emsg : "");
+ fprintf (stderr, _("Deleting record failed%s%s\n"),
+ (NULL != emsg) ? ": " : "", (NULL != emsg) ? emsg : "");
}
- // test_finished ();
+ // test_finished ();
}
@@ -1024,7 +1033,7 @@
{
//TODO: make this work
- //struct OperationContext *oc;
+ //struct OperationContext *oc;
/*
GIG_advertise_shutdown_ ();
@@ -1123,7 +1132,8 @@
/* setup main window */
main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
main_window =
- GTK_WIDGET(GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG",
GTK_WIDGET(main_window)));
+ GTK_WIDGET (GNUNET_GTK_plug_me
+ ("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET (main_window)));
gtk_window_set_default_size (main_window, 300, 700);
contacts_liststore =
GTK_LIST_STORE (get_object
@@ -1151,13 +1161,14 @@
if (NULL == getenv ("GNUNET_CONVERSATION_GTK_PLUG"))
GNUNET_GTK_tray_icon_create (ml, GTK_WINDOW (main_window),
- "gnunet-gtk" /* FIXME: different icon? */ ,
+ "gnunet-conversation-gtk"
+ /* FIXME: different icon? */ ,
"gnunet-conversation-gtk");
/* make GUI visible */
if (!tray_only)
{
- gtk_widget_show (GTK_WIDGET(main_window));
+ gtk_widget_show (GTK_WIDGET (main_window));
gtk_window_present (GTK_WINDOW (main_window));
}
@@ -1172,8 +1183,8 @@
cfg = GIG_get_configuration ();
//cfg = GNUNET_CONFIGURATION_dup (c);
- speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration());
- mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration());
+ speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration ());
+ mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration ());
if (NULL == ego_name)
{
@@ -1236,51 +1247,49 @@
void
quick_message (gchar * message, const char *caller_id)
{
- GtkWidget *caller_name, *notification, *content_area;
- GtkWidget *dialog;
- GtkWindow *main_window;
- main_window = GTK_WINDOW(get_object("GNUNET_GTK_conversation_window"));
- // Create the widgets
+ GtkWidget *caller_name, *notification, *content_area;
+ GtkWidget *dialog;
+ GtkWindow *main_window;
+ main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
+ // Create the widgets
- dialog = gtk_dialog_new_with_buttons ("Incoming call!",
- main_window,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- _("Accept call"),
- GTK_RESPONSE_ACCEPT,
- _("Reject call"),
- GTK_RESPONSE_REJECT,
- _("Decide later"),
- GTK_RESPONSE_CANCEL,
- NULL);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ dialog =
+ gtk_dialog_new_with_buttons ("Incoming call!", main_window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ _("Accept call"), GTK_RESPONSE_ACCEPT,
+ _("Reject call"), GTK_RESPONSE_REJECT,
+ _("Decide later"), GTK_RESPONSE_CANCEL,
+ NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- notification = gtk_label_new ("Incoming call from:");
- caller_name = gtk_label_new (caller_id);
+ notification = gtk_label_new ("Incoming call from:");
+ caller_name = gtk_label_new (caller_id);
- // Add the labels, and show everything we've added to the dialog
- gtk_container_add (GTK_CONTAINER (content_area), notification);
- gtk_container_add (GTK_CONTAINER (content_area), caller_name);
- gtk_widget_show_all (GTK_WIDGET(dialog));
+ // Add the labels, and show everything we've added to the dialog
+ gtk_container_add (GTK_CONTAINER (content_area), notification);
+ gtk_container_add (GTK_CONTAINER (content_area), caller_name);
+ gtk_widget_show_all (GTK_WIDGET (dialog));
- switch(gtk_dialog_run(GTK_DIALOG(dialog))){
- case GTK_RESPONSE_ACCEPT :
- do_status("");
- gtk_widget_destroy(GTK_WIDGET(dialog));
- do_accept("0");
- break;
- case GTK_RESPONSE_REJECT :
- do_reject("0");
- do_status("");
- gtk_widget_destroy(GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_CANCEL :
- do_status("");
- gtk_widget_destroy(GTK_WIDGET(dialog));
- break;
- }
+ switch (gtk_dialog_run (GTK_DIALOG (dialog)))
+ {
+ case GTK_RESPONSE_ACCEPT:
+ do_status ("");
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ do_accept ("0");
+ break;
+ case GTK_RESPONSE_REJECT:
+ do_reject ("0");
+ do_status ("");
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ break;
+ case GTK_RESPONSE_CANCEL:
+ do_status ("");
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ break;
+ }
}
@@ -1336,7 +1345,7 @@
{
FPRINTF (stderr, "accept clicked \n");
do_accept (0);
- // hide_infobar ();
+ // hide_infobar ();
}
@@ -1357,7 +1366,7 @@
GNUNET_CONVERSATION_GTK_on_pause_clicked ()
{
// GtkEntry *entry;
-do_suspend("0");
+ do_suspend ("0");
//FPRINTF (stderr, "pause clicked \n");
//do_pause("");
// entry = GTK_ENTRY((get_object ("GNUNET_GTK_conversation_address")));
@@ -1395,7 +1404,8 @@
* @param name
* @param address
*/
-void add_contact(const gchar *name, const gchar *address)
+void
+add_contact (const gchar * name, const gchar * address)
{
// memmove(&address+1,&address+51,1);
GtkTreeIter iter;
@@ -1405,8 +1415,11 @@
static size_t data_size;
struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
+ FPRINTF (stderr, 'address: %s', address);
+ FPRINTF (stderr, 'address-len: %i', strlen (address));
+
GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address),
&pkey);
- rde=&rd;
+ rde = &rd;
zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
rd.data = &pkey;
rd.data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
@@ -1418,26 +1431,18 @@
FPRINTF (stderr, "name: %s\n", name);
FPRINTF (stderr, "address: %s\n", address);
if (GNUNET_OK !=
- GNUNET_GNSRECORD_string_to_value (65536,
- address,
- &data,
- &data_size))
- {
- FPRINTF (stderr, "invalid address\n");
- }
+ GNUNET_GNSRECORD_string_to_value (65536, address, &data, &data_size))
+ {
+ FPRINTF (stderr, "invalid address\n");
+ }
else
- {
- add_qe =
- GNUNET_NAMESTORE_records_store (ns,
- &zone_pkey,
- name,
- 1,
- rde,
- &add_continuation,
- &add_qe);
- gtk_list_store_append (contacts_liststore, &iter);
- gtk_list_store_set (contacts_liststore, &iter, 1, "PKEY", 0, name, -1);
- }
+ {
+ add_qe =
+ GNUNET_NAMESTORE_records_store (ns, &zone_pkey, name, 1, rde,
+ &add_continuation, &add_qe);
+ gtk_list_store_append (contacts_liststore, &iter);
+ gtk_list_store_set (contacts_liststore, &iter, 1, "PKEY", 0, name, -1);
+ }
}
/*
@@ -1455,47 +1460,51 @@
//unused: *anotherArea, *labelName, *labelAddres *caller_name
GtkLabel *notification;
+
// GtkHBox *content_area;
GtkContainer *content_area;
- GtkButton *currentCheckButton;
+ GtkButton *currentCheckButton;
GtkEntry *nameEntry, *addressEntry;
GtkDialog *dialog;
GtkWindow *main_window;
currentCheckButton =
- GTK_BUTTON(gtk_button_new_with_label ("use currently incoming addres"));
+ GTK_BUTTON (gtk_button_new_with_label ("use currently incoming addres"));
- nameEntry = GTK_ENTRY(gtk_entry_new ());
- gtk_entry_set_text (nameEntry, "Name of contact");
- addressEntry = GTK_ENTRY(gtk_entry_new ());
- gtk_entry_set_text (addressEntry, "Address of contact");
+ nameEntry = gtk_entry_new ();
+ gtk_entry_set_text (nameEntry, "Name");
+ addressEntry = gtk_entry_new ();
+ gtk_entry_set_text (addressEntry, "Address");
- main_window = GTK_WINDOW(get_object ("GNUNET_GTK_conversation_window"));
+ main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
dialog =
- GTK_DIALOG(gtk_dialog_new_with_buttons ("Adding contact", main_window,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- _("Add contact"), GTK_RESPONSE_ACCEPT,
- _("Cancel"), GTK_RESPONSE_CANCEL, NULL));
- gtk_dialog_add_action_widget (dialog, GTK_WIDGET(currentCheckButton),
GTK_RESPONSE_OK);
+ GTK_DIALOG (gtk_dialog_new_with_buttons
+ ("Adding contact", main_window,
+ GTK_DIALOG_DESTROY_WITH_PARENT, _("Add contact"),
+ GTK_RESPONSE_ACCEPT, _("Cancel"), GTK_RESPONSE_CANCEL,
+ NULL));
+ gtk_dialog_add_action_widget (dialog, GTK_WIDGET (currentCheckButton),
+ GTK_RESPONSE_OK);
// FPRINTF (stderr, "response id : %u", response_id);
// g_signal_connect (GTK_BUTTON (currentCheckButton), "clicked",
// G_CALLBACK (use_current_incoming_address), NULL);
- gtk_dialog_add_action_widget (dialog, GTK_WIDGET(nameEntry), 2);
- gtk_dialog_add_action_widget (dialog, GTK_WIDGET(addressEntry), 3);
+ gtk_dialog_add_action_widget (dialog, GTK_WIDGET (nameEntry), 2);
+ gtk_dialog_add_action_widget (dialog, GTK_WIDGET (addressEntry), 3);
- content_area = GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG
(dialog)));
+ content_area =
+ GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
- notification = GTK_LABEL(gtk_label_new ("Adding contact"));
+ notification = GTK_LABEL (gtk_label_new ("Adding contact"));
// caller_name = gtk_label_new (caller_id);
// Add the labels, and show everything we've added to the dialog
- gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification));
+ gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (notification));
// gtk_container_add (GTK_CONTAINER (content_area), caller_name);
- gtk_widget_show_all (GTK_WIDGET(dialog));
+ gtk_widget_show_all (GTK_WIDGET (dialog));
switch (gtk_dialog_run (dialog))
{
@@ -1503,20 +1512,22 @@
do_status ("");
add_contact (gtk_entry_get_text (nameEntry),
gtk_entry_get_text (addressEntry));
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
break;
case GTK_RESPONSE_CANCEL:
FPRINTF (stderr, "cancel clicked");
do_status ("");
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ FPRINTF (stderr, 'use_current: callername: %s', callerName);
+
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
break;
case GTK_RESPONSE_OK:
//use_current_incoming_address();
- gtk_entry_set_text (GTK_ENTRY(addressEntry), callerName);
- add_contact (gtk_entry_get_text (nameEntry),
- callerName);
+ gtk_entry_set_text (GTK_ENTRY (addressEntry), callerName);
+ add_contact (gtk_entry_get_text (nameEntry), callerName);
//
add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1));
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
// memmove(&address+1,&address+51,1);
break;
@@ -1527,51 +1538,51 @@
void
GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
- gpointer * user_data)
+ gpointer * user_data)
{
GtkTreeSelection *selection;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkDialog *confirm;
- GtkWindow *main_window;
+ 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))
+ 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 = GTK_WINDOW(get_object ("GNUNET_GTK_conversation_window"));
+ FPRINTF (stderr, "selected %s \n", name);
+ main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
confirm =
- GTK_DIALOG(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_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG
(confirm)));
- notification = GTK_LABEL(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;
- }
+ GTK_DIALOG (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_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (confirm)));
+ notification =
+ GTK_LABEL (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;
+ }
- }
+ }
}
@@ -1621,12 +1632,48 @@
do_call (callAddress);
}
+/*
+ * set_status_icon
+ *
+ * available icons:
+ * gnunet-conversation-tray-pending
+ * gnunet-conversation-tray-available
+ * gnunet-conversation-tray-offline
+ * gnunet-conversation-tray-call-pending
+ * gnunet-conversation-tray-call-ringing
+ * gnunet-conversation-tray-call-active
+ * gnunet-conversation-tray-call-suspended
+ * gnunet-conversation-tray-call-incoming
+ *
+ */
+
+void
+set_status_icon (const char *icon_name)
+{
+ GtkWindow *main_window;
+ GtkImage *status_icon;
+
+
+
+ main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
+
+ status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon"));
+
+ gtk_image_set_from_icon_name (status_icon, icon_name, GTK_ICON_SIZE_BUTTON);
+
+ GNUNET_GTK_tray_icon_change (ml, GTK_WINDOW (main_window), icon_name,
+ "gnunet-conversation-gtk-status");
+}
+
+
/* end of gnunet-conversation-gtk.c */
-void GNUNET_contact_test()
+void
+GNUNET_contact_test ()
{
- history_add(0,"test");
- history_add(1,"test");
- history_add(2,"test");
- history_add(3,"test");
- history_add(4,"test");
+
+ history_add (0, "test");
+ history_add (1, "test");
+ history_add (2, "test");
+ history_add (3, "test");
+ history_add (4, "test");
}
Modified: gnunet-gtk/src/conversation/gnunet-conversation-gtk.h
===================================================================
--- gnunet-gtk/src/conversation/gnunet-conversation-gtk.h 2014-01-30
16:58:20 UTC (rev 32122)
+++ gnunet-gtk/src/conversation/gnunet-conversation-gtk.h 2014-01-30
17:29:08 UTC (rev 32123)
@@ -124,11 +124,11 @@
enum CallHistoryType
{
- CH_ACCEPTED,
- CH_REJECTED,
- CH_OUTGOING,
- CH_HANGUP,
- CH_MISSED
+ CH_ACCEPTED,
+ CH_REJECTED,
+ CH_OUTGOING,
+ CH_HANGUP,
+ CH_MISSED
};
@@ -197,6 +197,7 @@
* Desired phone line.
*/
static unsigned int line;
+
//static unsigned int line1;
/**
@@ -213,6 +214,7 @@
* Our configurations.
*/
static struct GNUNET_CONFIGURATION_Handle *cfg;
+
//static struct GNUNET_CONFIGURATION_Handle *cfg1;
//static struct GNUNET_CONFIGURATION_Handle *cfg2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32123 - in gnunet-gtk: contrib src/conversation,
gnunet <=