aboutsummaryrefslogtreecommitdiff
path: root/src/ui/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/settings.c')
-rw-r--r--src/ui/settings.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/ui/settings.c b/src/ui/settings.c
index 25514eb..6589778 100644
--- a/src/ui/settings.c
+++ b/src/ui/settings.c
@@ -36,6 +36,8 @@ handle_general_switch_state(UNUSED GtkSwitch *widget,
36 gboolean state, 36 gboolean state,
37 gpointer user_data) 37 gpointer user_data)
38{ 38{
39 g_assert(user_data);
40
39 gboolean *setting = (gboolean*) user_data; 41 gboolean *setting = (gboolean*) user_data;
40 *setting = state; 42 *setting = state;
41 return FALSE; 43 return FALSE;
@@ -46,6 +48,8 @@ _request_background_callback(GObject *source_object,
46 GAsyncResult *result, 48 GAsyncResult *result,
47 gpointer user_data) 49 gpointer user_data)
48{ 50{
51 g_assert((source_object) && (result) && (user_data));
52
49 XdpPortal *portal = XDP_PORTAL(source_object); 53 XdpPortal *portal = XDP_PORTAL(source_object);
50 MESSENGER_Request *request = (MESSENGER_Request*) user_data; 54 MESSENGER_Request *request = (MESSENGER_Request*) user_data;
51 55
@@ -82,6 +86,8 @@ handle_background_switch_state(GtkSwitch *widget,
82 gboolean state, 86 gboolean state,
83 gpointer user_data) 87 gpointer user_data)
84{ 88{
89 g_assert((widget) && (user_data));
90
85 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 91 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
86 92
87 gboolean *setting = (gboolean*) ( 93 gboolean *setting = (gboolean*) (
@@ -114,6 +120,8 @@ handle_inverted_switch_state(GtkSwitch *widget,
114 gboolean state, 120 gboolean state,
115 gpointer user_data) 121 gpointer user_data)
116{ 122{
123 g_assert((widget) && (user_data));
124
117 return handle_general_switch_state(widget, !state, user_data); 125 return handle_general_switch_state(widget, !state, user_data);
118} 126}
119 127
@@ -121,6 +129,8 @@ static void
121handle_general_combo_box_change(GtkComboBox *widget, 129handle_general_combo_box_change(GtkComboBox *widget,
122 gpointer user_data) 130 gpointer user_data)
123{ 131{
132 g_assert((widget) && (user_data));
133
124 gulong *delay = (gulong*) user_data; 134 gulong *delay = (gulong*) user_data;
125 GtkTreeModel *model = gtk_combo_box_get_model(widget); 135 GtkTreeModel *model = gtk_combo_box_get_model(widget);
126 136
@@ -134,6 +144,8 @@ _leave_group_iteration(UNUSED void *cls,
134 UNUSED struct GNUNET_CHAT_Handle *handle, 144 UNUSED struct GNUNET_CHAT_Handle *handle,
135 struct GNUNET_CHAT_Group *group) 145 struct GNUNET_CHAT_Group *group)
136{ 146{
147 g_assert(group);
148
137 GNUNET_CHAT_group_leave(group); 149 GNUNET_CHAT_group_leave(group);
138 return GNUNET_YES; 150 return GNUNET_YES;
139} 151}
@@ -143,6 +155,8 @@ _delete_contact_iteration(UNUSED void *cls,
143 UNUSED struct GNUNET_CHAT_Handle *handle, 155 UNUSED struct GNUNET_CHAT_Handle *handle,
144 struct GNUNET_CHAT_Contact *contact) 156 struct GNUNET_CHAT_Contact *contact)
145{ 157{
158 g_assert(contact);
159
146 GNUNET_CHAT_contact_delete(contact); 160 GNUNET_CHAT_contact_delete(contact);
147 return GNUNET_YES; 161 return GNUNET_YES;
148} 162}
@@ -151,6 +165,8 @@ static void
151handle_leave_chats_button_click(UNUSED GtkButton* button, 165handle_leave_chats_button_click(UNUSED GtkButton* button,
152 gpointer user_data) 166 gpointer user_data)
153{ 167{
168 g_assert(user_data);
169
154 MESSENGER_Application *app = (MESSENGER_Application*) user_data; 170 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
155 171
156 GNUNET_CHAT_iterate_groups( 172 GNUNET_CHAT_iterate_groups(
@@ -168,15 +184,19 @@ handle_leave_chats_button_click(UNUSED GtkButton* button,
168 184
169static void 185static void
170handle_dialog_destroy(UNUSED GtkWidget *window, 186handle_dialog_destroy(UNUSED GtkWidget *window,
171 gpointer user_data) 187 gpointer user_data)
172{ 188{
189 g_assert(user_data);
190
173 ui_settings_dialog_cleanup((UI_SETTINGS_Handle*) user_data); 191 ui_settings_dialog_cleanup((UI_SETTINGS_Handle*) user_data);
174} 192}
175 193
176static void 194static void
177_set_combobox_to_active_by_delay(GtkComboBox *widget, 195_set_combobox_to_active_by_delay(GtkComboBox *widget,
178 gulong delay) 196 gulong delay)
179{ 197{
198 g_assert(widget);
199
180 GtkTreeModel *model = gtk_combo_box_get_model(widget); 200 GtkTreeModel *model = gtk_combo_box_get_model(widget);
181 201
182 GtkTreeIter iter; 202 GtkTreeIter iter;
@@ -200,9 +220,11 @@ set_active:
200 220
201static enum GNUNET_GenericReturnValue 221static enum GNUNET_GenericReturnValue
202_count_blocked_contacts(void *cls, 222_count_blocked_contacts(void *cls,
203 struct GNUNET_CHAT_Handle *handle, 223 UNUSED struct GNUNET_CHAT_Handle *handle,
204 struct GNUNET_CHAT_Contact *contact) 224 struct GNUNET_CHAT_Contact *contact)
205{ 225{
226 g_assert((cls) && (contact));
227
206 guint *count = (guint*) cls; 228 guint *count = (guint*) cls;
207 229
208 if (GNUNET_YES == GNUNET_CHAT_contact_is_blocked(contact)) 230 if (GNUNET_YES == GNUNET_CHAT_contact_is_blocked(contact))
@@ -215,6 +237,8 @@ void
215ui_settings_dialog_init(MESSENGER_Application *app, 237ui_settings_dialog_init(MESSENGER_Application *app,
216 UI_SETTINGS_Handle *handle) 238 UI_SETTINGS_Handle *handle)
217{ 239{
240 g_assert((app) && (handle));
241
218 handle->builder = gtk_builder_new_from_resource( 242 handle->builder = gtk_builder_new_from_resource(
219 application_get_resource_path(app, "ui/settings.ui") 243 application_get_resource_path(app, "ui/settings.ui")
220 ); 244 );
@@ -472,6 +496,8 @@ ui_settings_dialog_init(MESSENGER_Application *app,
472void 496void
473ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle) 497ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle)
474{ 498{
499 g_assert(handle);
500
475 g_object_unref(handle->builder); 501 g_object_unref(handle->builder);
476 502
477 memset(handle, 0, sizeof(*handle)); 503 memset(handle, 0, sizeof(*handle));