diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-18 15:41:15 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-12-18 15:41:15 +0100 |
commit | c3195ac1db60e615acd42ab5e213d7a5a6a35064 (patch) | |
tree | 584cb25c12283a31826b8e8df8c2143406d19f41 /src | |
parent | 106ece8407806a70e8327b15178668daae003fc2 (diff) | |
download | messenger-gtk-c3195ac1db60e615acd42ab5e213d7a5a6a35064.tar.gz messenger-gtk-c3195ac1db60e615acd42ab5e213d7a5a6a35064.zip |
Adapted UI to visualize problems with the camera connection
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/new_contact.c | 24 | ||||
-rw-r--r-- | src/ui/new_contact.h | 3 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c index c193629..3acae1a 100644 --- a/src/ui/new_contact.c +++ b/src/ui/new_contact.c | |||
@@ -150,6 +150,8 @@ render_image: | |||
150 | static void | 150 | static void |
151 | _disable_video_processing(UI_NEW_CONTACT_Handle *handle) | 151 | _disable_video_processing(UI_NEW_CONTACT_Handle *handle) |
152 | { | 152 | { |
153 | gtk_stack_set_visible_child(handle->preview_stack, handle->fail_box); | ||
154 | |||
153 | if (!(handle->video)) | 155 | if (!(handle->video)) |
154 | return; | 156 | return; |
155 | 157 | ||
@@ -269,6 +271,11 @@ _ui_new_contact_video_thread(void *args) | |||
269 | TRUE | 271 | TRUE |
270 | ); | 272 | ); |
271 | 273 | ||
274 | gtk_stack_set_visible_child( | ||
275 | handle->preview_stack, | ||
276 | GTK_WIDGET(handle->id_drawing_area) | ||
277 | ); | ||
278 | |||
272 | handle->idle_processing = g_idle_add(idle_video_processing, handle); | 279 | handle->idle_processing = g_idle_add(idle_video_processing, handle); |
273 | return NULL; | 280 | return NULL; |
274 | } | 281 | } |
@@ -280,8 +287,6 @@ ui_new_contact_dialog_init(MESSENGER_Application *app, | |||
280 | handle->video = zbar_video_create(); | 287 | handle->video = zbar_video_create(); |
281 | handle->scanner = zbar_image_scanner_create(); | 288 | handle->scanner = zbar_image_scanner_create(); |
282 | 289 | ||
283 | pthread_create(&(handle->video_tid), NULL, _ui_new_contact_video_thread, handle); | ||
284 | |||
285 | handle->builder = gtk_builder_new_from_file("resources/ui/new_contact.ui"); | 290 | handle->builder = gtk_builder_new_from_file("resources/ui/new_contact.ui"); |
286 | 291 | ||
287 | handle->dialog = GTK_DIALOG( | 292 | handle->dialog = GTK_DIALOG( |
@@ -298,10 +303,25 @@ ui_new_contact_dialog_init(MESSENGER_Application *app, | |||
298 | GTK_WINDOW(app->ui.messenger.main_window) | 303 | GTK_WINDOW(app->ui.messenger.main_window) |
299 | ); | 304 | ); |
300 | 305 | ||
306 | handle->preview_stack = GTK_STACK( | ||
307 | gtk_builder_get_object(handle->builder, "preview_stack") | ||
308 | ); | ||
309 | |||
310 | handle->fail_box = GTK_WIDGET( | ||
311 | gtk_builder_get_object(handle->builder, "fail_box") | ||
312 | ); | ||
313 | |||
301 | handle->id_drawing_area = GTK_DRAWING_AREA( | 314 | handle->id_drawing_area = GTK_DRAWING_AREA( |
302 | gtk_builder_get_object(handle->builder, "id_drawing_area") | 315 | gtk_builder_get_object(handle->builder, "id_drawing_area") |
303 | ); | 316 | ); |
304 | 317 | ||
318 | pthread_create( | ||
319 | &(handle->video_tid), | ||
320 | NULL, | ||
321 | _ui_new_contact_video_thread, | ||
322 | handle | ||
323 | ); | ||
324 | |||
305 | g_signal_connect( | 325 | g_signal_connect( |
306 | handle->id_drawing_area, | 326 | handle->id_drawing_area, |
307 | "draw", | 327 | "draw", |
diff --git a/src/ui/new_contact.h b/src/ui/new_contact.h index 18bb042..4ab397a 100644 --- a/src/ui/new_contact.h +++ b/src/ui/new_contact.h | |||
@@ -41,6 +41,9 @@ typedef struct UI_NEW_CONTACT_Handle | |||
41 | GtkBuilder *builder; | 41 | GtkBuilder *builder; |
42 | GtkDialog *dialog; | 42 | GtkDialog *dialog; |
43 | 43 | ||
44 | GtkStack *preview_stack; | ||
45 | GtkWidget *fail_box; | ||
46 | |||
44 | GtkDrawingArea *id_drawing_area; | 47 | GtkDrawingArea *id_drawing_area; |
45 | GtkEntry *id_entry; | 48 | GtkEntry *id_entry; |
46 | 49 | ||