aboutsummaryrefslogtreecommitdiff
path: root/src/ui/messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/messenger.c')
-rw-r--r--src/ui/messenger.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
index fe47fcd..84c7ea3 100644
--- a/src/ui/messenger.c
+++ b/src/ui/messenger.c
@@ -42,6 +42,8 @@
42static gboolean 42static gboolean
43_flap_user_details_reveal_switch(gpointer user_data) 43_flap_user_details_reveal_switch(gpointer user_data)
44{ 44{
45 g_assert(user_data);
46
45 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; 47 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data;
46 HdyFlap* flap = handle->flap_user_details; 48 HdyFlap* flap = handle->flap_user_details;
47 49
@@ -60,6 +62,8 @@ static void
60handle_user_details_via_button_click(UNUSED GtkButton* button, 62handle_user_details_via_button_click(UNUSED GtkButton* button,
61 gpointer user_data) 63 gpointer user_data)
62{ 64{
65 g_assert(user_data);
66
63 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; 67 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data;
64 68
65 gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_search), FALSE); 69 gtk_widget_set_sensitive(GTK_WIDGET(handle->chats_search), FALSE);
@@ -74,6 +78,8 @@ static void
74handle_lobby_button_click(UNUSED GtkButton* button, 78handle_lobby_button_click(UNUSED GtkButton* button,
75 gpointer user_data) 79 gpointer user_data)
76{ 80{
81 g_assert(user_data);
82
77 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 83 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
78 84
79 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 85 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -87,6 +93,8 @@ static void
87_switch_details_revealer_visibility(UI_MESSENGER_Handle *handle, 93_switch_details_revealer_visibility(UI_MESSENGER_Handle *handle,
88 gboolean state) 94 gboolean state)
89{ 95{
96 g_assert(handle);
97
90 GtkRevealer *revealer = handle->account_details_revealer; 98 GtkRevealer *revealer = handle->account_details_revealer;
91 GtkImage *symbol = handle->account_details_symbol; 99 GtkImage *symbol = handle->account_details_symbol;
92 100
@@ -104,6 +112,8 @@ static void
104handle_account_details_button_click(UNUSED GtkButton* button, 112handle_account_details_button_click(UNUSED GtkButton* button,
105 gpointer user_data) 113 gpointer user_data)
106{ 114{
115 g_assert(user_data);
116
107 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data; 117 UI_MESSENGER_Handle *handle = (UI_MESSENGER_Handle*) user_data;
108 118
109 GtkRevealer *revealer = handle->account_details_revealer; 119 GtkRevealer *revealer = handle->account_details_revealer;
@@ -118,6 +128,8 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
118 GtkListBoxRow* row, 128 GtkListBoxRow* row,
119 gpointer user_data) 129 gpointer user_data)
120{ 130{
131 g_assert((row) && (user_data));
132
121 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 133 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
122 134
123 if (row == app->ui.messenger.add_account_listbox_row) 135 if (row == app->ui.messenger.add_account_listbox_row)
@@ -155,6 +167,8 @@ static void
155handle_new_contact_button_click(UNUSED GtkButton* button, 167handle_new_contact_button_click(UNUSED GtkButton* button,
156 gpointer user_data) 168 gpointer user_data)
157{ 169{
170 g_assert(user_data);
171
158 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 172 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
159 173
160 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 174 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -166,6 +180,8 @@ static void
166handle_new_group_button_click(UNUSED GtkButton* button, 180handle_new_group_button_click(UNUSED GtkButton* button,
167 gpointer user_data) 181 gpointer user_data)
168{ 182{
183 g_assert(user_data);
184
169 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 185 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
170 186
171 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 187 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -177,6 +193,8 @@ static void
177handle_new_platform_button_click(UNUSED GtkButton* button, 193handle_new_platform_button_click(UNUSED GtkButton* button,
178 gpointer user_data) 194 gpointer user_data)
179{ 195{
196 g_assert(user_data);
197
180 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 198 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
181 199
182 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 200 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -188,6 +206,8 @@ static void
188handle_contacts_button_click(UNUSED GtkButton* button, 206handle_contacts_button_click(UNUSED GtkButton* button,
189 gpointer user_data) 207 gpointer user_data)
190{ 208{
209 g_assert(user_data);
210
191 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 211 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
192 212
193 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 213 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -199,6 +219,8 @@ static void
199handle_settings_button_click(UNUSED GtkButton* button, 219handle_settings_button_click(UNUSED GtkButton* button,
200 gpointer user_data) 220 gpointer user_data)
201{ 221{
222 g_assert(user_data);
223
202 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 224 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
203 225
204 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 226 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -210,6 +232,8 @@ static void
210handle_about_button_click(UNUSED GtkButton* button, 232handle_about_button_click(UNUSED GtkButton* button,
211 gpointer user_data) 233 gpointer user_data)
212{ 234{
235 g_assert(user_data);
236
213 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 237 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
214 238
215 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE); 239 hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
@@ -222,6 +246,8 @@ handle_chats_listbox_row_activated(UNUSED GtkListBox* listbox,
222 GtkListBoxRow* row, 246 GtkListBoxRow* row,
223 gpointer user_data) 247 gpointer user_data)
224{ 248{
249 g_assert((row) && (user_data));
250
225 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 251 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
226 252
227 if (!gtk_list_box_row_get_selectable(row)) 253 if (!gtk_list_box_row_get_selectable(row))
@@ -253,10 +279,11 @@ handle_chats_listbox_sort_func(GtkListBoxRow* row0,
253 GtkListBoxRow* row1, 279 GtkListBoxRow* row1,
254 gpointer user_data) 280 gpointer user_data)
255{ 281{
282 g_assert((row0) && (row1) && (user_data));
283
256 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 284 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
257 285
258 if ((!row0) || (!row1) || 286 if ((!gtk_list_box_row_get_selectable(row0)) ||
259 (!gtk_list_box_row_get_selectable(row0)) ||
260 (!gtk_list_box_row_get_selectable(row1))) 287 (!gtk_list_box_row_get_selectable(row1)))
261 return 0; 288 return 0;
262 289
@@ -286,9 +313,11 @@ static gboolean
286handle_chats_listbox_filter_func(GtkListBoxRow *row, 313handle_chats_listbox_filter_func(GtkListBoxRow *row,
287 gpointer user_data) 314 gpointer user_data)
288{ 315{
316 g_assert((row) && (user_data));
317
289 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 318 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
290 319
291 if ((!row) || (!gtk_list_box_row_get_selectable(row)) || 320 if ((!gtk_list_box_row_get_selectable(row)) ||
292 (gtk_list_box_row_is_selected(row))) 321 (gtk_list_box_row_is_selected(row)))
293 return TRUE; 322 return TRUE;
294 323
@@ -318,6 +347,8 @@ static void
318handle_chats_search_changed(UNUSED GtkSearchEntry *search, 347handle_chats_search_changed(UNUSED GtkSearchEntry *search,
319 gpointer user_data) 348 gpointer user_data)
320{ 349{
350 g_assert(user_data);
351
321 GtkListBox *listbox = GTK_LIST_BOX(user_data); 352 GtkListBox *listbox = GTK_LIST_BOX(user_data);
322 353
323 gtk_list_box_invalidate_filter(listbox); 354 gtk_list_box_invalidate_filter(listbox);
@@ -327,6 +358,8 @@ static void
327handle_main_window_destroy(UNUSED GtkWidget *window, 358handle_main_window_destroy(UNUSED GtkWidget *window,
328 gpointer user_data) 359 gpointer user_data)
329{ 360{
361 g_assert(user_data);
362
330 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 363 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
331 364
332 if (app->parent) 365 if (app->parent)
@@ -344,6 +377,8 @@ void
344ui_messenger_init(MESSENGER_Application *app, 377ui_messenger_init(MESSENGER_Application *app,
345 UI_MESSENGER_Handle *handle) 378 UI_MESSENGER_Handle *handle)
346{ 379{
380 g_assert((app) && (handle));
381
347 memset(handle, 0, sizeof(*handle)); 382 memset(handle, 0, sizeof(*handle));
348 handle->app = app; 383 handle->app = app;
349 384
@@ -635,6 +670,8 @@ _messenger_iterate_accounts(void *cls,
635 const struct GNUNET_CHAT_Handle *handle, 670 const struct GNUNET_CHAT_Handle *handle,
636 struct GNUNET_CHAT_Account *account) 671 struct GNUNET_CHAT_Account *account)
637{ 672{
673 g_assert((cls) && (handle) && (account));
674
638 MESSENGER_Application *app = (MESSENGER_Application*) cls; 675 MESSENGER_Application *app = (MESSENGER_Application*) cls;
639 UI_MESSENGER_Handle *ui = &(app->ui.messenger); 676 UI_MESSENGER_Handle *ui = &(app->ui.messenger);
640 677
@@ -663,10 +700,12 @@ static void
663_clear_accounts_listbox(GtkWidget *widget, 700_clear_accounts_listbox(GtkWidget *widget,
664 gpointer data) 701 gpointer data)
665{ 702{
703 g_assert((widget) && (data));
704
666 GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget); 705 GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget);
667 GtkListBox *listbox = GTK_LIST_BOX(data); 706 GtkListBox *listbox = GTK_LIST_BOX(data);
668 707
669 if ((!row) || (!listbox) || (!gtk_list_box_row_get_selectable(row))) 708 if (!gtk_list_box_row_get_selectable(row))
670 return; 709 return;
671 710
672 gtk_container_remove( 711 gtk_container_remove(
@@ -679,6 +718,8 @@ void
679ui_messenger_refresh(MESSENGER_Application *app, 718ui_messenger_refresh(MESSENGER_Application *app,
680 UI_MESSENGER_Handle *handle) 719 UI_MESSENGER_Handle *handle)
681{ 720{
721 g_assert((app) && (handle));
722
682 if (!(handle->accounts_listbox)) 723 if (!(handle->accounts_listbox))
683 return; 724 return;
684 725
@@ -699,6 +740,8 @@ gboolean
699ui_messenger_is_context_active(UI_MESSENGER_Handle *handle, 740ui_messenger_is_context_active(UI_MESSENGER_Handle *handle,
700 struct GNUNET_CHAT_Context *context) 741 struct GNUNET_CHAT_Context *context)
701{ 742{
743 g_assert((handle) && (context));
744
702 if (!gtk_window_is_active(GTK_WINDOW(handle->main_window))) 745 if (!gtk_window_is_active(GTK_WINDOW(handle->main_window)))
703 return FALSE; 746 return FALSE;
704 747
@@ -720,6 +763,8 @@ ui_messenger_is_context_active(UI_MESSENGER_Handle *handle,
720void 763void
721ui_messenger_cleanup(UI_MESSENGER_Handle *handle) 764ui_messenger_cleanup(UI_MESSENGER_Handle *handle)
722{ 765{
766 g_assert(handle);
767
723 g_object_unref(handle->builder); 768 g_object_unref(handle->builder);
724 769
725 if (handle->chat_entries) 770 if (handle->chat_entries)