diff options
Diffstat (limited to 'src/ui/new_contact.c')
-rw-r--r-- | src/ui/new_contact.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c index 61eb121..8b73f89 100644 --- a/src/ui/new_contact.c +++ b/src/ui/new_contact.c | |||
@@ -33,6 +33,8 @@ static void | |||
33 | handle_cancel_button_click(UNUSED GtkButton *button, | 33 | handle_cancel_button_click(UNUSED GtkButton *button, |
34 | gpointer user_data) | 34 | gpointer user_data) |
35 | { | 35 | { |
36 | g_assert(user_data); | ||
37 | |||
36 | GtkDialog *dialog = GTK_DIALOG(user_data); | 38 | GtkDialog *dialog = GTK_DIALOG(user_data); |
37 | gtk_window_close(GTK_WINDOW(dialog)); | 39 | gtk_window_close(GTK_WINDOW(dialog)); |
38 | } | 40 | } |
@@ -41,6 +43,8 @@ static void | |||
41 | handle_confirm_button_click(UNUSED GtkButton *button, | 43 | handle_confirm_button_click(UNUSED GtkButton *button, |
42 | gpointer user_data) | 44 | gpointer user_data) |
43 | { | 45 | { |
46 | g_assert(user_data); | ||
47 | |||
44 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 48 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
45 | 49 | ||
46 | const gint id_length = gtk_entry_get_text_length(app->ui.new_contact.id_entry); | 50 | const gint id_length = gtk_entry_get_text_length(app->ui.new_contact.id_entry); |
@@ -72,6 +76,8 @@ static void | |||
72 | handle_dialog_destroy(UNUSED GtkWidget *window, | 76 | handle_dialog_destroy(UNUSED GtkWidget *window, |
73 | gpointer user_data) | 77 | gpointer user_data) |
74 | { | 78 | { |
79 | g_assert(user_data); | ||
80 | |||
75 | ui_new_contact_dialog_cleanup((UI_NEW_CONTACT_Handle*) user_data); | 81 | ui_new_contact_dialog_cleanup((UI_NEW_CONTACT_Handle*) user_data); |
76 | } | 82 | } |
77 | 83 | ||
@@ -79,6 +85,8 @@ static void | |||
79 | handle_camera_combo_box_change(GtkComboBox *widget, | 85 | handle_camera_combo_box_change(GtkComboBox *widget, |
80 | gpointer user_data) | 86 | gpointer user_data) |
81 | { | 87 | { |
88 | g_assert((widget) && (user_data)); | ||
89 | |||
82 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) user_data; | 90 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) user_data; |
83 | gchar *name = NULL; | 91 | gchar *name = NULL; |
84 | 92 | ||
@@ -116,7 +124,7 @@ static void | |||
116 | _disable_video_processing(UI_NEW_CONTACT_Handle *handle, | 124 | _disable_video_processing(UI_NEW_CONTACT_Handle *handle, |
117 | gboolean drop_pipeline) | 125 | gboolean drop_pipeline) |
118 | { | 126 | { |
119 | GNUNET_assert(handle); | 127 | g_assert(handle); |
120 | 128 | ||
121 | if (handle->preview_stack) | 129 | if (handle->preview_stack) |
122 | goto skip_stack; | 130 | goto skip_stack; |
@@ -138,6 +146,8 @@ msg_error_cb(UNUSED GstBus *bus, | |||
138 | GstMessage *msg, | 146 | GstMessage *msg, |
139 | gpointer data) | 147 | gpointer data) |
140 | { | 148 | { |
149 | g_assert((msg) && (data)); | ||
150 | |||
141 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; | 151 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; |
142 | 152 | ||
143 | GError* error; | 153 | GError* error; |
@@ -158,6 +168,8 @@ msg_eos_cb(UNUSED GstBus *bus, | |||
158 | UNUSED GstMessage *msg, | 168 | UNUSED GstMessage *msg, |
159 | gpointer data) | 169 | gpointer data) |
160 | { | 170 | { |
171 | g_assert(data); | ||
172 | |||
161 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; | 173 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; |
162 | 174 | ||
163 | if (GST_MESSAGE_SRC(msg) == GST_OBJECT(handle->pipeline)) | 175 | if (GST_MESSAGE_SRC(msg) == GST_OBJECT(handle->pipeline)) |
@@ -169,6 +181,8 @@ msg_state_changed_cb(UNUSED GstBus *bus, | |||
169 | GstMessage *msg, | 181 | GstMessage *msg, |
170 | gpointer data) | 182 | gpointer data) |
171 | { | 183 | { |
184 | g_assert((msg) && (data)); | ||
185 | |||
172 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; | 186 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; |
173 | 187 | ||
174 | GstState old_state, new_state, pending_state; | 188 | GstState old_state, new_state, pending_state; |
@@ -192,6 +206,8 @@ msg_barcode_cb(UNUSED GstBus *bus, | |||
192 | GstMessage *msg, | 206 | GstMessage *msg, |
193 | gpointer data) | 207 | gpointer data) |
194 | { | 208 | { |
209 | g_assert((msg) && (data)); | ||
210 | |||
195 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; | 211 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; |
196 | GstMessageType msg_type = GST_MESSAGE_TYPE(msg); | 212 | GstMessageType msg_type = GST_MESSAGE_TYPE(msg); |
197 | 213 | ||
@@ -217,6 +233,8 @@ msg_barcode_cb(UNUSED GstBus *bus, | |||
217 | static void | 233 | static void |
218 | _setup_gst_pipeline(UI_NEW_CONTACT_Handle *handle) | 234 | _setup_gst_pipeline(UI_NEW_CONTACT_Handle *handle) |
219 | { | 235 | { |
236 | g_assert(handle); | ||
237 | |||
220 | handle->pipeline = gst_parse_launch( | 238 | handle->pipeline = gst_parse_launch( |
221 | "pipewiresrc name=source ! videoconvert ! zbar name=scanner" | 239 | "pipewiresrc name=source ! videoconvert ! zbar name=scanner" |
222 | " ! videoconvert ! aspectratiocrop aspect-ratio=1/1" | 240 | " ! videoconvert ! aspectratiocrop aspect-ratio=1/1" |
@@ -281,6 +299,8 @@ _setup_gst_pipeline(UI_NEW_CONTACT_Handle *handle) | |||
281 | static void* | 299 | static void* |
282 | _ui_new_contact_video_thread(void *args) | 300 | _ui_new_contact_video_thread(void *args) |
283 | { | 301 | { |
302 | g_assert(args); | ||
303 | |||
284 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) args; | 304 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) args; |
285 | 305 | ||
286 | if (!(handle->pipeline)) | 306 | if (!(handle->pipeline)) |
@@ -301,6 +321,8 @@ static int | |||
301 | iterate_global(void *obj, | 321 | iterate_global(void *obj, |
302 | void *data) | 322 | void *data) |
303 | { | 323 | { |
324 | g_assert(data); | ||
325 | |||
304 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; | 326 | UI_NEW_CONTACT_Handle *handle = (UI_NEW_CONTACT_Handle*) data; |
305 | struct pw_properties *properties = (struct pw_properties*) obj; | 327 | struct pw_properties *properties = (struct pw_properties*) obj; |
306 | 328 | ||
@@ -356,6 +378,8 @@ _init_camera_pipeline(MESSENGER_Application *app, | |||
356 | UI_NEW_CONTACT_Handle *handle, | 378 | UI_NEW_CONTACT_Handle *handle, |
357 | gboolean access) | 379 | gboolean access) |
358 | { | 380 | { |
381 | g_assert((app) && (handle)); | ||
382 | |||
359 | handle->camera_count = 0; | 383 | handle->camera_count = 0; |
360 | 384 | ||
361 | if ((app->portal) && ((access) || xdp_portal_is_camera_present(app->portal))) | 385 | if ((app->portal) && ((access) || xdp_portal_is_camera_present(app->portal))) |
@@ -384,9 +408,11 @@ _init_camera_pipeline(MESSENGER_Application *app, | |||
384 | 408 | ||
385 | static void | 409 | static void |
386 | _request_camera_callback(GObject *source_object, | 410 | _request_camera_callback(GObject *source_object, |
387 | GAsyncResult *result, | 411 | GAsyncResult *result, |
388 | gpointer user_data) | 412 | gpointer user_data) |
389 | { | 413 | { |
414 | g_assert((source_object) && (result) && (user_data)); | ||
415 | |||
390 | XdpPortal *portal = (XdpPortal*) source_object; | 416 | XdpPortal *portal = (XdpPortal*) source_object; |
391 | MESSENGER_Request *request = (MESSENGER_Request*) user_data; | 417 | MESSENGER_Request *request = (MESSENGER_Request*) user_data; |
392 | 418 | ||
@@ -414,7 +440,7 @@ void | |||
414 | ui_new_contact_dialog_init(MESSENGER_Application *app, | 440 | ui_new_contact_dialog_init(MESSENGER_Application *app, |
415 | UI_NEW_CONTACT_Handle *handle) | 441 | UI_NEW_CONTACT_Handle *handle) |
416 | { | 442 | { |
417 | GNUNET_assert((app) && (handle)); | 443 | g_assert((app) && (handle)); |
418 | 444 | ||
419 | handle->camera_count = 0; | 445 | handle->camera_count = 0; |
420 | 446 | ||
@@ -545,7 +571,7 @@ ui_new_contact_dialog_init(MESSENGER_Application *app, | |||
545 | void | 571 | void |
546 | ui_new_contact_dialog_cleanup(UI_NEW_CONTACT_Handle *handle) | 572 | ui_new_contact_dialog_cleanup(UI_NEW_CONTACT_Handle *handle) |
547 | { | 573 | { |
548 | GNUNET_assert(handle); | 574 | g_assert(handle); |
549 | 575 | ||
550 | pthread_join(handle->video_tid, NULL); | 576 | pthread_join(handle->video_tid, NULL); |
551 | 577 | ||