diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-20 14:37:29 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-20 14:37:29 +0000 |
commit | e2ee8e49abdcf7a2b432024b47c2527a57b17576 (patch) | |
tree | f17ef3a69a00ab31b46b0484fa7d79be26a70ea5 | |
parent | ea9ed07b8cb581a5d14d048d83f95ab462966887 (diff) | |
download | gnunet-gtk-e2ee8e49abdcf7a2b432024b47c2527a57b17576.tar.gz gnunet-gtk-e2ee8e49abdcf7a2b432024b47c2527a57b17576.zip |
- autoshortening
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 35 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk.h | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index 48be109f..74437215 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -175,7 +175,32 @@ void | |||
175 | GNUNET_GNS_GTK_autoshort_imagemenuitem_toggled_cb (GtkCheckMenuItem *checkmenuitem, | 175 | GNUNET_GNS_GTK_autoshort_imagemenuitem_toggled_cb (GtkCheckMenuItem *checkmenuitem, |
176 | gpointer user_data) | 176 | gpointer user_data) |
177 | { | 177 | { |
178 | GNUNET_break (0); // FIXME, not implemented | 178 | struct GNUNET_GNS_Context *gns = user_data; |
179 | GtkWidget *dialog; | ||
180 | struct GNUNET_CONFIGURATION_Handle *cfg = (struct GNUNET_CONFIGURATION_Handle *) get_configuration(); | ||
181 | |||
182 | gboolean state = gtk_check_menu_item_get_active (gns->shorten_menu); | ||
183 | if (TRUE == state) | ||
184 | GNUNET_CONFIGURATION_set_value_string(cfg,"gns", "AUTO_IMPORT_PKEY","YES"); | ||
185 | else | ||
186 | GNUNET_CONFIGURATION_set_value_string(cfg,"gns", "AUTO_IMPORT_PKEY","NO"); | ||
187 | |||
188 | char * cfgfile = strdup (GNUNET_GTK_main_loop_get_configuration_file(ml)); | ||
189 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_write(cfg, cfgfile)) | ||
190 | { | ||
191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Changes to autoshorten could not be written to configuration file: `%s'\n"), cfgfile); | ||
192 | dialog = gtk_message_dialog_new (GTK_WINDOW (main_window), | ||
193 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
194 | GTK_MESSAGE_ERROR, | ||
195 | GTK_BUTTONS_CLOSE, | ||
196 | _("Changes to autoshorten option could not be written to configuration file: `%s'\n"), | ||
197 | cfgfile); | ||
198 | g_signal_connect_swapped (dialog, "response", | ||
199 | G_CALLBACK (gtk_widget_destroy), | ||
200 | dialog); | ||
201 | gtk_widget_show_all (dialog); | ||
202 | } | ||
203 | GNUNET_free (cfgfile); | ||
179 | } | 204 | } |
180 | 205 | ||
181 | 206 | ||
@@ -408,6 +433,13 @@ namestore_service_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t | |||
408 | gns->builder = GNUNET_GTK_main_loop_get_builder(ml); | 433 | gns->builder = GNUNET_GTK_main_loop_get_builder(ml); |
409 | gns->ts = GTK_TREE_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_treestore")); | 434 | gns->ts = GTK_TREE_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_treestore")); |
410 | gns->ls = GTK_LIST_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_type_liststore")); | 435 | gns->ls = GTK_LIST_STORE (gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_type_liststore")); |
436 | gns->shorten_menu = GTK_CHECK_MENU_ITEM(gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_autoshort_imagemenuitem")); | ||
437 | if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (get_configuration (), | ||
438 | "gns", | ||
439 | "AUTO_IMPORT_PKEY")) | ||
440 | gtk_check_menu_item_set_active (gns->shorten_menu, TRUE); | ||
441 | else | ||
442 | gtk_check_menu_item_set_active (gns->shorten_menu, FALSE); | ||
411 | 443 | ||
412 | zone_as_string = GNUNET_strdup ((char *) &shenc); | 444 | zone_as_string = GNUNET_strdup ((char *) &shenc); |
413 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), | 445 | label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"), |
@@ -455,6 +487,7 @@ main (int argc, char *const *argv) | |||
455 | {'t', "tray", NULL, | 487 | {'t', "tray", NULL, |
456 | gettext_noop ("start in tray mode"), 0, | 488 | gettext_noop ("start in tray mode"), 0, |
457 | &GNUNET_GETOPT_set_one, &tray_only}, | 489 | &GNUNET_GETOPT_set_one, &tray_only}, |
490 | |||
458 | GNUNET_GETOPT_OPTION_END | 491 | GNUNET_GETOPT_OPTION_END |
459 | }; | 492 | }; |
460 | 493 | ||
diff --git a/src/gns/gnunet-gns-gtk.h b/src/gns/gnunet-gns-gtk.h index 4148918b..ad6e749d 100644 --- a/src/gns/gnunet-gns-gtk.h +++ b/src/gns/gnunet-gns-gtk.h | |||
@@ -34,6 +34,8 @@ struct GNUNET_GNS_Context | |||
34 | */ | 34 | */ |
35 | struct GNUNET_NAMESTORE_Handle *ns; | 35 | struct GNUNET_NAMESTORE_Handle *ns; |
36 | 36 | ||
37 | GtkCheckMenuItem *shorten_menu; | ||
38 | |||
37 | GtkBuilder *builder; | 39 | GtkBuilder *builder; |
38 | 40 | ||
39 | GtkTreeStore *ts; | 41 | GtkTreeStore *ts; |