add option to set tab position

svn path=/trunk/netsurf/; revision=12896
This commit is contained in:
Vincent Sanders 2011-09-26 23:35:06 +00:00
parent e3aceb4344
commit cb27637a41
4 changed files with 2562 additions and 4203 deletions

View File

@ -70,7 +70,6 @@ DECLARE(checkHoverURLs);
DECLARE(checkDisplayRecentURLs); DECLARE(checkDisplayRecentURLs);
DECLARE(comboLanguage); DECLARE(comboLanguage);
DECLARE(checkSendReferer); DECLARE(checkSendReferer);
DECLARE(checkShowSingleTab);
DECLARE(comboProxyType); DECLARE(comboProxyType);
DECLARE(entryProxyHost); DECLARE(entryProxyHost);
@ -103,8 +102,12 @@ DECLARE(spinDiscCacheAge);
DECLARE(checkClearDownloads); DECLARE(checkClearDownloads);
DECLARE(checkRequestOverwrite); DECLARE(checkRequestOverwrite);
DECLARE(fileChooserDownloads); DECLARE(fileChooserDownloads);
/* Tabs */
DECLARE(checkShowSingleTab);
DECLARE(checkFocusNew); DECLARE(checkFocusNew);
DECLARE(checkNewBlank); DECLARE(checkNewBlank);
DECLARE(comboTabPosition);
DECLARE(checkUrlSearch); DECLARE(checkUrlSearch);
DECLARE(comboSearch); DECLARE(comboSearch);
DECLARE(combotheme); DECLARE(combotheme);
@ -199,6 +202,8 @@ GtkDialog* nsgtk_options_init(struct browser_window *bw, GtkWindow *parent)
CONNECT(comboButtonType, "changed"); CONNECT(comboButtonType, "changed");
CONNECT(comboTabPosition, "changed");
CONNECT(spinMemoryCacheSize, "value-changed"); CONNECT(spinMemoryCacheSize, "value-changed");
CONNECT(spinDiscCacheAge, "value-changed"); CONNECT(spinDiscCacheAge, "value-changed");
@ -396,6 +401,8 @@ void nsgtk_options_load(void)
SET_COMBO(comboButtonType, option_button_type -1); SET_COMBO(comboButtonType, option_button_type -1);
SET_COMBO(comboTabPosition, option_position_tab);
SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20); SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20);
SET_SPIN(spinDiscCacheAge, option_disc_cache_age); SET_SPIN(spinDiscCacheAge, option_disc_cache_age);
@ -758,6 +765,19 @@ COMBO_CHANGED(comboButtonType, option_button_type)
} }
END_HANDLER END_HANDLER
COMBO_CHANGED(comboTabPosition, option_position_tab)
nsgtk_scaffolding *current = scaf_list;
option_button_type++;
/* value of 0 is reserved for 'unset' */
while (current) {
nsgtk_scaffolding_reset_offset(current);
nsgtk_reflow_all_windows();
current = nsgtk_scaffolding_iterate(current);
}
END_HANDLER
SPIN_CHANGED(spinMemoryCacheSize, option_memory_cache_size) SPIN_CHANGED(spinMemoryCacheSize, option_memory_cache_size)
option_memory_cache_size <<= 20; option_memory_cache_size <<= 20;
END_HANDLER END_HANDLER

View File

@ -37,6 +37,7 @@ extern bool option_new_blank;
extern char *option_hotlist_path; extern char *option_hotlist_path;
extern bool option_source_tab; extern bool option_source_tab;
extern int option_current_theme; extern int option_current_theme;
extern int option_position_tab;
#define EXTRA_OPTION_DEFINE \ #define EXTRA_OPTION_DEFINE \
bool option_render_resample = true; \ bool option_render_resample = true; \
@ -54,7 +55,8 @@ bool option_focus_new = false; \
bool option_new_blank = false; \ bool option_new_blank = false; \
char *option_hotlist_path = NULL; \ char *option_hotlist_path = NULL; \
bool option_source_tab = false;\ bool option_source_tab = false;\
int option_current_theme = 0; int option_current_theme = 0;\
int option_position_tab = 0;
#define EXTRA_OPTION_TABLE \ #define EXTRA_OPTION_TABLE \
{ "render_resample", OPTION_BOOL, &option_render_resample }, \ { "render_resample", OPTION_BOOL, &option_render_resample }, \
@ -72,6 +74,7 @@ int option_current_theme = 0;
{ "new_blank", OPTION_BOOL, &option_new_blank}, \ { "new_blank", OPTION_BOOL, &option_new_blank}, \
{ "hotlist_path", OPTION_STRING, &option_hotlist_path}, \ { "hotlist_path", OPTION_STRING, &option_hotlist_path}, \
{ "source_tab", OPTION_BOOL, &option_source_tab},\ { "source_tab", OPTION_BOOL, &option_source_tab},\
{ "current_theme", OPTION_INTEGER, &option_current_theme} { "current_theme", OPTION_INTEGER, &option_current_theme}, \
{ "position_tab", OPTION_INTEGER, &option_position_tab}
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -124,6 +124,29 @@ static void nsgtk_tab_page_changed(GtkNotebook *notebook, gpointer *page,
nsgtk_scaffolding_set_top_level(gw); nsgtk_scaffolding_set_top_level(gw);
} }
static void
nsgtk_tab_orientation(GtkNotebook *notebook)
{
switch (option_position_tab) {
case 0:
gtk_notebook_set_tab_pos(notebook, GTK_POS_TOP);
break;
case 1:
gtk_notebook_set_tab_pos(notebook, GTK_POS_LEFT);
break;
case 2:
gtk_notebook_set_tab_pos(notebook, GTK_POS_RIGHT);
break;
case 3:
gtk_notebook_set_tab_pos(notebook, GTK_POS_BOTTOM);
break;
}
}
/** callback to alter tab visibility when pages are added or removed */ /** callback to alter tab visibility when pages are added or removed */
static void static void
nsgtk_tab_visibility_update(GtkNotebook *notebook, GtkWidget *child, guint page) nsgtk_tab_visibility_update(GtkNotebook *notebook, GtkWidget *child, guint page)
@ -139,6 +162,7 @@ nsgtk_tab_visibility_update(GtkNotebook *notebook, GtkWidget *child, guint page)
/* exported interface documented in gtk/tabs.h */ /* exported interface documented in gtk/tabs.h */
void nsgtk_tab_options_changed(GtkNotebook *notebook) void nsgtk_tab_options_changed(GtkNotebook *notebook)
{ {
nsgtk_tab_orientation(notebook);
nsgtk_tab_visibility_update(notebook, NULL, 0); nsgtk_tab_visibility_update(notebook, NULL, 0);
} }