messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

commit c3195ac1db60e615acd42ab5e213d7a5a6a35064
parent 106ece8407806a70e8327b15178668daae003fc2
Author: TheJackiMonster <thejackimonster@gmail.com>
Date:   Sat, 18 Dec 2021 15:41:15 +0100

Adapted UI to visualize problems with the camera connection

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>

Diffstat:
Mresources/ui/new_contact.ui | 53++++++++++++++++++++++++++++++++++++++++++++++++++---
Msrc/ui/new_contact.c | 24++++++++++++++++++++++--
Msrc/ui/new_contact.h | 3+++
3 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/resources/ui/new_contact.ui b/resources/ui/new_contact.ui @@ -77,10 +77,58 @@ Author: Tobias Frisch <property name="orientation">vertical</property> <property name="spacing">4</property> <child> - <object class="GtkDrawingArea" id="id_drawing_area"> - <property name="height-request">250</property> + <object class="GtkStack" id="preview_stack"> <property name="visible">True</property> <property name="can-focus">False</property> + <child> + <object class="GtkBox" id="fail_box"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="valign">center</property> + <property name="orientation">vertical</property> + <property name="spacing">8</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="pixel-size">64</property> + <property name="icon-name">action-unavailable-symbolic</property> + <property name="icon_size">3</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Connection to camera failed!</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="name">page_fail</property> + </packing> + </child> + <child> + <object class="GtkDrawingArea" id="id_drawing_area"> + <property name="height-request">250</property> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + <packing> + <property name="name">page_drawing</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> @@ -106,7 +154,6 @@ Author: Tobias Frisch <property name="width-request">250</property> <property name="visible">True</property> <property name="can-focus">True</property> - <property name="editable">False</property> </object> <packing> <property name="expand">False</property> diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c @@ -150,6 +150,8 @@ render_image: static void _disable_video_processing(UI_NEW_CONTACT_Handle *handle) { + gtk_stack_set_visible_child(handle->preview_stack, handle->fail_box); + if (!(handle->video)) return; @@ -269,6 +271,11 @@ _ui_new_contact_video_thread(void *args) TRUE ); + gtk_stack_set_visible_child( + handle->preview_stack, + GTK_WIDGET(handle->id_drawing_area) + ); + handle->idle_processing = g_idle_add(idle_video_processing, handle); return NULL; } @@ -280,8 +287,6 @@ ui_new_contact_dialog_init(MESSENGER_Application *app, handle->video = zbar_video_create(); handle->scanner = zbar_image_scanner_create(); - pthread_create(&(handle->video_tid), NULL, _ui_new_contact_video_thread, handle); - handle->builder = gtk_builder_new_from_file("resources/ui/new_contact.ui"); handle->dialog = GTK_DIALOG( @@ -298,10 +303,25 @@ ui_new_contact_dialog_init(MESSENGER_Application *app, GTK_WINDOW(app->ui.messenger.main_window) ); + handle->preview_stack = GTK_STACK( + gtk_builder_get_object(handle->builder, "preview_stack") + ); + + handle->fail_box = GTK_WIDGET( + gtk_builder_get_object(handle->builder, "fail_box") + ); + handle->id_drawing_area = GTK_DRAWING_AREA( gtk_builder_get_object(handle->builder, "id_drawing_area") ); + pthread_create( + &(handle->video_tid), + NULL, + _ui_new_contact_video_thread, + handle + ); + g_signal_connect( handle->id_drawing_area, "draw", diff --git a/src/ui/new_contact.h b/src/ui/new_contact.h @@ -41,6 +41,9 @@ typedef struct UI_NEW_CONTACT_Handle GtkBuilder *builder; GtkDialog *dialog; + GtkStack *preview_stack; + GtkWidget *fail_box; + GtkDrawingArea *id_drawing_area; GtkEntry *id_entry;