update manuals
[claws.git] / src / plugins / litehtml_viewer / lh_prefs.c
index fec2ff56fa02af7289691b66bbd7f06a8664bba4..c43abbd7b52947fc27f8b3dc2acda6fda88c6556 100644 (file)
@@ -43,12 +43,18 @@ LHPrefs lh_prefs;
 struct _LHPrefsPage {
        PrefsPage page;
        GtkWidget *enable_remote_content;
+       GtkWidget *image_cache_size;
+       GtkWidget *default_font;
 };
 typedef struct _LHPrefsPage LHPrefsPage;
 
 static PrefParam param[] = {
        { "enable_remote_content", "FALSE", &lh_prefs.enable_remote_content, P_BOOL,
                NULL, NULL, NULL },
+       { "image_cache_size", "20", &lh_prefs.image_cache_size, P_INT,
+               NULL, NULL, NULL },
+       { "default_font", "Sans 16", &lh_prefs.default_font, P_STRING,
+               NULL, NULL, NULL },
        { NULL, NULL, NULL, 0, NULL, NULL, NULL }
 };
 
@@ -83,6 +89,7 @@ void lh_prefs_init(void)
 
 void lh_prefs_done(void)
 {
+       prefs_gtk_unregister_page((PrefsPage *) &lh_prefs_page);
 }
 
 static void create_lh_prefs_page(PrefsPage *page, GtkWindow *window,
@@ -91,9 +98,13 @@ static void create_lh_prefs_page(PrefsPage *page, GtkWindow *window,
        LHPrefsPage *prefs_page = (LHPrefsPage *)page;
        GtkWidget *vbox;
        GtkWidget *vbox_remote;
+       GtkWidget *hbox;
        GtkWidget *frame;
        GtkWidget *label;
        GtkWidget *enable_remote_content;
+       GtkWidget *image_cache_size;
+       GtkWidget *default_font;
+       GtkObject *adj;
 
        vbox = gtk_vbox_new(FALSE, 3);
        gtk_container_set_border_width(GTK_CONTAINER(vbox), VBOX_BORDER);
@@ -115,7 +126,37 @@ static void create_lh_prefs_page(PrefsPage *page, GtkWindow *window,
        gtk_box_pack_start(GTK_BOX(vbox_remote), enable_remote_content, FALSE, FALSE, 0);
        gtk_widget_show_all(vbox_remote);
 
+       /* Image cache size */
+       hbox = gtk_hbox_new(FALSE, 8);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+       label = gtk_label_new(_("Size of image cache in megabytes"));
+       gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+       adj = gtk_adjustment_new(0, 0, 99999, 1, 10, 0);
+       image_cache_size = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
+       gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(image_cache_size), TRUE);
+       gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(image_cache_size), FALSE);
+       gtk_spin_button_set_value(GTK_SPIN_BUTTON(image_cache_size),
+                       lh_prefs.image_cache_size);
+       gtk_box_pack_start(GTK_BOX(hbox), image_cache_size, FALSE, FALSE, 0);
+
+       /* Font */
+       hbox = gtk_hbox_new(FALSE, 8);
+       gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+       label = gtk_label_new(_("Default font"));
+       gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+       default_font = gtk_font_button_new_with_font(lh_prefs.default_font);
+       g_object_set(G_OBJECT(default_font), "use-font", TRUE, NULL);
+       gtk_box_pack_start(GTK_BOX(hbox), default_font, FALSE, FALSE, 0);
+
+       gtk_widget_show_all(hbox);
+
        prefs_page->enable_remote_content = enable_remote_content;
+       prefs_page->image_cache_size = image_cache_size;
+       prefs_page->default_font = default_font;
        prefs_page->page.widget = vbox;
 }
 
@@ -130,6 +171,13 @@ static void save_lh_prefs_page(PrefsPage *page)
        lh_prefs.enable_remote_content = gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(prefs_page->enable_remote_content));
 
+       lh_prefs.image_cache_size = gtk_spin_button_get_value_as_int(
+                       GTK_SPIN_BUTTON(prefs_page->image_cache_size));
+
+       g_free(lh_prefs.default_font);
+       lh_prefs.default_font = g_strdup(gtk_font_button_get_font_name(
+                       GTK_FONT_BUTTON(prefs_page->default_font)));
+
        save_prefs();
 }