Add Tab Size to preferences dialog
This commit is contained in:
parent
118baa716e
commit
6994580e28
3 changed files with 28 additions and 5 deletions
|
@ -1296,7 +1296,6 @@ CBrowser* browser_new(CBrowser* oldBrowser)
|
|||
browser->webView_name = gtk_label_new(xbel_item_get_title(browser->sessionItem));
|
||||
gtk_misc_set_alignment(GTK_MISC(browser->webView_name), 0.0, 0.5);
|
||||
// TODO: make the tab initially look "unvisited" until it's focused
|
||||
// TODO: tabs should shrink when there is not enough space
|
||||
// TODO: gtk's tab scrolling is weird?
|
||||
gint w, h;
|
||||
sokoke_widget_get_text_size(browser->webView_name, "M", &w, &h);
|
||||
|
|
|
@ -28,7 +28,6 @@ typedef struct _CConfig
|
|||
gboolean panelShow;
|
||||
guint panelActive;
|
||||
gchar* panelPageholder;
|
||||
// TODO: What about this? Support it or fix tab shrinking and drop it?
|
||||
guint tabSize; // tab size in charcters
|
||||
gboolean tabClose;
|
||||
gboolean toolbarWebSearch;
|
||||
|
|
31
src/prefs.c
31
src/prefs.c
|
@ -99,7 +99,7 @@ static void on_prefs_toolbarSmall_toggled(GtkWidget* widget, CPrefs* prefs)
|
|||
, config_to_toolbariconsize(config->toolbarSmall));
|
||||
}
|
||||
|
||||
static void on_prefs_closeButtonsOnTabs_toggled(GtkWidget* widget, CPrefs* prefs)
|
||||
static void on_prefs_tabClose_toggled(GtkWidget* widget, CPrefs* prefs)
|
||||
{
|
||||
config->tabClose = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
GList* items = browsers;
|
||||
|
@ -112,6 +112,22 @@ static void on_prefs_closeButtonsOnTabs_toggled(GtkWidget* widget, CPrefs* prefs
|
|||
g_list_free(items);
|
||||
}
|
||||
|
||||
static void on_prefs_tabSize_changed(GtkWidget* widget, CPrefs* prefs)
|
||||
{
|
||||
config->tabSize = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
|
||||
gint w, h;
|
||||
sokoke_widget_get_text_size(prefs->browser->webView_name, "M", &w, &h);
|
||||
GList* items = browsers;
|
||||
do
|
||||
{
|
||||
CBrowser* browser = (CBrowser*)items->data;
|
||||
gtk_widget_set_size_request(GTK_WIDGET(browser->webView_name)
|
||||
, w * config->tabSize, -1);
|
||||
}
|
||||
while((items = g_list_next(items)));
|
||||
g_list_free(items);
|
||||
}
|
||||
|
||||
static void on_prefs_toolbarWebSearch_toggled(GtkWidget* widget, CPrefs* prefs)
|
||||
{
|
||||
config->toolbarWebSearch = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
@ -487,8 +503,17 @@ GtkWidget* prefs_preferences_dialog_new(CBrowser* browser)
|
|||
("Show close _buttons on tabs");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton), config->tabClose);
|
||||
g_signal_connect(checkbutton, "toggled"
|
||||
, G_CALLBACK(on_prefs_closeButtonsOnTabs_toggled), prefs);
|
||||
SPANNED_ADD(checkbutton, 0, 2, 0, 1);
|
||||
, G_CALLBACK(on_prefs_tabClose_toggled), prefs);
|
||||
SPANNED_ADD(checkbutton, 0, 1, 0, 1);
|
||||
hbox = gtk_hbox_new(FALSE, 4);
|
||||
gtk_box_pack_start(GTK_BOX(hbox)
|
||||
, gtk_label_new_with_mnemonic("Tab Si_ze"), FALSE, FALSE, 0);
|
||||
spinbutton = gtk_spin_button_new_with_range(0, 36, 1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), config->tabSize);
|
||||
g_signal_connect(spinbutton, "changed"
|
||||
, G_CALLBACK(on_prefs_tabSize_changed), prefs);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), spinbutton, FALSE, FALSE, 0);
|
||||
FILLED_ADD(hbox, 1, 2, 0, 1);
|
||||
INDENTED_ADD(gtk_label_new_with_mnemonic("Tabbar _placement"), 0, 1, 1, 2);
|
||||
combobox = gtk_combo_box_new_text();
|
||||
sokoke_combo_box_add_strings(GTK_COMBO_BOX(combobox)
|
||||
|
|
Loading…
Reference in a new issue