Line |
Branch |
Exec |
Source |
1 |
|
|
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 |
|
|
/* cc-wwan-apn-dialog.c |
3 |
|
|
* |
4 |
|
|
* Copyright 2019 Purism SPC |
5 |
|
|
* |
6 |
|
|
* This program is free software: you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 |
|
|
* |
19 |
|
|
* Author(s): |
20 |
|
|
* Mohammed Sadiq <sadiq@sadiqpk.org> |
21 |
|
|
* |
22 |
|
|
* SPDX-License-Identifier: GPL-3.0-or-later |
23 |
|
|
*/ |
24 |
|
|
|
25 |
|
|
#undef G_LOG_DOMAIN |
26 |
|
|
#define G_LOG_DOMAIN "cc-wwan-apn-dialog" |
27 |
|
|
|
28 |
|
|
#include <config.h> |
29 |
|
|
#include <glib/gi18n.h> |
30 |
|
|
#include <libmm-glib.h> |
31 |
|
|
|
32 |
|
|
#include "cc-wwan-device.h" |
33 |
|
|
#include "cc-wwan-data.h" |
34 |
|
|
#include "cc-wwan-apn-dialog.h" |
35 |
|
|
#include "cc-wwan-resources.h" |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* @short_description: Dialog to manage Internet Access Points |
39 |
|
|
*/ |
40 |
|
|
|
41 |
|
|
struct _CcWwanApnDialog |
42 |
|
|
{ |
43 |
|
|
GtkDialog parent_instance; |
44 |
|
|
|
45 |
|
|
GtkButton *add_button; |
46 |
|
|
GtkButton *back_button; |
47 |
|
|
GtkButton *save_button; |
48 |
|
|
GtkEntry *apn_entry; |
49 |
|
|
GtkEntry *name_entry; |
50 |
|
|
GtkEntry *password_entry; |
51 |
|
|
GtkEntry *username_entry; |
52 |
|
|
GtkGrid *apn_edit_view; |
53 |
|
|
GtkListBox *apn_list; |
54 |
|
|
GtkCheckButton *apn_radio_button; |
55 |
|
|
GtkScrolledWindow *apn_list_view; |
56 |
|
|
GtkStack *apn_settings_stack; |
57 |
|
|
|
58 |
|
|
CcWwanData *wwan_data; |
59 |
|
|
CcWwanDataApn *apn_to_save; /* The APN currently being edited */ |
60 |
|
|
CcWwanDevice *device; |
61 |
|
|
|
62 |
|
|
gboolean enable_data; |
63 |
|
|
gboolean enable_roaming; |
64 |
|
|
}; |
65 |
|
|
|
66 |
|
✗ |
G_DEFINE_TYPE (CcWwanApnDialog, cc_wwan_apn_dialog, GTK_TYPE_DIALOG) |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
enum { |
70 |
|
|
PROP_0, |
71 |
|
|
PROP_DEVICE, |
72 |
|
|
N_PROPS |
73 |
|
|
}; |
74 |
|
|
|
75 |
|
|
static GParamSpec *properties[N_PROPS]; |
76 |
|
|
|
77 |
|
|
#define CC_TYPE_WWAN_APN_ROW (cc_wwan_apn_row_get_type()) |
78 |
|
✗ |
G_DECLARE_FINAL_TYPE (CcWwanApnRow, cc_wwan_apn_row, CC, WWAN_APN_ROW, GtkListBoxRow) |
79 |
|
|
|
80 |
|
|
struct _CcWwanApnRow |
81 |
|
|
{ |
82 |
|
|
GtkListBoxRow parent_instance; |
83 |
|
|
GtkCheckButton *radio_button; |
84 |
|
|
CcWwanDataApn *apn; |
85 |
|
|
}; |
86 |
|
|
|
87 |
|
✗ |
G_DEFINE_TYPE (CcWwanApnRow, cc_wwan_apn_row, GTK_TYPE_LIST_BOX_ROW) |
88 |
|
|
|
89 |
|
|
static void |
90 |
|
✗ |
cc_wwan_apn_row_finalize (GObject *object) |
91 |
|
|
{ |
92 |
|
✗ |
CcWwanApnRow *row = (CcWwanApnRow *)object; |
93 |
|
|
|
94 |
|
✗ |
g_clear_object (&row->apn); |
95 |
|
|
|
96 |
|
✗ |
G_OBJECT_CLASS (cc_wwan_apn_row_parent_class)->finalize (object); |
97 |
|
✗ |
} |
98 |
|
|
|
99 |
|
|
static void |
100 |
|
✗ |
cc_wwan_apn_row_class_init (CcWwanApnRowClass *klass) |
101 |
|
|
{ |
102 |
|
✗ |
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
103 |
|
|
|
104 |
|
✗ |
object_class->finalize = cc_wwan_apn_row_finalize; |
105 |
|
✗ |
} |
106 |
|
|
|
107 |
|
|
static void |
108 |
|
✗ |
cc_wwan_apn_row_init (CcWwanApnRow *row) |
109 |
|
|
{ |
110 |
|
✗ |
} |
111 |
|
|
|
112 |
|
|
static void |
113 |
|
✗ |
cc_wwan_apn_back_clicked_cb (CcWwanApnDialog *self) |
114 |
|
|
{ |
115 |
|
|
GtkWidget *view; |
116 |
|
|
|
117 |
|
✗ |
view = gtk_stack_get_visible_child (self->apn_settings_stack); |
118 |
|
|
|
119 |
|
✗ |
if (view == GTK_WIDGET (self->apn_edit_view)) |
120 |
|
|
{ |
121 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->save_button), FALSE); |
122 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->add_button), TRUE); |
123 |
|
✗ |
gtk_stack_set_visible_child (self->apn_settings_stack, |
124 |
|
✗ |
GTK_WIDGET (self->apn_list_view)); |
125 |
|
|
} |
126 |
|
|
else |
127 |
|
|
{ |
128 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self), FALSE); |
129 |
|
|
} |
130 |
|
✗ |
} |
131 |
|
|
|
132 |
|
|
static void |
133 |
|
✗ |
cc_wwan_apn_add_clicked_cb (CcWwanApnDialog *self) |
134 |
|
|
{ |
135 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->name_entry), ""); |
136 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->apn_entry), ""); |
137 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->username_entry), ""); |
138 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->password_entry), ""); |
139 |
|
|
|
140 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->add_button), FALSE); |
141 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->save_button), TRUE); |
142 |
|
✗ |
self->apn_to_save = NULL; |
143 |
|
✗ |
gtk_stack_set_visible_child (self->apn_settings_stack, |
144 |
|
✗ |
GTK_WIDGET (self->apn_edit_view)); |
145 |
|
✗ |
} |
146 |
|
|
|
147 |
|
|
static void |
148 |
|
✗ |
cc_wwan_apn_save_clicked_cb (CcWwanApnDialog *self) |
149 |
|
|
{ |
150 |
|
|
const gchar *name, *apn_name; |
151 |
|
|
CcWwanDataApn *apn; |
152 |
|
|
|
153 |
|
✗ |
apn = self->apn_to_save; |
154 |
|
✗ |
self->apn_to_save = NULL; |
155 |
|
|
|
156 |
|
✗ |
name = gtk_editable_get_text (GTK_EDITABLE (self->name_entry)); |
157 |
|
✗ |
apn_name = gtk_editable_get_text (GTK_EDITABLE (self->apn_entry)); |
158 |
|
|
|
159 |
|
✗ |
if (!apn) |
160 |
|
✗ |
apn = cc_wwan_data_apn_new (); |
161 |
|
|
|
162 |
|
✗ |
cc_wwan_data_apn_set_name (apn, name); |
163 |
|
✗ |
cc_wwan_data_apn_set_apn (apn, apn_name); |
164 |
|
✗ |
cc_wwan_data_apn_set_username (apn, gtk_editable_get_text (GTK_EDITABLE (self->username_entry))); |
165 |
|
✗ |
cc_wwan_data_apn_set_password (apn, gtk_editable_get_text (GTK_EDITABLE (self->password_entry))); |
166 |
|
|
|
167 |
|
✗ |
cc_wwan_data_save_apn (self->wwan_data, apn, NULL, NULL, NULL); |
168 |
|
|
|
169 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->save_button), FALSE); |
170 |
|
✗ |
gtk_stack_set_visible_child (self->apn_settings_stack, |
171 |
|
✗ |
GTK_WIDGET (self->apn_list_view)); |
172 |
|
✗ |
} |
173 |
|
|
|
174 |
|
|
static void |
175 |
|
✗ |
cc_wwan_apn_entry_changed_cb (CcWwanApnDialog *self) |
176 |
|
|
{ |
177 |
|
|
GtkWidget *widget; |
178 |
|
|
const gchar *str; |
179 |
|
|
gboolean valid_name, valid_apn; |
180 |
|
|
|
181 |
|
✗ |
widget = GTK_WIDGET (self->name_entry); |
182 |
|
✗ |
str = gtk_editable_get_text (GTK_EDITABLE (self->name_entry)); |
183 |
|
✗ |
valid_name = str && *str; |
184 |
|
|
|
185 |
|
✗ |
if (valid_name) |
186 |
|
✗ |
gtk_widget_remove_css_class (widget, "error"); |
187 |
|
|
else |
188 |
|
✗ |
gtk_widget_add_css_class (widget, "error"); |
189 |
|
|
|
190 |
|
✗ |
widget = GTK_WIDGET (self->apn_entry); |
191 |
|
✗ |
str = gtk_editable_get_text (GTK_EDITABLE (self->apn_entry)); |
192 |
|
✗ |
valid_apn = str && *str; |
193 |
|
|
|
194 |
|
✗ |
if (valid_apn) |
195 |
|
✗ |
gtk_widget_remove_css_class (widget, "error"); |
196 |
|
|
else |
197 |
|
✗ |
gtk_widget_add_css_class (widget, "error"); |
198 |
|
|
|
199 |
|
✗ |
gtk_widget_set_sensitive (GTK_WIDGET (self->save_button), valid_name && valid_apn); |
200 |
|
✗ |
} |
201 |
|
|
|
202 |
|
|
static void |
203 |
|
✗ |
cc_wwan_apn_activated_cb (CcWwanApnDialog *self, |
204 |
|
|
CcWwanApnRow *row) |
205 |
|
|
{ |
206 |
|
✗ |
gtk_check_button_set_active (GTK_CHECK_BUTTON (row->radio_button), TRUE); |
207 |
|
✗ |
} |
208 |
|
|
|
209 |
|
|
static void |
210 |
|
✗ |
cc_wwan_apn_changed_cb (CcWwanApnDialog *self, |
211 |
|
|
GtkWidget *widget) |
212 |
|
|
{ |
213 |
|
|
CcWwanApnRow *row; |
214 |
|
|
|
215 |
|
✗ |
if (!gtk_check_button_get_active (GTK_CHECK_BUTTON (widget))) |
216 |
|
✗ |
return; |
217 |
|
|
|
218 |
|
✗ |
widget = gtk_widget_get_ancestor (widget, CC_TYPE_WWAN_APN_ROW); |
219 |
|
✗ |
row = CC_WWAN_APN_ROW (widget); |
220 |
|
|
|
221 |
|
✗ |
if (cc_wwan_data_set_default_apn (self->wwan_data, row->apn)) |
222 |
|
✗ |
cc_wwan_data_save_settings (self->wwan_data, NULL, NULL, NULL); |
223 |
|
|
} |
224 |
|
|
|
225 |
|
|
static void |
226 |
|
✗ |
cc_wwan_apn_edit_clicked_cb (CcWwanApnDialog *self, |
227 |
|
|
GtkButton *button) |
228 |
|
|
{ |
229 |
|
|
CcWwanDataApn *apn; |
230 |
|
|
CcWwanApnRow *row; |
231 |
|
|
GtkWidget *widget; |
232 |
|
|
|
233 |
|
✗ |
widget = gtk_widget_get_ancestor (GTK_WIDGET (button), CC_TYPE_WWAN_APN_ROW); |
234 |
|
✗ |
row = CC_WWAN_APN_ROW (widget); |
235 |
|
✗ |
apn = row->apn; |
236 |
|
✗ |
self->apn_to_save = apn; |
237 |
|
|
|
238 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->save_button), TRUE); |
239 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->add_button), FALSE); |
240 |
|
|
|
241 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->name_entry), cc_wwan_data_apn_get_name (apn)); |
242 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->apn_entry), cc_wwan_data_apn_get_apn (apn)); |
243 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->username_entry), cc_wwan_data_apn_get_username (apn)); |
244 |
|
✗ |
gtk_editable_set_text (GTK_EDITABLE (self->password_entry), cc_wwan_data_apn_get_password (apn)); |
245 |
|
|
|
246 |
|
✗ |
gtk_stack_set_visible_child (self->apn_settings_stack, |
247 |
|
✗ |
GTK_WIDGET (self->apn_edit_view)); |
248 |
|
✗ |
} |
249 |
|
|
|
250 |
|
|
static GtkWidget * |
251 |
|
✗ |
cc_wwan_apn_dialog_row_new (CcWwanDataApn *apn, |
252 |
|
|
CcWwanApnDialog *self) |
253 |
|
|
{ |
254 |
|
|
CcWwanApnRow *row; |
255 |
|
|
GtkWidget *grid, *name_label, *apn_label, *radio, *edit_button; |
256 |
|
|
|
257 |
|
✗ |
row = g_object_new (CC_TYPE_WWAN_APN_ROW, NULL); |
258 |
|
|
|
259 |
|
✗ |
grid = g_object_new (GTK_TYPE_GRID, |
260 |
|
|
"margin-top", 6, |
261 |
|
|
"margin-bottom", 6, |
262 |
|
|
"margin-start", 6, |
263 |
|
|
"margin-end", 6, |
264 |
|
|
NULL); |
265 |
|
|
|
266 |
|
✗ |
radio = gtk_check_button_new (); |
267 |
|
✗ |
row->radio_button = GTK_CHECK_BUTTON (radio); |
268 |
|
✗ |
gtk_check_button_set_group (row->radio_button, self->apn_radio_button); |
269 |
|
✗ |
gtk_widget_set_margin_end (radio, 12); |
270 |
|
✗ |
gtk_grid_attach (GTK_GRID (grid), radio, 0, 0, 1, 2); |
271 |
|
✗ |
row->apn = g_object_ref (apn); |
272 |
|
|
|
273 |
|
✗ |
if (cc_wwan_data_get_default_apn (self->wwan_data) == apn) |
274 |
|
✗ |
gtk_check_button_set_active (GTK_CHECK_BUTTON (radio), TRUE); |
275 |
|
✗ |
g_signal_connect_object (radio, "toggled", |
276 |
|
|
G_CALLBACK (cc_wwan_apn_changed_cb), |
277 |
|
|
self, G_CONNECT_SWAPPED); |
278 |
|
|
|
279 |
|
✗ |
name_label = gtk_label_new (cc_wwan_data_apn_get_name (apn)); |
280 |
|
✗ |
gtk_label_set_ellipsize (GTK_LABEL (name_label), PANGO_ELLIPSIZE_END); |
281 |
|
✗ |
gtk_widget_set_halign (name_label, GTK_ALIGN_START); |
282 |
|
✗ |
gtk_widget_set_hexpand (name_label, TRUE); |
283 |
|
✗ |
gtk_grid_attach (GTK_GRID (grid), name_label, 1, 0, 1, 1); |
284 |
|
|
|
285 |
|
✗ |
apn_label = gtk_label_new (cc_wwan_data_apn_get_apn (apn)); |
286 |
|
✗ |
gtk_label_set_ellipsize (GTK_LABEL (apn_label), PANGO_ELLIPSIZE_END); |
287 |
|
✗ |
gtk_widget_set_halign (apn_label, GTK_ALIGN_START); |
288 |
|
✗ |
gtk_widget_add_css_class (apn_label, "dim-label"); |
289 |
|
✗ |
gtk_grid_attach (GTK_GRID (grid), apn_label, 1, 1, 1, 1); |
290 |
|
|
|
291 |
|
✗ |
edit_button = gtk_button_new_from_icon_name ("emblem-system-symbolic"); |
292 |
|
✗ |
gtk_accessible_update_property (GTK_ACCESSIBLE (edit_button), |
293 |
|
|
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Edit"), |
294 |
|
|
-1); |
295 |
|
✗ |
g_signal_connect_object (edit_button, "clicked", |
296 |
|
|
G_CALLBACK (cc_wwan_apn_edit_clicked_cb), |
297 |
|
|
self, G_CONNECT_SWAPPED); |
298 |
|
✗ |
gtk_grid_attach (GTK_GRID (grid), edit_button, 2, 0, 1, 2); |
299 |
|
|
|
300 |
|
✗ |
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), grid); |
301 |
|
|
|
302 |
|
✗ |
return GTK_WIDGET (row); |
303 |
|
|
} |
304 |
|
|
|
305 |
|
|
static void |
306 |
|
✗ |
cc_wwan_apn_dialog_set_property (GObject *object, |
307 |
|
|
guint prop_id, |
308 |
|
|
const GValue *value, |
309 |
|
|
GParamSpec *pspec) |
310 |
|
|
{ |
311 |
|
✗ |
CcWwanApnDialog *self = (CcWwanApnDialog *)object; |
312 |
|
|
|
313 |
|
✗ |
switch (prop_id) |
314 |
|
|
{ |
315 |
|
✗ |
case PROP_DEVICE: |
316 |
|
✗ |
self->device = g_value_dup_object (value); |
317 |
|
✗ |
break; |
318 |
|
|
|
319 |
|
✗ |
default: |
320 |
|
✗ |
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
321 |
|
|
} |
322 |
|
✗ |
} |
323 |
|
|
|
324 |
|
|
static void |
325 |
|
✗ |
cc_wwan_apn_dialog_constructed (GObject *object) |
326 |
|
|
{ |
327 |
|
✗ |
CcWwanApnDialog *self = (CcWwanApnDialog *)object; |
328 |
|
|
|
329 |
|
✗ |
G_OBJECT_CLASS (cc_wwan_apn_dialog_parent_class)->constructed (object); |
330 |
|
|
|
331 |
|
✗ |
self->wwan_data = cc_wwan_device_get_data (self->device); |
332 |
|
|
|
333 |
|
✗ |
gtk_list_box_bind_model (self->apn_list, |
334 |
|
|
cc_wwan_data_get_apn_list (self->wwan_data), |
335 |
|
|
(GtkListBoxCreateWidgetFunc)cc_wwan_apn_dialog_row_new, |
336 |
|
|
self, NULL); |
337 |
|
✗ |
} |
338 |
|
|
|
339 |
|
|
static void |
340 |
|
✗ |
cc_wwan_apn_dialog_dispose (GObject *object) |
341 |
|
|
{ |
342 |
|
✗ |
CcWwanApnDialog *self = (CcWwanApnDialog *)object; |
343 |
|
|
|
344 |
|
✗ |
g_clear_object (&self->device); |
345 |
|
|
|
346 |
|
✗ |
G_OBJECT_CLASS (cc_wwan_apn_dialog_parent_class)->dispose (object); |
347 |
|
✗ |
} |
348 |
|
|
|
349 |
|
|
|
350 |
|
|
static void |
351 |
|
✗ |
cc_wwan_apn_dialog_show (GtkWidget *widget) |
352 |
|
|
{ |
353 |
|
✗ |
CcWwanApnDialog *self = (CcWwanApnDialog *)widget; |
354 |
|
|
|
355 |
|
✗ |
gtk_widget_set_sensitive (GTK_WIDGET (self->save_button), FALSE); |
356 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->add_button), TRUE); |
357 |
|
✗ |
gtk_widget_set_visible (GTK_WIDGET (self->save_button), FALSE); |
358 |
|
✗ |
gtk_stack_set_visible_child (self->apn_settings_stack, |
359 |
|
✗ |
GTK_WIDGET (self->apn_list_view)); |
360 |
|
|
|
361 |
|
✗ |
GTK_WIDGET_CLASS (cc_wwan_apn_dialog_parent_class)->show (widget); |
362 |
|
✗ |
} |
363 |
|
|
|
364 |
|
|
static void |
365 |
|
✗ |
cc_wwan_apn_dialog_class_init (CcWwanApnDialogClass *klass) |
366 |
|
|
{ |
367 |
|
✗ |
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); |
368 |
|
✗ |
GObjectClass *object_class = G_OBJECT_CLASS (klass); |
369 |
|
|
|
370 |
|
✗ |
object_class->set_property = cc_wwan_apn_dialog_set_property; |
371 |
|
✗ |
object_class->constructed = cc_wwan_apn_dialog_constructed; |
372 |
|
✗ |
object_class->dispose = cc_wwan_apn_dialog_dispose; |
373 |
|
|
|
374 |
|
✗ |
widget_class->show = cc_wwan_apn_dialog_show; |
375 |
|
|
|
376 |
|
✗ |
properties[PROP_DEVICE] = |
377 |
|
✗ |
g_param_spec_object ("device", |
378 |
|
|
"Device", |
379 |
|
|
"The WWAN Device", |
380 |
|
|
CC_TYPE_WWAN_DEVICE, |
381 |
|
|
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); |
382 |
|
|
|
383 |
|
✗ |
g_object_class_install_properties (object_class, N_PROPS, properties); |
384 |
|
|
|
385 |
|
✗ |
gtk_widget_class_set_template_from_resource (widget_class, |
386 |
|
|
"/org/gnome/control-center/wwan/cc-wwan-apn-dialog.ui"); |
387 |
|
|
|
388 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, add_button); |
389 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_edit_view); |
390 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_entry); |
391 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_list); |
392 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_list_view); |
393 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_radio_button); |
394 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, apn_settings_stack); |
395 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, back_button); |
396 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, name_entry); |
397 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, password_entry); |
398 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, save_button); |
399 |
|
✗ |
gtk_widget_class_bind_template_child (widget_class, CcWwanApnDialog, username_entry); |
400 |
|
|
|
401 |
|
✗ |
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_apn_back_clicked_cb); |
402 |
|
✗ |
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_apn_add_clicked_cb); |
403 |
|
✗ |
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_apn_save_clicked_cb); |
404 |
|
✗ |
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_apn_entry_changed_cb); |
405 |
|
✗ |
gtk_widget_class_bind_template_callback (widget_class, cc_wwan_apn_activated_cb); |
406 |
|
✗ |
} |
407 |
|
|
|
408 |
|
|
static void |
409 |
|
✗ |
cc_wwan_apn_dialog_init (CcWwanApnDialog *self) |
410 |
|
|
{ |
411 |
|
✗ |
gtk_widget_init_template (GTK_WIDGET (self)); |
412 |
|
✗ |
} |
413 |
|
|
|
414 |
|
|
GtkWindow * |
415 |
|
✗ |
cc_wwan_apn_dialog_new (GtkWindow *parent_window, |
416 |
|
|
CcWwanDevice *device) |
417 |
|
|
{ |
418 |
|
✗ |
g_return_val_if_fail (GTK_IS_WINDOW (parent_window), NULL); |
419 |
|
✗ |
g_return_val_if_fail (CC_IS_WWAN_DEVICE (device), NULL); |
420 |
|
|
|
421 |
|
✗ |
return GTK_WINDOW (g_object_new (CC_TYPE_WWAN_APN_DIALOG, |
422 |
|
|
"transient-for", parent_window, |
423 |
|
|
"use-header-bar", 1, |
424 |
|
|
"device", device, |
425 |
|
|
NULL)); |
426 |
|
|
} |
427 |
|
|
|