diff options
Diffstat (limited to 'src/ui/chat.c')
-rw-r--r-- | src/ui/chat.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c index c0ea685..79603db 100644 --- a/src/ui/chat.c +++ b/src/ui/chat.c | |||
@@ -77,7 +77,8 @@ handle_chat_contacts_listbox_row_activated(GtkListBox *listbox, | |||
77 | GtkListBoxRow *row, | 77 | GtkListBoxRow *row, |
78 | gpointer user_data) | 78 | gpointer user_data) |
79 | { | 79 | { |
80 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 80 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; |
81 | MESSENGER_Application *app = handle->app; | ||
81 | 82 | ||
82 | GtkTextView *text_view = GTK_TEXT_VIEW( | 83 | GtkTextView *text_view = GTK_TEXT_VIEW( |
83 | g_object_get_qdata(G_OBJECT(listbox), app->quarks.widget) | 84 | g_object_get_qdata(G_OBJECT(listbox), app->quarks.widget) |
@@ -104,19 +105,15 @@ handle_chat_contacts_listbox_row_activated(GtkListBox *listbox, | |||
104 | g_object_get_qdata(G_OBJECT(row), app->quarks.data) | 105 | g_object_get_qdata(G_OBJECT(row), app->quarks.data) |
105 | ); | 106 | ); |
106 | 107 | ||
107 | if ((!contact) || (!GNUNET_CHAT_contact_get_key(contact)) || | 108 | if (!contact) |
108 | (GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact))) | ||
109 | return; | 109 | return; |
110 | 110 | ||
111 | struct GNUNET_CHAT_Context *context = GNUNET_CHAT_contact_get_context( | 111 | hdy_flap_set_reveal_flap(handle->flap_chat_details, FALSE); |
112 | contact | ||
113 | ); | ||
114 | 112 | ||
115 | if (!context) | 113 | ui_contact_info_dialog_init(app, &(app->ui.contact_info)); |
116 | return; | 114 | ui_contact_info_dialog_update(&(app->ui.contact_info), contact, FALSE); |
117 | 115 | ||
118 | if (GNUNET_SYSERR == GNUNET_CHAT_context_get_status(context)) | 116 | gtk_widget_show(GTK_WIDGET(app->ui.contact_info.dialog)); |
119 | GNUNET_CHAT_context_request(context); | ||
120 | } | 117 | } |
121 | 118 | ||
122 | static void | 119 | static void |
@@ -156,12 +153,25 @@ handle_back_button_click(UNUSED GtkButton *button, | |||
156 | } | 153 | } |
157 | 154 | ||
158 | static void | 155 | static void |
159 | handle_reveal_identity_button_click(UNUSED GtkButton *button, | 156 | handle_reveal_identity_button_click(GtkButton *button, |
160 | gpointer user_data) | 157 | gpointer user_data) |
161 | { | 158 | { |
162 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; | 159 | UI_CHAT_Handle *handle = (UI_CHAT_Handle*) user_data; |
160 | MESSENGER_Application *app = handle->app; | ||
161 | |||
162 | struct GNUNET_CHAT_Contact *contact = (struct GNUNET_CHAT_Contact*) ( | ||
163 | g_object_get_qdata(G_OBJECT(button), app->quarks.data) | ||
164 | ); | ||
163 | 165 | ||
164 | // TODO | 166 | if (!contact) |
167 | return; | ||
168 | |||
169 | hdy_flap_set_reveal_flap(handle->flap_chat_details, FALSE); | ||
170 | |||
171 | ui_contact_info_dialog_init(app, &(app->ui.contact_info)); | ||
172 | ui_contact_info_dialog_update(&(app->ui.contact_info), contact, TRUE); | ||
173 | |||
174 | gtk_widget_show(GTK_WIDGET(app->ui.contact_info.dialog)); | ||
165 | } | 175 | } |
166 | 176 | ||
167 | static void | 177 | static void |
@@ -1197,7 +1207,7 @@ ui_chat_new(MESSENGER_Application *app) | |||
1197 | handle->chat_contacts_listbox, | 1207 | handle->chat_contacts_listbox, |
1198 | "row-activated", | 1208 | "row-activated", |
1199 | G_CALLBACK(handle_chat_contacts_listbox_row_activated), | 1209 | G_CALLBACK(handle_chat_contacts_listbox_row_activated), |
1200 | app | 1210 | handle |
1201 | ); | 1211 | ); |
1202 | 1212 | ||
1203 | handle->chat_files_listbox = GTK_LIST_BOX( | 1213 | handle->chat_files_listbox = GTK_LIST_BOX( |
@@ -1443,8 +1453,8 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
1443 | { | 1453 | { |
1444 | GNUNET_assert((handle) && (app) && (context)); | 1454 | GNUNET_assert((handle) && (app) && (context)); |
1445 | 1455 | ||
1446 | const struct GNUNET_CHAT_Contact* contact; | 1456 | struct GNUNET_CHAT_Contact* contact; |
1447 | const struct GNUNET_CHAT_Group* group; | 1457 | struct GNUNET_CHAT_Group* group; |
1448 | 1458 | ||
1449 | contact = GNUNET_CHAT_context_get_contact(context); | 1459 | contact = GNUNET_CHAT_context_get_contact(context); |
1450 | group = GNUNET_CHAT_context_get_group(context); | 1460 | group = GNUNET_CHAT_context_get_group(context); |
@@ -1524,6 +1534,12 @@ ui_chat_update(UI_CHAT_Handle *handle, | |||
1524 | group? TRUE : FALSE | 1534 | group? TRUE : FALSE |
1525 | ); | 1535 | ); |
1526 | 1536 | ||
1537 | g_object_set_qdata( | ||
1538 | G_OBJECT(handle->reveal_identity_button), | ||
1539 | app->quarks.data, | ||
1540 | contact | ||
1541 | ); | ||
1542 | |||
1527 | gtk_widget_set_visible( | 1543 | gtk_widget_set_visible( |
1528 | GTK_WIDGET(handle->reveal_identity_button), | 1544 | GTK_WIDGET(handle->reveal_identity_button), |
1529 | contact? TRUE : FALSE | 1545 | contact? TRUE : FALSE |