aboutsummaryrefslogtreecommitdiff
path: root/src/ui/new_contact.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/new_contact.c')
-rw-r--r--src/ui/new_contact.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c
index 8188740..6438331 100644
--- a/src/ui/new_contact.c
+++ b/src/ui/new_contact.c
@@ -40,8 +40,28 @@ handle_confirm_button_click(UNUSED GtkButton *button,
40{ 40{
41 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 41 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
42 42
43 // TODO: Add new contact 43 const gint id_length = gtk_entry_get_text_length(app->ui.new_contact.id_entry);
44 const gchar *id_text = gtk_entry_get_text(app->ui.new_contact.id_entry);
44 45
46 if (id_length <= 0)
47 goto close_dialog;
48
49 gchar *emsg = NULL;
50 struct GNUNET_CHAT_Uri *uri = GNUNET_CHAT_uri_parse(id_text, &emsg);
51
52 if (uri)
53 {
54 GNUNET_CHAT_lobby_join(app->chat.messenger.handle, uri);
55 GNUNET_CHAT_uri_destroy(uri);
56 }
57
58 if (emsg)
59 {
60 printf("ERROR: %s\n", emsg);
61 GNUNET_free(emsg);
62 }
63
64close_dialog:
45 gtk_window_close(GTK_WINDOW(app->ui.new_contact.dialog)); 65 gtk_window_close(GTK_WINDOW(app->ui.new_contact.dialog));
46} 66}
47 67
@@ -61,6 +81,9 @@ handle_id_drawing_area_draw(GtkWidget* drawing_area,
61 81
62 GtkStyleContext* context = gtk_widget_get_style_context(drawing_area); 82 GtkStyleContext* context = gtk_widget_get_style_context(drawing_area);
63 83
84 if (!context)
85 return FALSE;
86
64 const guint width = gtk_widget_get_allocated_width(drawing_area); 87 const guint width = gtk_widget_get_allocated_width(drawing_area);
65 const guint height = gtk_widget_get_allocated_height(drawing_area); 88 const guint height = gtk_widget_get_allocated_height(drawing_area);
66 89