diff options
Diffstat (limited to 'src/anastasis/anastasis-gtk_pe-edit-policy.c')
-rw-r--r-- | src/anastasis/anastasis-gtk_pe-edit-policy.c | 295 |
1 files changed, 149 insertions, 146 deletions
diff --git a/src/anastasis/anastasis-gtk_pe-edit-policy.c b/src/anastasis/anastasis-gtk_pe-edit-policy.c index f0ac3fb..6803cc2 100644 --- a/src/anastasis/anastasis-gtk_pe-edit-policy.c +++ b/src/anastasis/anastasis-gtk_pe-edit-policy.c | |||
@@ -50,7 +50,7 @@ struct LineContext | |||
50 | * Kept in a DLL. | 50 | * Kept in a DLL. |
51 | */ | 51 | */ |
52 | struct LineContext *prev; | 52 | struct LineContext *prev; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Context this line context belongs with. | 55 | * Context this line context belongs with. |
56 | */ | 56 | */ |
@@ -60,17 +60,17 @@ struct LineContext | |||
60 | * Our combo box. | 60 | * Our combo box. |
61 | */ | 61 | */ |
62 | GtkComboBox *cb; | 62 | GtkComboBox *cb; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Model for our combo box. | 65 | * Model for our combo box. |
66 | */ | 66 | */ |
67 | GtkTreeModel *model; | 67 | GtkTreeModel *model; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Challenge index for this line. | 70 | * Challenge index for this line. |
71 | */ | 71 | */ |
72 | unsigned int cindex; | 72 | unsigned int cindex; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Is this challenge used? | 75 | * Is this challenge used? |
76 | */ | 76 | */ |
@@ -107,7 +107,7 @@ struct EditDialogContext | |||
107 | 107 | ||
108 | 108 | ||
109 | /** | 109 | /** |
110 | * Handle the response from the edit dialog. | 110 | * Handle the response from the edit dialog. |
111 | * | 111 | * |
112 | * @param dialog the dialog | 112 | * @param dialog the dialog |
113 | * @param response_id what the user's action was | 113 | * @param response_id what the user's action was |
@@ -124,65 +124,66 @@ anastasis_gtk_policy_edit_dialog_response_cb ( | |||
124 | if (GTK_RESPONSE_OK == response_id) | 124 | if (GTK_RESPONSE_OK == response_id) |
125 | { | 125 | { |
126 | json_t *policy; | 126 | json_t *policy; |
127 | 127 | ||
128 | policy = json_array (); | 128 | policy = json_array (); |
129 | GNUNET_assert (NULL != policy); | 129 | GNUNET_assert (NULL != policy); |
130 | for (struct LineContext *lctx = edc->lc_head; | 130 | for (struct LineContext *lctx = edc->lc_head; |
131 | NULL != lctx; | 131 | NULL != lctx; |
132 | lctx = lctx->next) | 132 | lctx = lctx->next) |
133 | { | 133 | { |
134 | GtkTreeIter iter; | 134 | GtkTreeIter iter; |
135 | gchar *url; | 135 | gchar *url; |
136 | 136 | ||
137 | if (! lctx->on) | 137 | if (! lctx->on) |
138 | continue; | 138 | continue; |
139 | if (! gtk_combo_box_get_active_iter (lctx->cb, | 139 | if (! gtk_combo_box_get_active_iter (lctx->cb, |
140 | &iter)) | 140 | &iter)) |
141 | { | 141 | { |
142 | GNUNET_break (0); | 142 | GNUNET_break (0); |
143 | continue; | 143 | continue; |
144 | } | 144 | } |
145 | gtk_tree_model_get (lctx->model, | 145 | gtk_tree_model_get (lctx->model, |
146 | &iter, | 146 | &iter, |
147 | 0, &url, | 147 | 0, &url, |
148 | -1); | 148 | -1); |
149 | GNUNET_break (0 == | 149 | GNUNET_assert (0 == |
150 | json_array_append_new (policy, | 150 | json_array_append_new ( |
151 | json_pack ("{s:I, s:s}", | 151 | policy, |
152 | "authentication_method", | 152 | GNUNET_JSON_PACK ( |
153 | (json_int_t) lctx->cindex, | 153 | GNUNET_JSON_pack_uint64 ("authentication_method", |
154 | "provider", | 154 | lctx->cindex), |
155 | url))); | 155 | GNUNET_JSON_pack_string ("provider", |
156 | url)))); | ||
156 | g_free (url); | 157 | g_free (url); |
157 | } | 158 | } |
158 | if (UINT_MAX == edc->pindex) | 159 | if (UINT_MAX == edc->pindex) |
159 | { | 160 | { |
160 | json_t *args; | 161 | json_t *args; |
161 | 162 | ||
162 | args = json_pack ("{s:o}", | 163 | args = GNUNET_JSON_PACK ( |
163 | "policy", | 164 | GNUNET_JSON_pack_array_steal ("policy", |
164 | (json_int_t) policy); | 165 | policy)); |
165 | AG_ra = ANASTASIS_redux_action (AG_redux_state, | 166 | AG_ra = ANASTASIS_redux_action (AG_redux_state, |
166 | "add_policy", | 167 | "add_policy", |
167 | args, | 168 | args, |
168 | &AG_action_cb, | 169 | &AG_action_cb, |
169 | NULL); | 170 | NULL); |
170 | json_decref (args); | 171 | json_decref (args); |
171 | } | 172 | } |
172 | else | 173 | else |
173 | { | 174 | { |
174 | json_t *args; | 175 | json_t *args; |
175 | 176 | ||
176 | args = json_pack ("{s:I, s:o}", | 177 | args = GNUNET_JSON_PACK ( |
177 | "policy_index", | 178 | GNUNET_JSON_pack_uint64 ("policy_index", |
178 | (json_int_t) edc->pindex, | 179 | edc->pindex), |
179 | "policy", | 180 | GNUNET_JSON_pack_array_steal ("policy", |
180 | policy); | 181 | policy)); |
181 | AG_ra = ANASTASIS_redux_action (AG_redux_state, | 182 | AG_ra = ANASTASIS_redux_action (AG_redux_state, |
182 | "update_policy", | 183 | "update_policy", |
183 | args, | 184 | args, |
184 | &AG_action_cb, | 185 | &AG_action_cb, |
185 | NULL); | 186 | NULL); |
186 | json_decref (args); | 187 | json_decref (args); |
187 | } | 188 | } |
188 | } | 189 | } |
@@ -190,11 +191,11 @@ anastasis_gtk_policy_edit_dialog_response_cb ( | |||
190 | { | 191 | { |
191 | struct LineContext *lctx; | 192 | struct LineContext *lctx; |
192 | 193 | ||
193 | while (NULL != (lctx =edc->lc_head)) | 194 | while (NULL != (lctx = edc->lc_head)) |
194 | { | 195 | { |
195 | GNUNET_CONTAINER_DLL_remove (edc->lc_head, | 196 | GNUNET_CONTAINER_DLL_remove (edc->lc_head, |
196 | edc->lc_tail, | 197 | edc->lc_tail, |
197 | lctx); | 198 | lctx); |
198 | GNUNET_free (lctx); | 199 | GNUNET_free (lctx); |
199 | } | 200 | } |
200 | } | 201 | } |
@@ -224,23 +225,23 @@ combo_box_changed_cb ( | |||
224 | /* Update our line context's on/off flag */ | 225 | /* Update our line context's on/off flag */ |
225 | { | 226 | { |
226 | GtkTreeIter iter; | 227 | GtkTreeIter iter; |
227 | 228 | ||
228 | if (! gtk_combo_box_get_active_iter (lc->cb, | 229 | if (! gtk_combo_box_get_active_iter (lc->cb, |
229 | &iter)) | 230 | &iter)) |
230 | { | 231 | { |
231 | GNUNET_break (0); | 232 | GNUNET_break (0); |
232 | } | 233 | } |
233 | else | 234 | else |
234 | { | 235 | { |
235 | gchar *url; | 236 | gchar *url; |
236 | 237 | ||
237 | gtk_tree_model_get (lc->model, | 238 | gtk_tree_model_get (lc->model, |
238 | &iter, | 239 | &iter, |
239 | 0, &url, | 240 | 0, &url, |
240 | -1); | 241 | -1); |
241 | lc->on = (0 != | 242 | lc->on = (0 != |
242 | strcmp (_("<off>"), | 243 | strcmp (_ ("<off>"), |
243 | url)); | 244 | url)); |
244 | g_free (url); | 245 | g_free (url); |
245 | } | 246 | } |
246 | } | 247 | } |
@@ -250,13 +251,13 @@ combo_box_changed_cb ( | |||
250 | bool legal = false; | 251 | bool legal = false; |
251 | 252 | ||
252 | for (struct LineContext *lctx = edc->lc_head; | 253 | for (struct LineContext *lctx = edc->lc_head; |
253 | NULL != lctx; | 254 | NULL != lctx; |
254 | lctx = lctx->next) | 255 | lctx = lctx->next) |
255 | legal |= lctx->on; | 256 | legal |= lctx->on; |
256 | ok_button = GTK_WIDGET (gtk_builder_get_object (edc->builder, | 257 | ok_button = GTK_WIDGET (gtk_builder_get_object (edc->builder, |
257 | "ok_button")); | 258 | "ok_button")); |
258 | gtk_widget_set_sensitive (ok_button, | 259 | gtk_widget_set_sensitive (ok_button, |
259 | legal); | 260 | legal); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | 263 | ||
@@ -268,31 +269,31 @@ combo_box_changed_cb ( | |||
268 | * @param type method to check for | 269 | * @param type method to check for |
269 | * @param ap provider to check against | 270 | * @param ap provider to check against |
270 | * @return true if @a ap offers @a type | 271 | * @return true if @a ap offers @a type |
271 | */ | 272 | */ |
272 | static bool | 273 | static bool |
273 | ap_matches (const char *type, | 274 | ap_matches (const char *type, |
274 | json_t *ap) | 275 | json_t *ap) |
275 | { | 276 | { |
276 | json_t *methods; | 277 | json_t *methods; |
277 | size_t index; | 278 | size_t index; |
278 | json_t *method; | 279 | json_t *method; |
279 | 280 | ||
280 | methods = json_object_get (ap, | 281 | methods = json_object_get (ap, |
281 | "methods"); | 282 | "methods"); |
282 | GNUNET_break (NULL != methods); | 283 | GNUNET_break (NULL != methods); |
283 | json_array_foreach (methods, index, method) | 284 | json_array_foreach (methods, index, method) |
284 | { | 285 | { |
285 | const char *offer; | 286 | const char *offer; |
286 | 287 | ||
287 | offer = json_string_value (json_object_get (method, | 288 | offer = json_string_value (json_object_get (method, |
288 | "type")); | 289 | "type")); |
289 | if (NULL == offer) | 290 | if (NULL == offer) |
290 | { | 291 | { |
291 | GNUNET_break (0); | 292 | GNUNET_break (0); |
292 | continue; | 293 | continue; |
293 | } | 294 | } |
294 | if (0 == strcasecmp (type, | 295 | if (0 == strcasecmp (type, |
295 | offer)) | 296 | offer)) |
296 | return true; | 297 | return true; |
297 | } | 298 | } |
298 | return false; | 299 | return false; |
@@ -301,7 +302,7 @@ ap_matches (const char *type, | |||
301 | 302 | ||
302 | /** | 303 | /** |
303 | * Create a GtkListStore containing all of the URLs | 304 | * Create a GtkListStore containing all of the URLs |
304 | * of Anastasis providers offering @a type as an | 305 | * of Anastasis providers offering @a type as an |
305 | * authentication method. | 306 | * authentication method. |
306 | * | 307 | * |
307 | * @return the model | 308 | * @return the model |
@@ -315,26 +316,26 @@ make_model (const char *type) | |||
315 | json_t *ap; | 316 | json_t *ap; |
316 | 317 | ||
317 | ls = gtk_list_store_new (1, | 318 | ls = gtk_list_store_new (1, |
318 | G_TYPE_STRING); | 319 | G_TYPE_STRING); |
319 | gtk_list_store_insert_with_values (ls, | 320 | gtk_list_store_insert_with_values (ls, |
320 | NULL, | 321 | NULL, |
321 | -1, | 322 | -1, |
322 | 0, _("<off>"), | 323 | 0, _ ("<off>"), |
323 | -1); | 324 | -1); |
324 | aps = json_object_get (AG_redux_state, | 325 | aps = json_object_get (AG_redux_state, |
325 | "authentication_providers"); | 326 | "authentication_providers"); |
326 | GNUNET_break (NULL != aps); | 327 | GNUNET_break (NULL != aps); |
327 | json_object_foreach (aps, url, ap) { | 328 | json_object_foreach (aps, url, ap) { |
328 | if (ap_matches (type, | 329 | if (ap_matches (type, |
329 | ap)) | 330 | ap)) |
330 | { | 331 | { |
331 | gtk_list_store_insert_with_values (ls, | 332 | gtk_list_store_insert_with_values (ls, |
332 | NULL, | 333 | NULL, |
333 | -1, | 334 | -1, |
334 | 0, url, | 335 | 0, url, |
335 | -1); | 336 | -1); |
336 | } | 337 | } |
337 | } | 338 | } |
338 | 339 | ||
339 | return GTK_TREE_MODEL (ls); | 340 | return GTK_TREE_MODEL (ls); |
340 | } | 341 | } |
@@ -348,12 +349,12 @@ make_model (const char *type) | |||
348 | */ | 349 | */ |
349 | static void | 350 | static void |
350 | select_by_url (const char *url, | 351 | select_by_url (const char *url, |
351 | struct LineContext *lctx) | 352 | struct LineContext *lctx) |
352 | { | 353 | { |
353 | GtkTreeIter iter; | 354 | GtkTreeIter iter; |
354 | 355 | ||
355 | if (! gtk_tree_model_get_iter_first (lctx->model, | 356 | if (! gtk_tree_model_get_iter_first (lctx->model, |
356 | &iter)) | 357 | &iter)) |
357 | { | 358 | { |
358 | GNUNET_break (0); | 359 | GNUNET_break (0); |
359 | return; | 360 | return; |
@@ -362,21 +363,21 @@ select_by_url (const char *url, | |||
362 | gchar *have; | 363 | gchar *have; |
363 | 364 | ||
364 | gtk_tree_model_get (lctx->model, | 365 | gtk_tree_model_get (lctx->model, |
365 | &iter, | 366 | &iter, |
366 | 0, &have, | 367 | 0, &have, |
367 | -1); | 368 | -1); |
368 | if (0 == strcmp (have, | 369 | if (0 == strcmp (have, |
369 | url)) | 370 | url)) |
370 | { | 371 | { |
371 | gtk_combo_box_set_active_iter (lctx->cb, | 372 | gtk_combo_box_set_active_iter (lctx->cb, |
372 | &iter); | 373 | &iter); |
373 | lctx->on = true; | 374 | lctx->on = true; |
374 | g_free (have); | 375 | g_free (have); |
375 | return; | 376 | return; |
376 | } | 377 | } |
377 | g_free (have); | 378 | g_free (have); |
378 | } while (gtk_tree_model_iter_next (lctx->model, | 379 | } while (gtk_tree_model_iter_next (lctx->model, |
379 | &iter)); | 380 | &iter)); |
380 | GNUNET_break (0); /* not found */ | 381 | GNUNET_break (0); /* not found */ |
381 | } | 382 | } |
382 | 383 | ||
@@ -390,31 +391,31 @@ select_by_url (const char *url, | |||
390 | */ | 391 | */ |
391 | static void | 392 | static void |
392 | select_by_policy (const json_t *methods, | 393 | select_by_policy (const json_t *methods, |
393 | struct LineContext *lctx) | 394 | struct LineContext *lctx) |
394 | { | 395 | { |
395 | size_t index; | 396 | size_t index; |
396 | json_t *method; | 397 | json_t *method; |
397 | GtkTreeIter iter; | 398 | GtkTreeIter iter; |
398 | 399 | ||
399 | if (! gtk_tree_model_get_iter_first (lctx->model, | 400 | if (! gtk_tree_model_get_iter_first (lctx->model, |
400 | &iter)) | 401 | &iter)) |
401 | { | 402 | { |
402 | GNUNET_break (0); | 403 | GNUNET_break (0); |
403 | return; | 404 | return; |
404 | } | 405 | } |
405 | gtk_combo_box_set_active_iter (lctx->cb, | 406 | gtk_combo_box_set_active_iter (lctx->cb, |
406 | &iter); | 407 | &iter); |
407 | json_array_foreach (methods, index, method) { | 408 | json_array_foreach (methods, index, method) { |
408 | json_int_t am = json_integer_value (json_object_get (method,\ | 409 | json_int_t am = json_integer_value (json_object_get (method, \ |
409 | "authentication_method")); | 410 | "authentication_method")); |
410 | const char *url; | 411 | const char *url; |
411 | 412 | ||
412 | if (am != lctx->cindex) | 413 | if (am != lctx->cindex) |
413 | continue; | 414 | continue; |
414 | url = json_string_value (json_object_get (method, | 415 | url = json_string_value (json_object_get (method, |
415 | "provider")); | 416 | "provider")); |
416 | select_by_url (url, | 417 | select_by_url (url, |
417 | lctx); | 418 | lctx); |
418 | break; | 419 | break; |
419 | } | 420 | } |
420 | } | 421 | } |
@@ -426,10 +427,10 @@ AG_edit_policy (guint pindex) | |||
426 | struct EditDialogContext *edc; | 427 | struct EditDialogContext *edc; |
427 | GtkGrid *grid; | 428 | GtkGrid *grid; |
428 | json_t *methods = NULL; | 429 | json_t *methods = NULL; |
429 | 430 | ||
430 | edc = GNUNET_new (struct EditDialogContext); | 431 | edc = GNUNET_new (struct EditDialogContext); |
431 | edc->builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_edit_policy.glade", | 432 | edc->builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_edit_policy.glade", |
432 | edc); | 433 | edc); |
433 | edc->pindex = pindex; | 434 | edc->pindex = pindex; |
434 | if (NULL == edc->builder) | 435 | if (NULL == edc->builder) |
435 | { | 436 | { |
@@ -443,18 +444,18 @@ AG_edit_policy (guint pindex) | |||
443 | json_t *policy; | 444 | json_t *policy; |
444 | 445 | ||
445 | policies = json_object_get (AG_redux_state, | 446 | policies = json_object_get (AG_redux_state, |
446 | "policies"); | 447 | "policies"); |
447 | policy = json_array_get (policies, | 448 | policy = json_array_get (policies, |
448 | pindex); | 449 | pindex); |
449 | methods = json_object_get (policy, | 450 | methods = json_object_get (policy, |
450 | "methods"); | 451 | "methods"); |
451 | GNUNET_break (NULL != methods); | 452 | GNUNET_break (NULL != methods); |
452 | } | 453 | } |
453 | grid = GTK_GRID (gtk_builder_get_object (edc->builder, | 454 | grid = GTK_GRID (gtk_builder_get_object (edc->builder, |
454 | "policy_grid")); | 455 | "policy_grid")); |
455 | { | 456 | { |
456 | json_t *ams = json_object_get (AG_redux_state, | 457 | json_t *ams = json_object_get (AG_redux_state, |
457 | "authentication_methods"); | 458 | "authentication_methods"); |
458 | json_t *am; | 459 | json_t *am; |
459 | size_t index; | 460 | size_t index; |
460 | gint row = 1; | 461 | gint row = 1; |
@@ -464,10 +465,10 @@ AG_edit_policy (guint pindex) | |||
464 | const char *instructions; | 465 | const char *instructions; |
465 | struct GNUNET_JSON_Specification spec[] = { | 466 | struct GNUNET_JSON_Specification spec[] = { |
466 | GNUNET_JSON_spec_string ("type", | 467 | GNUNET_JSON_spec_string ("type", |
467 | &type), | 468 | &type), |
468 | GNUNET_JSON_spec_string ("instructions", | 469 | GNUNET_JSON_spec_string ("instructions", |
469 | &instructions), | 470 | &instructions), |
470 | GNUNET_JSON_spec_end () | 471 | GNUNET_JSON_spec_end () |
471 | }; | 472 | }; |
472 | char *labels; | 473 | char *labels; |
473 | GtkWidget *label; | 474 | GtkWidget *label; |
@@ -475,69 +476,69 @@ AG_edit_policy (guint pindex) | |||
475 | struct LineContext *lctx; | 476 | struct LineContext *lctx; |
476 | 477 | ||
477 | if (GNUNET_OK != | 478 | if (GNUNET_OK != |
478 | GNUNET_JSON_parse (am, | 479 | GNUNET_JSON_parse (am, |
479 | spec, | 480 | spec, |
480 | NULL, NULL)) | 481 | NULL, NULL)) |
481 | { | 482 | { |
482 | GNUNET_break (0); | 483 | GNUNET_break (0); |
483 | continue; | 484 | continue; |
484 | } | 485 | } |
485 | lctx = GNUNET_new (struct LineContext); | 486 | lctx = GNUNET_new (struct LineContext); |
486 | lctx->cindex = index; | 487 | lctx->cindex = index; |
487 | GNUNET_asprintf (&labels, | 488 | GNUNET_asprintf (&labels, |
488 | "<b>%s</b>: %s", | 489 | "<b>%s</b>: %s", |
489 | type, | 490 | type, |
490 | instructions); | 491 | instructions); |
491 | label = gtk_label_new (NULL); | 492 | label = gtk_label_new (NULL); |
492 | gtk_label_set_markup (GTK_LABEL (label), | 493 | gtk_label_set_markup (GTK_LABEL (label), |
493 | labels); | 494 | labels); |
494 | GNUNET_free (labels); | 495 | GNUNET_free (labels); |
495 | lctx->model = make_model (type); | 496 | lctx->model = make_model (type); |
496 | cb = gtk_combo_box_new_with_model (lctx->model); | 497 | cb = gtk_combo_box_new_with_model (lctx->model); |
497 | lctx->cb = GTK_COMBO_BOX (cb); | 498 | lctx->cb = GTK_COMBO_BOX (cb); |
498 | { | 499 | { |
499 | GtkCellRenderer *renderer; | 500 | GtkCellRenderer *renderer; |
500 | 501 | ||
501 | renderer = gtk_cell_renderer_text_new (); | 502 | renderer = gtk_cell_renderer_text_new (); |
502 | gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb), | 503 | gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb), |
503 | renderer, | 504 | renderer, |
504 | true); | 505 | true); |
505 | gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb), | 506 | gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb), |
506 | renderer, | 507 | renderer, |
507 | "text", | 508 | "text", |
508 | 0); | 509 | 0); |
509 | } | 510 | } |
510 | lctx->edc = edc; | 511 | lctx->edc = edc; |
511 | GNUNET_CONTAINER_DLL_insert (edc->lc_head, | 512 | GNUNET_CONTAINER_DLL_insert (edc->lc_head, |
512 | edc->lc_tail, | 513 | edc->lc_tail, |
513 | lctx); | 514 | lctx); |
514 | g_object_connect (cb, | 515 | g_object_connect (cb, |
515 | "signal::changed", | 516 | "signal::changed", |
516 | &combo_box_changed_cb, lctx, | 517 | &combo_box_changed_cb, lctx, |
517 | NULL); | 518 | NULL); |
518 | if (NULL != methods) | 519 | if (NULL != methods) |
519 | select_by_policy (methods, | 520 | select_by_policy (methods, |
520 | lctx); | 521 | lctx); |
521 | gtk_grid_insert_row (grid, | 522 | gtk_grid_insert_row (grid, |
522 | row); | 523 | row); |
523 | gtk_widget_show (label); | 524 | gtk_widget_show (label); |
524 | gtk_grid_attach (grid, | 525 | gtk_grid_attach (grid, |
525 | label, | 526 | label, |
526 | 0, | 527 | 0, |
527 | row, | 528 | row, |
528 | 1, | 529 | 1, |
529 | 1); | 530 | 1); |
530 | g_object_set (cb, | 531 | g_object_set (cb, |
531 | "expand", | 532 | "expand", |
532 | TRUE, | 533 | TRUE, |
533 | NULL); | 534 | NULL); |
534 | gtk_widget_show (cb); | 535 | gtk_widget_show (cb); |
535 | gtk_grid_attach (grid, | 536 | gtk_grid_attach (grid, |
536 | cb, | 537 | cb, |
537 | 1, | 538 | 1, |
538 | row, | 539 | row, |
539 | 1, | 540 | 1, |
540 | 1); | 541 | 1); |
541 | row++; | 542 | row++; |
542 | } | 543 | } |
543 | } | 544 | } |
@@ -547,20 +548,22 @@ AG_edit_policy (guint pindex) | |||
547 | GtkWidget *anchor; | 548 | GtkWidget *anchor; |
548 | GtkRequisition req; | 549 | GtkRequisition req; |
549 | 550 | ||
550 | anchor = GTK_WIDGET (GCG_get_main_window_object ("anastasis_gtk_main_window_quit_button")); | 551 | anchor = GTK_WIDGET (GCG_get_main_window_object ( |
552 | "anastasis_gtk_main_window_quit_button")); | ||
551 | toplevel = gtk_widget_get_toplevel (anchor); | 553 | toplevel = gtk_widget_get_toplevel (anchor); |
552 | ad = GTK_WIDGET (gtk_builder_get_object (edc->builder, | 554 | ad = GTK_WIDGET (gtk_builder_get_object (edc->builder, |
553 | "anastasis_gtk_policy_edit_dialog")); | 555 | "anastasis_gtk_policy_edit_dialog")); |
554 | gtk_widget_get_preferred_size (ad, | 556 | gtk_widget_get_preferred_size (ad, |
555 | NULL, | 557 | NULL, |
556 | &req); | 558 | &req); |
557 | gtk_window_resize (GTK_WINDOW (ad), | 559 | gtk_window_resize (GTK_WINDOW (ad), |
558 | req.width, | 560 | req.width, |
559 | req.height); | 561 | req.height); |
560 | gtk_window_set_transient_for (GTK_WINDOW (ad), | 562 | gtk_window_set_transient_for (GTK_WINDOW (ad), |
561 | GTK_WINDOW (toplevel)); | 563 | GTK_WINDOW (toplevel)); |
562 | gtk_window_present (GTK_WINDOW (ad)); | 564 | gtk_window_present (GTK_WINDOW (ad)); |
563 | } | 565 | } |
564 | } | 566 | } |
565 | 567 | ||
568 | |||
566 | /* end of anastasis-gtk_pe-edit-policy.c */ | 569 | /* end of anastasis-gtk_pe-edit-policy.c */ |