Added 'enabled' property
parent
9ce7562f02
commit
3f76831055
|
@ -58,6 +58,7 @@ static void remove_tools (void);
|
||||||
static void remove_menu_actions (void);
|
static void remove_menu_actions (void);
|
||||||
|
|
||||||
static void load_config_item (FileType type,
|
static void load_config_item (FileType type,
|
||||||
|
MooConfig *config,
|
||||||
MooConfigItem *item,
|
MooConfigItem *item,
|
||||||
MooUIXML *xml,
|
MooUIXML *xml,
|
||||||
const char *ui_path1,
|
const char *ui_path1,
|
||||||
|
@ -187,6 +188,7 @@ moo_edit_load_tools (FileType type,
|
||||||
}
|
}
|
||||||
|
|
||||||
config = moo_config_new ();
|
config = moo_config_new ();
|
||||||
|
moo_config_set_default_bool (config, MOO_USER_TOOL_KEY_ENABLED, TRUE);
|
||||||
|
|
||||||
for (i = 0; i < n_files; ++i)
|
for (i = 0; i < n_files; ++i)
|
||||||
moo_config_parse_file (config, default_files[i], FALSE, NULL);
|
moo_config_parse_file (config, default_files[i], FALSE, NULL);
|
||||||
|
@ -197,7 +199,7 @@ moo_edit_load_tools (FileType type,
|
||||||
n_items = moo_config_n_items (config);
|
n_items = moo_config_n_items (config);
|
||||||
|
|
||||||
for (i = 0; i < n_items; ++i)
|
for (i = 0; i < n_items; ++i)
|
||||||
load_config_item (type, moo_config_nth_item (config, i),
|
load_config_item (type, config, moo_config_nth_item (config, i),
|
||||||
xml, ui_path1, ui_path2);
|
xml, ui_path1, ui_path2);
|
||||||
|
|
||||||
g_object_unref (config);
|
g_object_unref (config);
|
||||||
|
@ -323,6 +325,7 @@ config_item_get_options (MooConfigItem *item)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_config_item (FileType type,
|
load_config_item (FileType type,
|
||||||
|
MooConfig *config,
|
||||||
MooConfigItem *item,
|
MooConfigItem *item,
|
||||||
MooUIXML *xml,
|
MooUIXML *xml,
|
||||||
const char *ui_path1,
|
const char *ui_path1,
|
||||||
|
@ -333,22 +336,33 @@ load_config_item (FileType type,
|
||||||
ActionOptions options;
|
ActionOptions options;
|
||||||
GSList *langs;
|
GSList *langs;
|
||||||
const char *name, *label, *accel, *pos, *os;
|
const char *name, *label, *accel, *pos, *os;
|
||||||
|
gboolean enabled;
|
||||||
gpointer klass;
|
gpointer klass;
|
||||||
|
|
||||||
g_return_if_fail (item != NULL);
|
g_return_if_fail (item != NULL);
|
||||||
|
|
||||||
|
enabled = moo_config_get_bool (config, item, MOO_USER_TOOL_KEY_ENABLED);
|
||||||
os = moo_config_item_get (item, MOO_USER_TOOL_KEY_OS);
|
os = moo_config_item_get (item, MOO_USER_TOOL_KEY_OS);
|
||||||
|
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (os)
|
if (os)
|
||||||
{
|
{
|
||||||
char *norm = g_ascii_strdown (os, -1);
|
char *norm = g_ascii_strdown (os, -1);
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
if (!strcmp (norm, "unix"))
|
if (!strcmp (norm, "unix"))
|
||||||
|
{
|
||||||
|
g_free (norm);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (!strncmp (norm, "win", 3))
|
if (!strncmp (norm, "win", 3))
|
||||||
|
{
|
||||||
|
g_free (norm);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_free (norm);
|
g_free (norm);
|
||||||
|
|
|
@ -30,6 +30,7 @@ G_BEGIN_DECLS
|
||||||
#define MOO_USER_TOOL_KEY_OPTIONS "options"
|
#define MOO_USER_TOOL_KEY_OPTIONS "options"
|
||||||
#define MOO_USER_TOOL_KEY_COMMAND "command"
|
#define MOO_USER_TOOL_KEY_COMMAND "command"
|
||||||
#define MOO_USER_TOOL_KEY_LANG "lang"
|
#define MOO_USER_TOOL_KEY_LANG "lang"
|
||||||
|
#define MOO_USER_TOOL_KEY_ENABLED "enabled"
|
||||||
|
|
||||||
#define MOO_USER_TOOL_POSITION_START "start"
|
#define MOO_USER_TOOL_POSITION_START "start"
|
||||||
#define MOO_USER_TOOL_POSITION_END "end"
|
#define MOO_USER_TOOL_POSITION_END "end"
|
||||||
|
|
Loading…
Reference in New Issue