2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2003 Hiroyuki Yamamoto and the Sylpheed-Claws Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <glib/gi18n.h>
30 #include "common/utils.h"
32 #include "prefs_gtk.h"
33 #include "prefswindow.h"
35 #include "prefs_common.h"
36 #include "prefs_gtk.h"
38 typedef struct _ImageViewerPage
42 GtkWidget *window; /* do not modify */
44 GtkWidget *autoload_img;
45 GtkWidget *resize_img;
46 GtkWidget *inline_img;
49 static void imageviewer_create_widget_func(PrefsPage * _page,
53 ImageViewerPage *prefs_imageviewer = (ImageViewerPage *) _page;
56 GtkWidget *autoload_img;
57 GtkWidget *resize_img;
58 GtkWidget *inline_img;
60 table = gtk_table_new(3, 1, FALSE);
61 gtk_widget_show(table);
62 gtk_container_set_border_width(GTK_CONTAINER(table), 8);
63 gtk_table_set_row_spacings(GTK_TABLE(table), 4);
64 gtk_table_set_col_spacings(GTK_TABLE(table), 8);
66 autoload_img = gtk_check_button_new_with_label(_("Automatically display attached images"));
67 gtk_widget_show(autoload_img);
68 gtk_table_attach(GTK_TABLE(table), autoload_img, 0, 1, 0, 1,
69 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
70 (GtkAttachOptions) (0), 0, 0);
72 resize_img = gtk_check_button_new_with_label(_("Resize attached images by default\n(Clicking image toggles scaling)"));
73 gtk_widget_show(resize_img);
74 gtk_table_attach(GTK_TABLE(table), resize_img, 0, 1, 1, 2,
75 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
76 (GtkAttachOptions) (0), 0, 0);
78 inline_img = gtk_check_button_new_with_label(_("Display images inline"));
79 gtk_widget_show(inline_img);
80 gtk_table_attach(GTK_TABLE(table), inline_img, 0, 1, 2, 3,
81 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
82 (GtkAttachOptions) (0), 0, 0);
84 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resize_img), prefs_common.resize_img);
85 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoload_img), prefs_common.display_img);
86 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(inline_img), prefs_common.inline_img);
88 prefs_imageviewer->window = GTK_WIDGET(window);
89 prefs_imageviewer->autoload_img = autoload_img;
90 prefs_imageviewer->resize_img = resize_img;
91 prefs_imageviewer->inline_img = inline_img;
93 prefs_imageviewer->page.widget = table;
96 static void imageviewer_destroy_widget_func(PrefsPage *_page)
100 static void imageviewer_save_func(PrefsPage * _page)
102 ImageViewerPage *imageviewer = (ImageViewerPage *) _page;
104 prefs_common.display_img =
105 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
106 (imageviewer->autoload_img));
107 prefs_common.resize_img =
108 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
109 (imageviewer->resize_img));
110 prefs_common.inline_img =
111 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
112 (imageviewer->inline_img));
115 ImageViewerPage *prefs_imageviewer;
117 void prefs_image_viewer_init(void)
119 ImageViewerPage *page;
120 static gchar *path[3];
122 path[0] = _("Message View");
123 path[1] = _("Image Viewer");
126 page = g_new0(ImageViewerPage, 1);
127 page->page.path = path;
128 page->page.create_widget = imageviewer_create_widget_func;
129 page->page.destroy_widget = imageviewer_destroy_widget_func;
130 page->page.save_page = imageviewer_save_func;
131 page->page.weight = 160.0;
132 prefs_gtk_register_page((PrefsPage *) page);
133 prefs_imageviewer = page;
136 void prefs_image_viewer_done(void)
138 prefs_gtk_unregister_page((PrefsPage *) prefs_imageviewer);
139 g_free(prefs_imageviewer);