Kaydet (Commit) f0d2f92e authored tarafından Nick Treleaven's avatar Nick Treleaven

Add Project Indentation prefs, which override the Editor

Preferences dialog options. For new projects, these default to the
editor indent prefs.
- Plugins:
For compatibility with this change, use editor_get_indent_prefs().
- Code changes:
The Project Properties dialog is now created by Glade, but (for
now) the existing options are added manually.
Add GeanyProjectPrivate project field.
Add stash_group_set_use_defaults().



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3423 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst b0fe5795
2008-12-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/interface.c, src/interface.h, src/project.c, src/project.h,
src/projectprivate.h, src/stash.c, src/stash.h, src/main.c,
src/editor.c, src/Makefile.am, geany.glade:
Add Project Indentation prefs, which override the Editor
Preferences dialog options. For new projects, these default to the
editor indent prefs.
- Plugins:
For compatibility with this change, use editor_get_indent_prefs().
- Code changes:
The Project Properties dialog is now created by Glade, but (for
now) the existing options are added manually.
Add GeanyProjectPrivate project field.
Add stash_group_set_use_defaults().
2008-12-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/stash.c, src/stash.h, src/keyfile.c:
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
EXTRA_DIST = images.c gb.c win32.c win32.h plugindata.h \
documentprivate.h
documentprivate.h projectprivate.h
bin_PROGRAMS = geany
......
......@@ -57,6 +57,8 @@
#include "geanyobject.h"
#include "templates.h"
#include "keybindings.h"
#include "project.h"
#include "projectprivate.h"
/* Note: Avoid using SSM in files not related to scintilla, use sciwrappers.h instead. */
......@@ -817,8 +819,10 @@ get_whitespace(const GeanyIndentPrefs *iprefs, gint width)
static const GeanyIndentPrefs *
get_default_indent_prefs(void)
{
/* In future this might depend on the current project. */
return editor_prefs.indentation;
static GeanyIndentPrefs iprefs;
iprefs = app->project ? *app->project->priv->indentation : *editor_prefs.indentation;
return &iprefs;
}
......
......@@ -4848,3 +4848,197 @@ create_prefs_dialog (void)
return prefs_dialog;
}
GtkWidget*
create_project_dialog (void)
{
GtkWidget *project_dialog;
GtkWidget *dialog_vbox4;
GtkWidget *project_notebook;
GtkWidget *table17;
GtkWidget *label228;
GtkWidget *combo_auto_indent_mode;
GtkWidget *label229;
GtkWidget *label230;
GtkObject *spin_indent_width_adj;
GtkWidget *spin_indent_width;
GtkWidget *radio_indent_spaces;
GSList *radio_indent_spaces_group = NULL;
GtkWidget *radio_indent_tabs;
GtkWidget *radio_indent_both;
GtkWidget *alignment44;
GtkWidget *hbox14;
GtkWidget *label231;
GtkObject *spin_tab_width_adj;
GtkWidget *spin_tab_width;
GtkWidget *check_detect_indent;
GtkWidget *label227;
GtkWidget *dialog_action_area4;
GtkWidget *cancelbutton1;
GtkWidget *okbutton1;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
project_dialog = gtk_dialog_new ();
gtk_window_set_title (GTK_WINDOW (project_dialog), _("Project Properties"));
gtk_window_set_type_hint (GTK_WINDOW (project_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
dialog_vbox4 = GTK_DIALOG (project_dialog)->vbox;
gtk_widget_show (dialog_vbox4);
project_notebook = gtk_notebook_new ();
gtk_widget_show (project_notebook);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), project_notebook, TRUE, TRUE, 0);
table17 = gtk_table_new (7, 2, FALSE);
gtk_widget_show (table17);
gtk_container_add (GTK_CONTAINER (project_notebook), table17);
gtk_container_set_border_width (GTK_CONTAINER (table17), 6);
gtk_table_set_row_spacings (GTK_TABLE (table17), 3);
gtk_table_set_col_spacings (GTK_TABLE (table17), 24);
label228 = gtk_label_new (_("Auto-indent mode:"));
gtk_widget_show (label228);
gtk_table_attach (GTK_TABLE (table17), label228, 0, 1, 6, 7,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label228), 0, 0.5);
combo_auto_indent_mode = gtk_combo_box_new_text ();
gtk_widget_show (combo_auto_indent_mode);
gtk_table_attach (GTK_TABLE (table17), combo_auto_indent_mode, 1, 2, 6, 7,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Basic"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Current chars"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Match braces"));
label229 = gtk_label_new (_("Type:"));
gtk_widget_show (label229);
gtk_table_attach (GTK_TABLE (table17), label229, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label229), 0, 0.5);
label230 = gtk_label_new (_("Width:"));
gtk_widget_show (label230);
gtk_table_attach (GTK_TABLE (table17), label230, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label230), 0, 0.5);
spin_indent_width_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 0);
spin_indent_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_indent_width_adj), 1, 0);
gtk_widget_show (spin_indent_width);
gtk_table_attach (GTK_TABLE (table17), spin_indent_width, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_tooltips_set_tip (tooltips, spin_indent_width, _("The width in chars of a single indent"), NULL);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_indent_width), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("_Spaces"));
gtk_widget_show (radio_indent_spaces);
gtk_table_attach (GTK_TABLE (table17), radio_indent_spaces, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_tooltips_set_tip (tooltips, radio_indent_spaces, _("Use spaces when inserting indentation"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_spaces_group);
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces));
radio_indent_tabs = gtk_radio_button_new_with_mnemonic (NULL, _("_Tabs"));
gtk_widget_show (radio_indent_tabs);
gtk_table_attach (GTK_TABLE (table17), radio_indent_tabs, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Use one tab per indent"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_spaces_group);
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs));
radio_indent_both = gtk_radio_button_new_with_mnemonic (NULL, _("T_abs and Spaces"));
gtk_widget_show (radio_indent_both);
gtk_table_attach (GTK_TABLE (table17), radio_indent_both, 1, 2, 3, 4,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_tooltips_set_tip (tooltips, radio_indent_both, _("Use spaces if the total indent is less than the tab width, otherwise use both"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_both), radio_indent_spaces_group);
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_both));
alignment44 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_show (alignment44);
gtk_table_attach (GTK_TABLE (table17), alignment44, 1, 2, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment44), 0, 0, 24, 0);
hbox14 = gtk_hbox_new (FALSE, 12);
gtk_widget_show (hbox14);
gtk_container_add (GTK_CONTAINER (alignment44), hbox14);
label231 = gtk_label_new (_("Hard tab width:"));
gtk_widget_show (label231);
gtk_box_pack_start (GTK_BOX (hbox14), label231, FALSE, FALSE, 0);
spin_tab_width_adj = gtk_adjustment_new (8, 1, 99, 1, 10, 0);
spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0);
gtk_widget_show (spin_tab_width);
gtk_box_pack_start (GTK_BOX (hbox14), spin_tab_width, TRUE, TRUE, 0);
gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width of a tab when Tabs & Spaces is set for a document"), NULL);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
check_detect_indent = gtk_check_button_new_with_mnemonic (_("Detect from file"));
gtk_widget_show (check_detect_indent);
gtk_table_attach (GTK_TABLE (table17), check_detect_indent, 1, 2, 5, 6,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_tooltips_set_tip (tooltips, check_detect_indent, _("Whether to detect the indentation type from file contents when a file is opened."), NULL);
label227 = gtk_label_new (_("Indentation"));
gtk_widget_show (label227);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (project_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (project_notebook), 0), label227);
dialog_action_area4 = GTK_DIALOG (project_dialog)->action_area;
gtk_widget_show (dialog_action_area4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);
cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_show (cancelbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (project_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
okbutton1 = gtk_button_new_from_stock ("gtk-ok");
gtk_widget_show (okbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (project_dialog), okbutton1, GTK_RESPONSE_OK);
GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, project_dialog, "project_dialog");
GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, dialog_vbox4, "dialog_vbox4");
GLADE_HOOKUP_OBJECT (project_dialog, project_notebook, "project_notebook");
GLADE_HOOKUP_OBJECT (project_dialog, table17, "table17");
GLADE_HOOKUP_OBJECT (project_dialog, label228, "label228");
GLADE_HOOKUP_OBJECT (project_dialog, combo_auto_indent_mode, "combo_auto_indent_mode");
GLADE_HOOKUP_OBJECT (project_dialog, label229, "label229");
GLADE_HOOKUP_OBJECT (project_dialog, label230, "label230");
GLADE_HOOKUP_OBJECT (project_dialog, spin_indent_width, "spin_indent_width");
GLADE_HOOKUP_OBJECT (project_dialog, radio_indent_spaces, "radio_indent_spaces");
GLADE_HOOKUP_OBJECT (project_dialog, radio_indent_tabs, "radio_indent_tabs");
GLADE_HOOKUP_OBJECT (project_dialog, radio_indent_both, "radio_indent_both");
GLADE_HOOKUP_OBJECT (project_dialog, alignment44, "alignment44");
GLADE_HOOKUP_OBJECT (project_dialog, hbox14, "hbox14");
GLADE_HOOKUP_OBJECT (project_dialog, label231, "label231");
GLADE_HOOKUP_OBJECT (project_dialog, spin_tab_width, "spin_tab_width");
GLADE_HOOKUP_OBJECT (project_dialog, check_detect_indent, "check_detect_indent");
GLADE_HOOKUP_OBJECT (project_dialog, label227, "label227");
GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, dialog_action_area4, "dialog_action_area4");
GLADE_HOOKUP_OBJECT (project_dialog, cancelbutton1, "cancelbutton1");
GLADE_HOOKUP_OBJECT (project_dialog, okbutton1, "okbutton1");
GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, tooltips, "tooltips");
return project_dialog;
}
......@@ -6,3 +6,4 @@ GtkWidget* create_window1 (void);
GtkWidget* create_toolbar_popup_menu1 (void);
GtkWidget* create_edit_menu1 (void);
GtkWidget* create_prefs_dialog (void);
GtkWidget* create_project_dialog (void);
......@@ -919,6 +919,7 @@ gint main(gint argc, gchar **argv)
encodings_init();
editor_init();
project_init();
configuration_init();
search_init();
......@@ -1051,6 +1052,7 @@ void main_quit()
build_finalize();
document_finalize();
symbols_finalize();
project_finalize();
editor_finalize();
editor_snippets_free();
encodings_finalize();
......
......@@ -31,6 +31,8 @@
#include <unistd.h>
#include "project.h"
#include "projectprivate.h"
#include "dialogs.h"
#include "support.h"
#include "utils.h"
......@@ -44,10 +46,19 @@
#endif
#include "build.h"
#include "geanyobject.h"
#include "interface.h"
#include "editor.h"
#include "stash.h"
ProjectPrefs project_prefs = { NULL, FALSE, FALSE };
static GeanyProjectPrivate priv;
static GeanyIndentPrefs indentation;
static GeanyPrefGroup *indent_group = NULL;
static struct
{
gchar *project_file_path; /* in UTF-8 */
......@@ -341,23 +352,20 @@ void project_close(gboolean open_default)
static void create_properties_dialog(PropertyDialogElements *e)
{
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *table, *notebook;
GtkWidget *image;
GtkWidget *button;
GtkWidget *bbox;
GtkWidget *label;
GtkWidget *swin;
e->dialog = gtk_dialog_new_with_buttons(_("Project Properties"), GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
gtk_dialog_add_buttons(GTK_DIALOG(e->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
e->dialog = create_project_dialog();
gtk_window_set_transient_for(GTK_WINDOW(e->dialog), GTK_WINDOW(main_widgets.window));
gtk_window_set_destroy_with_parent(GTK_WINDOW(e->dialog), TRUE);
gtk_widget_set_name(e->dialog, "GeanyDialogProject");
vbox = ui_dialog_vbox_new(GTK_DIALOG(e->dialog));
table = gtk_table_new(6, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 6);
gtk_table_set_row_spacings(GTK_TABLE(table), 5);
gtk_table_set_col_spacings(GTK_TABLE(table), 10);
......@@ -465,7 +473,11 @@ static void create_properties_dialog(PropertyDialogElements *e)
(GtkAttachOptions) (0), 0, 0);
#endif
gtk_container_add(GTK_CONTAINER(vbox), table);
notebook = ui_lookup_widget(e->dialog, "project_notebook");
label = gtk_label_new(_("Project"));
gtk_widget_show(table); /* needed to switch current page */
gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 0);
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
}
......@@ -481,6 +493,8 @@ void project_properties()
create_properties_dialog(e);
stash_group_display(indent_group, e->dialog);
/* fill the elements with the appropriate data */
gtk_entry_set_text(GTK_ENTRY(e->name), p->name);
......@@ -526,6 +540,8 @@ void project_properties()
{
if (! update_config(e))
goto retry;
stash_group_update(indent_group, e->dialog);
}
gtk_widget_destroy(e->dialog);
......@@ -555,6 +571,20 @@ static gboolean close_open_project()
}
static GeanyProject *create_project(void)
{
GeanyProject *project = g_new0(GeanyProject, 1);
memset(&priv, 0, sizeof priv);
indentation = *editor_get_indent_prefs(NULL);
priv.indentation = &indentation;
project->priv = &priv;
app->project = project;
return project;
}
/* Verifies data for New & Properties dialogs.
* Returns: FALSE if the user needs to change any data. */
static gboolean update_config(const PropertyDialogElements *e)
......@@ -640,7 +670,7 @@ static gboolean update_config(const PropertyDialogElements *e)
if (app->project == NULL)
{
app->project = g_new0(GeanyProject, 1);
create_project();
new_project = TRUE;
}
p = app->project;
......@@ -887,7 +917,9 @@ static gboolean load_config(const gchar *filename)
return FALSE;
}
p = app->project = g_new0(GeanyProject, 1);
p = create_project();
stash_group_load_from_key_file(indent_group, config);
p->name = utils_get_setting_string(config, "project", "name", GEANY_STRING_UNTITLED);
p->description = utils_get_setting_string(config, "project", "description", "");
......@@ -936,6 +968,8 @@ static gboolean write_config(gboolean emit_signal)
filename = utils_get_locale_from_utf8(p->file_name);
g_key_file_load_from_file(config, filename, G_KEY_FILE_NONE, NULL);
stash_group_save_to_key_file(indent_group, config);
g_key_file_set_string(config, "project", "name", p->name);
g_key_file_set_string(config, "project", "base_path", p->base_path);
......@@ -1066,3 +1100,34 @@ void project_apply_prefs()
}
void project_init(void)
{
GeanyPrefGroup *group;
group = stash_group_new("indentation");
/* defaults are copied from editor indent prefs */
stash_group_set_use_defaults(group, FALSE);
indent_group = group;
stash_group_add_spin_button_integer(group, &indentation.width,
"indent_width", 4, "spin_indent_width");
stash_group_add_radio_buttons(group, (gint*)&indentation.type,
"indent_type", GEANY_INDENT_TYPE_TABS,
"radio_indent_spaces", GEANY_INDENT_TYPE_SPACES,
"radio_indent_tabs", GEANY_INDENT_TYPE_TABS,
"radio_indent_both", GEANY_INDENT_TYPE_BOTH,
NULL);
stash_group_add_spin_button_integer(group, &indentation.hard_tab_width,
"indent_hard_tab_width", 8, "spin_tab_width");
stash_group_add_toggle_button(group, &indentation.detect_type,
"detect_indent", FALSE, "check_detect_indent");
stash_group_add_combo_box(group, (gint*)&indentation.auto_indent_mode,
"indent_mode", GEANY_AUTOINDENT_CURRENTCHARS, "combo_auto_indent_mode");
}
void project_finalize(void)
{
stash_group_free(indent_group);
}
......@@ -41,6 +41,8 @@ typedef struct GeanyProject
gint type;
gchar **file_patterns; /**< Array of filename extension patterns. */
gboolean make_in_base_path;
struct GeanyProjectPrivate *priv; /* must be last, append fields before this item */
}
GeanyProject;
......@@ -55,6 +57,11 @@ typedef struct ProjectPrefs
extern ProjectPrefs project_prefs;
void project_init(void);
void project_finalize(void);
void project_new(void);
void project_open(void);
......
/*
* projectprivate.h - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* $Id$
*/
#ifndef GEANY_PROJECTPRIVATE_H
#define GEANY_PROJECTPRIVATE_H 1
typedef struct GeanyProjectPrivate
{
struct GeanyIndentPrefs *indentation;
}
GeanyProjectPrivate;
#endif
......@@ -74,6 +74,7 @@ struct GeanyPrefGroup
const gchar *name; /* group name to use in the keyfile */
GArray *entries; /* array of GeanyPrefEntry */
gboolean write_once; /* only write settings if they don't already exist */
gboolean use_defaults; /* use default values if there's no keyfile entry */
};
typedef struct EnumWidget
......@@ -160,9 +161,14 @@ static void keyfile_action(SettingAction action, GeanyPrefGroup *group, GKeyFile
foreach_array(GeanyPrefEntry, entry, group->entries)
{
/* don't overwrite write_once prefs */
if (group->write_once && action == SETTING_WRITE &&
g_key_file_has_key(keyfile, group->name, entry->key_name, NULL))
continue; /* don't overwrite write_once prefs */
continue;
/* don't override settings with default values */
if (!group->use_defaults && action == SETTING_READ &&
!g_key_file_has_key(keyfile, group->name, entry->key_name, NULL))
continue;
switch (entry->setting_type)
{
......@@ -198,6 +204,7 @@ GeanyPrefGroup *stash_group_new(const gchar *name)
group->name = name;
group->entries = g_array_new(FALSE, FALSE, sizeof(GeanyPrefEntry));
group->use_defaults = TRUE;
return group;
}
......@@ -218,12 +225,24 @@ void stash_group_free(GeanyPrefGroup *group)
}
/* Useful so the user can edit the keyfile manually while the program is running,
* and the setting won't be overridden.
* @c FALSE by default. */
void stash_group_set_write_once(GeanyPrefGroup *group, gboolean write_once)
{
group->write_once = write_once;
}
/* When @c FALSE, Stash doesn't change the setting if there is no keyfile entry, so it
* remains whatever it was initialized/set to by user code.
* @c TRUE by default. */
void stash_group_set_use_defaults(GeanyPrefGroup *group, gboolean use_defaults)
{
group->use_defaults = use_defaults;
}
static GeanyPrefEntry *
add_pref(GeanyPrefGroup *group, GType type, gpointer setting,
const gchar *key_name, gpointer default_value)
......
......@@ -34,6 +34,8 @@ GeanyPrefGroup *stash_group_new(const gchar *name);
void stash_group_set_write_once(GeanyPrefGroup *group, gboolean write_once);
void stash_group_set_use_defaults(GeanyPrefGroup *group, gboolean use_defaults);
void stash_group_add_boolean(GeanyPrefGroup *group, gboolean *setting,
const gchar *key_name, gboolean default_value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment