implement the GTK preferances dialog with signals

This commit is contained in:
Vincent Sanders 2012-12-30 01:17:17 +00:00
parent ea3f09a724
commit 33934e1271
12 changed files with 1357 additions and 1295 deletions

View File

@ -108,7 +108,8 @@ extern struct ns_options nsoptions;
free(nsoptions.OPTION); \
} \
nsoptions.OPTION = VALUE; \
if (*nsoptions.OPTION == 0) { \
if ((nsoptions.OPTION != NULL) && \
(*nsoptions.OPTION == 0)) { \
free(nsoptions.OPTION); \
nsoptions.OPTION = NULL; \
} \

View File

@ -66,6 +66,8 @@
char *accept_charset; \
/** Preferred maximum size of memory cache / bytes. */ \
int memory_cache_size; \
/** Preferred expiry size of disc cache / bytes. */ \
int disc_cache_size; \
/** Preferred expiry age of disc cache / days. */ \
int disc_cache_age; \
/** Whether to block advertisements */ \
@ -220,6 +222,7 @@
.accept_language = NULL, \
.accept_charset = NULL, \
.memory_cache_size = 12 * 1024 * 1024, \
.disc_cache_size = 1024 * 1024 * 1024, \
.disc_cache_age = 28, \
.block_ads = false, \
.do_not_track = false, \
@ -315,6 +318,7 @@
{ "accept_language", OPTION_STRING, &nsoptions.accept_language }, \
{ "accept_charset", OPTION_STRING, &nsoptions.accept_charset }, \
{ "memory_cache_size", OPTION_INTEGER, &nsoptions.memory_cache_size }, \
{ "disc_cache_size", OPTION_INTEGER, &nsoptions.disc_cache_size }, \
{ "disc_cache_age", OPTION_INTEGER, &nsoptions.disc_cache_age }, \
{ "block_advertisements", OPTION_BOOL, &nsoptions.block_ads }, \
{ "do_not_track", OPTION_BOOL, &nsoptions.do_not_track }, \

View File

@ -112,7 +112,7 @@ S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \
selection.c history.c window.c filetype.c download.c menu.c \
print.c search.c tabs.c theme.c toolbar.c \
compat.c cookies.c hotlist.c system_colour.c \
$(addprefix dialogs/,options.c about.c source.c)
$(addprefix dialogs/,preferences.c about.c source.c)
S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
# code in utils/container.ch is non-universal it seems

File diff suppressed because it is too large Load Diff

1082
gtk/dialogs/preferences.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
/*
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
* Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
* Copyright 2012 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@ -17,18 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NETSURF_GTK_OPTIONS_H
#define NETSURF_GTK_OPTIONS_H
#ifndef NETSURF_GTK_PREFERENCES_H
#define NETSURF_GTK_PREFERENCES_H
#include <gtk/gtk.h>
extern GtkDialog *wndPreferences;
/** Initialise prefernces window
*/
GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent);
GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent);
/** Init options and load window */
void nsgtk_options_load(void); /** Load current options into window */
void nsgtk_options_save(void); /** Save options from window */
bool nsgtk_options_combo_theme_add(const char *themename);
/** add new theme name to combo */
/** Theme added
*/
void nsgtk_preferences_theme_add(const char *themename);
#endif

View File

@ -59,7 +59,6 @@
#include "desktop/tree.h"
#include "css/utils.h"
#include "gtk/compat.h"
#include "gtk/dialogs/options.h"
#include "gtk/completion.h"
#include "gtk/cookies.h"
#include "gtk/download.h"
@ -85,6 +84,7 @@ char *toolbar_indices_file_location;
char *res_dir_location;
char *print_options_file_location;
char *languages_file_location;
char *themelist_file_location;
GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */
@ -364,6 +364,17 @@ static void gui_init(int argc, char** argv, char **respath)
die("Unable to find resources.\n");
}
/* find the theme list file */
themelist_file_location = filepath_find(respath, "themelist");
if ((themelist_file_location != NULL) &&
(strlen(themelist_file_location) < 10)) {
free(themelist_file_location);
themelist_file_location = NULL;
}
if (themelist_file_location == NULL) {
LOG(("Unable to find themelist - disabling"));
}
/* Obtain resources path location.
*
* Uses the directory the languages file was found in,

View File

@ -54,6 +54,7 @@ extern char *toolbar_indices_file_location;
extern char *options_file_location; /**< location where user options are written */
extern char *res_dir_location;
extern char *print_options_file_location;
extern char *themelist_file_location;
extern GdkPixbuf *favicon_pixbuf; /* favicon default pixbuf */

View File

@ -9,6 +9,9 @@
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<signal name="destroy" handler="nsgtk_preferences_dialogPreferences_destroy"/>
<signal name="response" handler="nsgtk_preferences_dialogPreferences_response"/>
<signal name="delete_event" handler="nsgtk_preferences_dialogPreferences_deleteevent"/>
<child internal-child="vbox">
<object class="GtkVBox" id="vbox_dialog">
<property name="visible">True</property>
@ -59,6 +62,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="nsgtk_preferences_entryHomePageURL_changed"/>
<signal name="realize" handler="nsgtk_preferences_entryHomePageURL_realize"/>
</object>
<packing>
<property name="pack_type">end</property>
@ -83,11 +88,13 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="nsgtk_preferences_setCurrentPage_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -96,17 +103,18 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="nsgtk_preferences_setDefaultPage_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@ -151,6 +159,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkUrlSearch_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkUrlSearch_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -175,6 +185,8 @@
<object class="GtkComboBox" id="comboSearch">
<property name="visible">True</property>
<property name="model">liststore_search_provider</property>
<signal name="changed" handler="nsgtk_preferences_comboSearch_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboSearch_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
@ -232,6 +244,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkClearDownloads_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkClearDownloads_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -245,6 +259,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkRequestOverwrite_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkRequestOverwrite_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -269,6 +285,8 @@
<object class="GtkFileChooserButton" id="fileChooserDownloads">
<property name="visible">True</property>
<property name="action">select-folder</property>
<signal name="selection_changed" handler="nsgtk_preferences_fileChooserDownloads_selectionchanged"/>
<signal name="realize" handler="nsgtk_preferences_fileChooserDownloads_realize"/>
</object>
<packing>
<property name="position">1</property>
@ -330,14 +348,29 @@
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<placeholder/>
<object class="GtkComboBox" id="comboTheme">
<property name="visible">True</property>
<property name="model">liststore_themes</property>
<signal name="changed" handler="nsgtk_preferences_comboTheme_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboTheme_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext9"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="buttonaddtheme">
<object class="GtkButton" id="buttonAddTheme">
<property name="label" translatable="yes">Add Theme...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="nsgtk_preferences_buttonAddTheme_clicked"/>
</object>
<packing>
<property name="expand">False</property>
@ -386,6 +419,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkShowSingleTab_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkShowSingleTab_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -398,6 +433,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkFocusNew_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkFocusNew_toggled"/>
</object>
<packing>
<property name="position">1</property>
@ -410,6 +447,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkNewBlank_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkNewBlank_toggled"/>
</object>
<packing>
<property name="position">2</property>
@ -434,6 +473,8 @@
<object class="GtkComboBox" id="comboTabPosition">
<property name="visible">True</property>
<property name="model">liststore_tab_position</property>
<signal name="changed" handler="nsgtk_preferences_comboTabPosition_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboTabPosition_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
@ -503,10 +544,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.54000002145767212</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">sourceButtonTab</property>
<signal name="realize" handler="nsgtk_preferences_sourceButtonWindow_realize"/>
<signal name="toggled" handler="nsgtk_preferences_sourceButtonWindow_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -520,6 +562,8 @@
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_sourceButtonTab_realize"/>
<signal name="toggled" handler="nsgtk_preferences_sourceButtonTab_toggled"/>
</object>
<packing>
<property name="position">1</property>
@ -571,6 +615,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkDisplayRecentURLs_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkDisplayRecentURLs_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -628,6 +674,8 @@
<object class="GtkComboBox" id="comboButtonType">
<property name="visible">True</property>
<property name="model">liststore_toolbar_buttontype</property>
<signal name="changed" handler="nsgtk_preferences_comboButtonType_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboButtonType_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
@ -705,6 +753,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkDisablePopups_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkDisablePopups_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -719,6 +769,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkHideAdverts_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkHideAdverts_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -733,6 +785,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkEnableJavascript_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkEnableJavascript_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -747,6 +801,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkDisablePlugins_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkDisablePlugins_toggled"/>
</object>
<packing>
<property name="expand">False</property>
@ -761,6 +817,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkResampleImages_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkResampleImages_toggled"/>
</object>
<packing>
<property name="position">4</property>
@ -784,6 +842,8 @@
<object class="GtkComboBox" id="comboboxLoadImages">
<property name="visible">True</property>
<property name="model">liststore_image_loading</property>
<signal name="changed" handler="nsgtk_preferences_comboboxLoadImages_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboboxLoadImages_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext4"/>
<attributes>
@ -841,6 +901,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkEnableAnimations_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkEnableAnimations_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -872,6 +934,8 @@
<property name="digits">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="value_changed" handler="nsgtk_preferences_spinAnimationSpeed_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinAnimationSpeed_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -934,6 +998,8 @@
<object class="GtkComboBox" id="comboDefault">
<property name="visible">True</property>
<property name="model">liststore_defaultfont</property>
<signal name="changed" handler="nsgtk_preferences_comboDefault_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboDefault_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext5"/>
<attributes>
@ -970,12 +1036,15 @@
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">The base-line font size to use.</property>
<property name="max_length">3</property>
<property name="max_length">4</property>
<property name="invisible_char">&#x25CF;</property>
<property name="width_chars">3</property>
<property name="width_chars">4</property>
<property name="adjustment">adjustment_font_default_size</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinDefaultSize_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinDefaultSize_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -996,6 +1065,7 @@
<property name="receives_default">True</property>
<property name="image">image1</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="nsgtk_preferences_fontPreview_clicked"/>
</object>
<packing>
<property name="expand">False</property>
@ -1055,6 +1125,8 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">set preferred language for web pages</property>
<property name="model">liststore_content_language</property>
<signal name="changed" handler="nsgtk_preferences_comboboxLanguage_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboboxLanguage_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext7">
<property name="xalign">0</property>
@ -1118,6 +1190,68 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFrame" id="frame_privacy_general">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment20">
<property name="visible">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<object class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="checkSendReferer">
<property name="label" translatable="yes">Enable referral submission</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkSendReferer_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkSendReferer_toggled"/>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkSendDNT">
<property name="label" translatable="yes">Enable sending "Do Not Track" request</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkSendDNT_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkSendDNT_toggled"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label61">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame_privacy_history">
<property name="visible">True</property>
@ -1141,6 +1275,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkHoverURLs_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkHoverURLs_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -1170,6 +1306,9 @@
<property name="adjustment">adjustment_history_age</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="value_changed" handler="nsgtk_preferences_spinHistoryAge_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinHistoryAge_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -1206,7 +1345,7 @@
<packing>
<property name="expand">False</property>
<property name="padding">6</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -1275,6 +1414,8 @@
<property name="adjustment">adjustment_cache_memory_size</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMemoryCacheSize_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMemoryCacheSize_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1291,6 +1432,8 @@
<property name="adjustment">adjustment_cache_disc_size</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinDiscCacheSize_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinDiscCacheSize_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1309,6 +1452,8 @@
<property name="adjustment">adjustment_disc_cache_age</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinDiscCacheAge_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinDiscCacheAge_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1401,63 +1546,6 @@
<packing>
<property name="expand">False</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame_privacy_general">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment20">
<property name="visible">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<object class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="checkSendReferer">
<property name="label" translatable="yes">Enable referral submission</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkSendDNT">
<property name="label" translatable="yes">Enable sending "Do Not Track" request</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label61">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
@ -1551,6 +1639,8 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">The type of HTTP proxy server.</property>
<property name="model">liststore_proxy_type</property>
<signal name="changed" handler="nsgtk_preferences_comboProxyType_changed"/>
<signal name="realize" handler="nsgtk_preferences_comboProxyType_realize"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
@ -1574,6 +1664,8 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Host name of your proxy server.</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="nsgtk_preferences_entryProxyHost_changed"/>
<signal name="realize" handler="nsgtk_preferences_entryProxyHost_realize"/>
</object>
<packing>
<property name="position">0</property>
@ -1602,6 +1694,8 @@
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<property name="update_policy">if-valid</property>
<signal name="value_changed" handler="nsgtk_preferences_spinProxyPort_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinProxyPort_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -1623,6 +1717,8 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Username to access the proxy</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="nsgtk_preferences_entryProxyUser_changed"/>
<signal name="realize" handler="nsgtk_preferences_entryProxyUser_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1637,7 +1733,10 @@
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Password to access the proxy</property>
<property name="visibility">False</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="nsgtk_preferences_entryProxyPassword_changed"/>
<signal name="realize" handler="nsgtk_preferences_entryProxyPassword_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1727,6 +1826,8 @@
<property name="adjustment">adjustment_fetching_max</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMaxFetchers_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMaxFetchers_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1745,6 +1846,8 @@
<property name="adjustment">adjustment_fetching_perhost</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinFetchesPerHost_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinFetchesPerHost_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1765,6 +1868,8 @@
<property name="adjustment">adjustment_fetching_cached</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinCachedConnections_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinCachedConnections_realize"/>
</object>
<packing>
<property name="left_attach">1</property>
@ -1835,6 +1940,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkSuppressImages_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkSuppressImages_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -1847,6 +1954,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkRemoveBackgrounds_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkRemoveBackgrounds_toggled"/>
</object>
<packing>
<property name="position">1</property>
@ -1859,6 +1968,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkFitPage_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkFitPage_toggled"/>
</object>
<packing>
<property name="position">2</property>
@ -1889,6 +2000,8 @@
<property name="adjustment">adjustment_pdf_scale</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinExportScale_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinExportScale_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -1995,6 +2108,8 @@
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMarginTop_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMarginTop_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -2034,6 +2149,8 @@
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMarginLeft_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMarginLeft_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -2072,6 +2189,8 @@
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMarginBottom_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMarginBottom_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -2112,6 +2231,8 @@
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
<signal name="value_changed" handler="nsgtk_preferences_spinMarginRight_valuechanged"/>
<signal name="realize" handler="nsgtk_preferences_spinMarginRight_realize"/>
</object>
<packing>
<property name="expand">False</property>
@ -2188,6 +2309,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkCompressPDF_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkCompressPDF_toggled"/>
</object>
<packing>
<property name="position">0</property>
@ -2200,6 +2323,8 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="realize" handler="nsgtk_preferences_checkPasswordPDF_realize"/>
<signal name="toggled" handler="nsgtk_preferences_checkPasswordPDF_toggled"/>
</object>
<packing>
<property name="position">1</property>
@ -2481,9 +2606,9 @@
<object class="GtkAdjustment" id="adjustment_font_default_size">
<property name="value">16</property>
<property name="lower">1</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
<property name="upper">99.900000000000006</property>
<property name="step_increment">0.10000000000000001</property>
<property name="page_increment">2</property>
</object>
<object class="GtkAdjustment" id="adjustment_history_age">
<property name="value">28</property>
@ -2562,4 +2687,15 @@
</row>
</data>
</object>
<object class="GtkListStore" id="liststore_themes">
<columns>
<!-- column-name Theme -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Default</col>
</row>
</data>
</object>
</interface>

View File

@ -53,7 +53,7 @@
#include "desktop/tree.h"
#include "gtk/cookies.h"
#include "gtk/completion.h"
#include "gtk/dialogs/options.h"
#include "gtk/dialogs/preferences.h"
#include "gtk/dialogs/about.h"
#include "gtk/dialogs/source.h"
#include "gtk/bitmap.h"
@ -138,7 +138,6 @@ struct gtk_scaffolding {
GtkBuilder *xml;
struct gtk_history_window *history_window;
GtkDialog *preferences_dialog;
int throb_frame;
struct gui_window *top_level;
@ -1027,10 +1026,12 @@ MULTIHANDLER(find)
MULTIHANDLER(preferences)
{
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (g->preferences_dialog == NULL)
g->preferences_dialog = nsgtk_options_init(bw, g->window);
else
gtk_widget_show(GTK_WIDGET(g->preferences_dialog));
GtkWidget* wndpreferences;
wndpreferences = nsgtk_preferences(bw, g->window);
if (wndpreferences != NULL) {
gtk_widget_show(GTK_WIDGET(wndpreferences));
}
return TRUE;
}
@ -1769,8 +1770,6 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
g->menu_bar = nsgtk_menu_bar_create(GTK_MENU_SHELL(gtk_builder_get_object(g->xml, "menubar")), group);
g->preferences_dialog = NULL;
/* set this window's size and position to what's in the options, or
* or some sensible default if they're not set yet.
*/

View File

@ -32,7 +32,7 @@
#include "gtk/theme.h"
#include "gtk/window.h"
#include "desktop/options.h"
#include "gtk/dialogs/options.h"
#include "gtk/dialogs/preferences.h"
#include "utils/container.h"
#include "utils/log.h"
#include "utils/messages.h"
@ -157,28 +157,32 @@ static bool nsgtk_theme_verify(const char *themename)
void nsgtk_theme_init(void)
{
size_t len;
if (nsoption_int(current_theme) == 0) {
int theme;
nsgtk_scaffolding *list = scaf_list;
FILE *fp;
char buf[50];
int row_count = 0;
theme = nsoption_int(current_theme);
/* check if default theme is selected */
if (theme == 0) {
return;
}
len = SLEN("themelist") + strlen(res_dir_location) + 1;
char themefile[len];
snprintf(themefile, len, "%s%s", res_dir_location, "themelist");
nsgtk_scaffolding *list = scaf_list;
nsgtk_theme_verify(NULL);
FILE *fp = fopen(themefile, "r");
fp = fopen(themelist_file_location, "r");
if (fp == NULL)
return;
char buf[50];
int row_count = 0;
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (buf[0] == '\0')
continue;
if (row_count++ == nsoption_int(current_theme)) {
if (current_theme_name != NULL)
if (row_count++ == theme) {
if (current_theme_name != NULL) {
free(current_theme_name);
}
/* clear the '\n' ["\n\0"->"\0\0"] */
buf[strlen(buf) - 1] = '\0';
current_theme_name = strdup(buf);
@ -204,13 +208,25 @@ char *nsgtk_theme_name(void)
}
/**
* set static global current_theme_name from param; caller is responsible
* for the integrity of the global reference
* set static global current_theme_name from param
*/
void nsgtk_theme_set_name(char *name)
void nsgtk_theme_set_name(const char *name)
{
current_theme_name = name;
if ((name == NULL) && (current_theme_name == NULL)) {
return; /* setting it to the same thing */
} else if ((name == NULL) && (current_theme_name != NULL)) {
free(current_theme_name);
current_theme_name = NULL;
} else if ((name != NULL) && (current_theme_name == NULL)) {
current_theme_name = strdup(name);
nsgtk_theme_prepare();
} else if (strcmp(name, current_theme_name) != 0) {
/* disimilar new name */
free(current_theme_name);
current_theme_name = strdup(name);
nsgtk_theme_prepare();
}
}
/**
@ -260,9 +276,7 @@ void nsgtk_theme_add(const char *themename)
gtk_widget_show_all(notification);
/* update combo */
if (wndPreferences != NULL) {
nsgtk_options_combo_theme_add(themename);
}
nsgtk_preferences_theme_add(themename);
}

View File

@ -41,6 +41,6 @@ void nsgtk_theme_init(void);
void nsgtk_theme_prepare(void);
void nsgtk_theme_implement(struct gtk_scaffolding *g);
char *nsgtk_theme_name(void);
void nsgtk_theme_set_name(char *name);
void nsgtk_theme_set_name(const char *name);
#endif