From 34605af38652a10bf440d229c55f24986a63f222 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 7 Sep 2007 15:52:31 +0000 Subject: [PATCH] Replace 'Use tabs...' preference checkbox with Tabs, Spaces radio buttons (should be a bit clearer). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1858 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ geany.glade | 53 +++++++++++++++++++++++++++++++++++++++---------- src/interface.c | 30 +++++++++++++++++++++------- src/prefs.c | 9 ++++++--- 4 files changed, 75 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 317533817..d9b09e867 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ Add fixed keybindings for switching to leftmost/rightmost document, Ctrl-Shift-{PageUp,PageDown}. Docs: Add 'Switching documents' keybindings section. + * src/interface.c, src/prefs.c, geany.glade: + Replace 'Use tabs...' preference checkbox with Tabs, Spaces radio + buttons (should be a bit clearer). 2007-09-05 Enrico Tröger diff --git a/geany.glade b/geany.glade index bea4ae2fe..939134a8d 100644 --- a/geany.glade +++ b/geany.glade @@ -5449,17 +5449,50 @@ Bottom 0 - + True - Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces. - True - Use tabs when inserting whitespace - True - GTK_RELIEF_NORMAL - False - False - False - True + False + 12 + + + + True + Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces. + True + Tabs + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Spaces + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_indent_tabs + + + 0 + False + False + + 0 diff --git a/src/interface.c b/src/interface.c index 73cfc86fb..d49d2dd90 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2533,7 +2533,10 @@ create_prefs_dialog (void) GtkWidget *frame27; GtkWidget *alignment30; GtkWidget *vbox25; - GtkWidget *check_use_tabs; + GtkWidget *hbox8; + GtkWidget *radio_indent_tabs; + GSList *radio_indent_tabs_group = NULL; + GtkWidget *radio_indent_spaces; GtkWidget *table13; GtkWidget *label116; GtkWidget *label183; @@ -3450,11 +3453,22 @@ create_prefs_dialog (void) gtk_widget_show (vbox25); gtk_container_add (GTK_CONTAINER (alignment30), vbox25); - check_use_tabs = gtk_check_button_new_with_mnemonic (_("Use tabs when inserting whitespace")); - gtk_widget_show (check_use_tabs); - gtk_box_pack_start (GTK_BOX (vbox25), check_use_tabs, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, check_use_tabs, _("Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces."), NULL); - gtk_button_set_focus_on_click (GTK_BUTTON (check_use_tabs), FALSE); + hbox8 = gtk_hbox_new (FALSE, 12); + gtk_widget_show (hbox8); + gtk_box_pack_start (GTK_BOX (vbox25), hbox8, FALSE, FALSE, 0); + + radio_indent_tabs = gtk_radio_button_new_with_mnemonic (NULL, _("Tabs")); + gtk_widget_show (radio_indent_tabs); + gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_tabs, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Whenever some whitespace is inserted by Geany it will use tabs when enabled otherwise Geany will use just spaces."), NULL); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_tabs_group); + radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs)); + + radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("Spaces")); + gtk_widget_show (radio_indent_spaces); + gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_spaces, FALSE, FALSE, 0); + gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_tabs_group); + radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces)); table13 = gtk_table_new (2, 2, FALSE); gtk_widget_show (table13); @@ -4289,7 +4303,9 @@ create_prefs_dialog (void) GLADE_HOOKUP_OBJECT (prefs_dialog, frame27, "frame27"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment30, "alignment30"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox25, "vbox25"); - GLADE_HOOKUP_OBJECT (prefs_dialog, check_use_tabs, "check_use_tabs"); + GLADE_HOOKUP_OBJECT (prefs_dialog, hbox8, "hbox8"); + GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_tabs, "radio_indent_tabs"); + GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_spaces, "radio_indent_spaces"); GLADE_HOOKUP_OBJECT (prefs_dialog, table13, "table13"); GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116"); GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183"); diff --git a/src/prefs.c b/src/prefs.c index 29219e43b..bb166e551 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -307,8 +307,11 @@ void prefs_init_dialog(void) widget = lookup_widget(ui_widgets.prefs_dialog, "check_smart_home"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.smart_home_key); - widget = lookup_widget(ui_widgets.prefs_dialog, "check_use_tabs"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_tabs); + if (editor_prefs.use_tabs) + widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs"); + else + widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_spaces"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators); @@ -681,7 +684,7 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data) widget = lookup_widget(ui_widgets.prefs_dialog, "check_smart_home"); editor_prefs.smart_home_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - widget = lookup_widget(ui_widgets.prefs_dialog, "check_use_tabs"); + widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs"); editor_prefs.use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion");