aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacki <jacki@thejackimonster.de>2024-01-19 05:30:29 +0100
committerJacki <jacki@thejackimonster.de>2024-01-19 05:30:29 +0100
commit03f9d1d46592248c3091221587a5706adee5087b (patch)
tree12c3960be0cdb156d7888e5899605e1503cfe3c1
parent26cdd5581daeed962c4a481749b42dd87c310a45 (diff)
downloadmessenger-gtk-03f9d1d46592248c3091221587a5706adee5087b.tar.gz
messenger-gtk-03f9d1d46592248c3091221587a5706adee5087b.zip
Adjust revealer to be dynamic
Signed-off-by: Jacki <jacki@thejackimonster.de>
-rw-r--r--resources/ui/new_contact.ui5
-rw-r--r--src/ui/new_contact.c15
-rw-r--r--src/ui/new_contact.h3
3 files changed, 18 insertions, 5 deletions
diff --git a/resources/ui/new_contact.ui b/resources/ui/new_contact.ui
index 36e309a..b182919 100644
--- a/resources/ui/new_contact.ui
+++ b/resources/ui/new_contact.ui
@@ -90,16 +90,15 @@ Author: Tobias Frisch
90 <property name="orientation">vertical</property> 90 <property name="orientation">vertical</property>
91 <property name="spacing">4</property> 91 <property name="spacing">4</property>
92 <child> 92 <child>
93 <object class="GtkRevealer"> 93 <object class="GtkRevealer" id="camera_combo_box_revealer">
94 <property name="visible">True</property> 94 <property name="visible">True</property>
95 <property name="can-focus">False</property> 95 <property name="can-focus">False</property>
96 <property name="margin-start">8</property> 96 <property name="margin-start">8</property>
97 <property name="margin-end">8</property> 97 <property name="margin-end">8</property>
98 <property name="margin-bottom">8</property> 98 <property name="margin-bottom">8</property>
99 <property name="transition-type">none</property>
100 <property name="reveal-child">True</property>
101 <child> 99 <child>
102 <object class="GtkComboBox" id="camera_combo_box"> 100 <object class="GtkComboBox" id="camera_combo_box">
101 <property name="width-request">250</property>
103 <property name="visible">True</property> 102 <property name="visible">True</property>
104 <property name="can-focus">False</property> 103 <property name="can-focus">False</property>
105 <property name="halign">center</property> 104 <property name="halign">center</property>
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c
index 1b79cdc..8267fab 100644
--- a/src/ui/new_contact.c
+++ b/src/ui/new_contact.c
@@ -339,6 +339,7 @@ iterate_global(void *obj,
339 -1 339 -1
340 ); 340 );
341 341
342 handle->camera_count++;
342 return 0; 343 return 0;
343} 344}
344 345
@@ -347,6 +348,8 @@ _init_camera_pipeline(MESSENGER_Application *app,
347 UI_NEW_CONTACT_Handle *handle, 348 UI_NEW_CONTACT_Handle *handle,
348 gboolean access) 349 gboolean access)
349{ 350{
351 handle->camera_count = 0;
352
350 if ((app->portal) && ((access) || xdp_portal_is_camera_present(app->portal))) 353 if ((app->portal) && ((access) || xdp_portal_is_camera_present(app->portal)))
351 { 354 {
352 app->pw.pending = pw_core_sync(app->pw.core, 0, 0); 355 app->pw.pending = pw_core_sync(app->pw.core, 0, 0);
@@ -354,11 +357,15 @@ _init_camera_pipeline(MESSENGER_Application *app,
354 pw_main_loop_run(app->pw.main_loop); 357 pw_main_loop_run(app->pw.main_loop);
355 pw_map_for_each(&(app->pw.globals), iterate_global, handle); 358 pw_map_for_each(&(app->pw.globals), iterate_global, handle);
356 359
357 GtkTreeIter iter; 360 if (handle->camera_count)
358 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(handle->camera_list_store), &iter))
359 gtk_combo_box_set_active(handle->camera_combo_box, 0); 361 gtk_combo_box_set_active(handle->camera_combo_box, 0);
360 } 362 }
361 363
364 gtk_revealer_set_reveal_child(
365 handle->camera_combo_box_revealer,
366 handle->camera_count > 1
367 );
368
362 pthread_create( 369 pthread_create(
363 &(handle->video_tid), 370 &(handle->video_tid),
364 NULL, 371 NULL,
@@ -428,6 +435,10 @@ ui_new_contact_dialog_init(MESSENGER_Application *app,
428 GTK_WINDOW(app->ui.messenger.main_window) 435 GTK_WINDOW(app->ui.messenger.main_window)
429 ); 436 );
430 437
438 handle->camera_combo_box_revealer = GTK_REVEALER(
439 gtk_builder_get_object(handle->builder, "camera_combo_box_revealer")
440 );
441
431 handle->camera_combo_box = GTK_COMBO_BOX( 442 handle->camera_combo_box = GTK_COMBO_BOX(
432 gtk_builder_get_object(handle->builder, "camera_combo_box") 443 gtk_builder_get_object(handle->builder, "camera_combo_box")
433 ); 444 );
diff --git a/src/ui/new_contact.h b/src/ui/new_contact.h
index 7d969cd..3896f56 100644
--- a/src/ui/new_contact.h
+++ b/src/ui/new_contact.h
@@ -34,6 +34,8 @@
34 34
35typedef struct UI_NEW_CONTACT_Handle 35typedef struct UI_NEW_CONTACT_Handle
36{ 36{
37 guint camera_count;
38
37 GstElement *pipeline; 39 GstElement *pipeline;
38 GstElement *source; 40 GstElement *source;
39 GstElement *scanner; 41 GstElement *scanner;
@@ -42,6 +44,7 @@ typedef struct UI_NEW_CONTACT_Handle
42 GtkBuilder *builder; 44 GtkBuilder *builder;
43 GtkDialog *dialog; 45 GtkDialog *dialog;
44 46
47 GtkRevealer *camera_combo_box_revealer;
45 GtkComboBox *camera_combo_box; 48 GtkComboBox *camera_combo_box;
46 GtkListStore *camera_list_store; 49 GtkListStore *camera_list_store;
47 50