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.c24
1 files changed, 22 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:
150static void 150static 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",