[gnome-commander] XML config: load search settings
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-commander] XML config: load search settings
- Date: Wed, 1 Jul 2009 22:18:15 +0000 (UTC)
commit 243e78d0815a6745fb5efede68c9d17fef1d15aa
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Thu Jul 2 00:16:05 2009 +0200
XML config: load search settings
doc/C/gnome-commander.xml | 35 ---------------
src/gnome-cmd-data.cc | 3 +-
src/gnome-cmd-xml-config.cc | 102 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 102 insertions(+), 38 deletions(-)
---
diff --git a/doc/C/gnome-commander.xml b/doc/C/gnome-commander.xml
index c241f14..e19305e 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -5855,41 +5855,6 @@
<entry><para></para></entry>
</row>
<row valign="top">
- <entry><para>[search-history]</para></entry>
- <entry><para>case_sens</para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- </row>
- <row valign="top">
- <entry><para></para></entry>
- <entry><para>height</para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- </row>
- <row valign="top">
- <entry><para></para></entry>
- <entry><para>name_pattern<emphasis><subscript>n</subscript></emphasis></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- </row>
- <row valign="top">
- <entry><para></para></entry>
- <entry><para>recursive</para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- </row>
- <row valign="top">
- <entry><para></para></entry>
- <entry><para>width</para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- <entry><para></para></entry>
- </row>
- <row valign="top">
<entry><para>[local_bookmarks]</para></entry>
<entry><para>count</para></entry>
<entry><para></para></entry>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 1bdee94..0ddac5a 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1361,7 +1361,6 @@ void GnomeCmdData::load()
load_cmdline_history();
//load_dir_history ();
- load_search_defaults();
if (!gnome_cmd_xml_config_load (xml_cfg_path, *this))
{
@@ -1380,6 +1379,8 @@ void GnomeCmdData::load()
advrename_defaults.profiles.push_back(p);
}
#endif
+
+ load_search_defaults();
}
load_intviewer_defaults();
diff --git a/src/gnome-cmd-xml-config.cc b/src/gnome-cmd-xml-config.cc
index d428b2e..aa9dc4b 100644
--- a/src/gnome-cmd-xml-config.cc
+++ b/src/gnome-cmd-xml-config.cc
@@ -338,13 +338,24 @@ enum {XML_ELEM_NOT_FOUND,
XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_PROFILE_CASECONVERSION,
XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_PROFILE_TRIMBLANKS,
XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY,
- XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY_TEMPLATE};
+ XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY_TEMPLATE,
+ XML_GNOMECOMMANDER_SEARCHTOOL,
+ XML_GNOMECOMMANDER_SEARCHTOOL_WINDOWSIZE,
+ XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE,
+ XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN,
+ XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH,
+ XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT,
+ XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY,
+ XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN,
+ XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATH,
+ XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_TEXT};
static DICT<guint> xml_elem_names(XML_ELEM_NOT_FOUND);
static stack<string> xml_paths;
static GnomeCmdData::AdvrenameConfig::Profile xml_adv_profile;
+static GnomeCmdData::Selection xml_search_profile;
static bool is_default(GnomeCmdData::AdvrenameConfig::Profile &profile)
@@ -439,6 +450,52 @@ static void xml_start(GMarkupParseContext *context,
xml_adv_profile.trim_blanks = atoi(param1);
break;
+ case XML_GNOMECOMMANDER_SEARCHTOOL_WINDOWSIZE:
+ if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
+ G_MARKUP_COLLECT_STRING, "width", ¶m1,
+ G_MARKUP_COLLECT_STRING, "height", ¶m2,
+ G_MARKUP_COLLECT_INVALID))
+ {
+ cfg->search_defaults.width = atoi(param1);
+ cfg->search_defaults.height = atoi(param2);
+ }
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE:
+ if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
+ G_MARKUP_COLLECT_STRING, "name", ¶m1,
+ G_MARKUP_COLLECT_INVALID))
+ {
+ xml_search_profile.reset();
+ xml_search_profile.name = param1;
+ }
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN:
+ if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
+ G_MARKUP_COLLECT_STRING, "syntax", ¶m1,
+ G_MARKUP_COLLECT_BOOLEAN, "match-case", ¶m4,
+ G_MARKUP_COLLECT_INVALID))
+ {
+ xml_search_profile.syntax = param1=="regex" ? Filter::TYPE_REGEX : Filter::TYPE_FNMATCH;
+ // FIXME: xml_search_profile.? = param4;
+ }
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH:
+ if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
+ G_MARKUP_COLLECT_BOOLEAN, "recursive", ¶m4,
+ G_MARKUP_COLLECT_INVALID))
+ xml_search_profile.recursive = param4;
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT:
+ if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
+ G_MARKUP_COLLECT_BOOLEAN, "match-case", ¶m4,
+ G_MARKUP_COLLECT_INVALID))
+ xml_search_profile.match_case = param4;
+ break;
+
default:
break;
}
@@ -476,6 +533,17 @@ static void xml_end (GMarkupParseContext *context,
cfg->advrename_defaults.templates.reverse();
break;
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE:
+ if (xml_search_profile.name=="Default")
+ cfg->search_defaults.default_profile = xml_search_profile;
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY:
+ cfg->search_defaults.name_patterns.reverse();
+ cfg->search_defaults.directories.reverse();
+ cfg->search_defaults.content_patterns.reverse();
+ break;
+
default:
break;
}
@@ -502,6 +570,26 @@ static void xml_end (GMarkupParseContext *context,
cfg->advrename_defaults.templates.add(text);
break;
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN:
+ xml_search_profile.filename_pattern = text;
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT:
+ xml_search_profile.text_pattern = text;
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN:
+ cfg->search_defaults.name_patterns.add(text);
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATH:
+ cfg->search_defaults.directories.add(text);
+ break;
+
+ case XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_TEXT:
+ cfg->search_defaults.content_patterns.add(text);
+ break;
+
default:
break;
}
@@ -531,7 +619,17 @@ gboolean gnome_cmd_xml_config_parse (const gchar *xml, gsize xml_len, GnomeCmdDa
{XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY, "/GnomeCommander/AdvancedRenameTool/History"},
{XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY_TEMPLATE, "/GnomeCommander/AdvancedRenameTool/History/Template"},
{XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY, "/GnomeCommander/AdvancedRenameTool/TemplateHistory"}, // FIXME: for compatibility, to be removed after 1.2.8 release
- {XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY_TEMPLATE, "/GnomeCommander/AdvancedRenameTool/TemplateHistory/Template"} // FIXME: for compatibility, to be removed after 1.2.8 release
+ {XML_GNOMECOMMANDER_ADVANCEDRENAMETOOL_HISTORY_TEMPLATE, "/GnomeCommander/AdvancedRenameTool/TemplateHistory/Template"}, // FIXME: for compatibility, to be removed after 1.2.8 release
+ {XML_GNOMECOMMANDER_SEARCHTOOL, "/GnomeCommander/SearchTool"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_WINDOWSIZE, "/GnomeCommander/SearchTool/WindowSize"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE, "/GnomeCommander/SearchTool/Profile"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATTERN, "/GnomeCommander/SearchTool/Profile/Pattern"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_PATH, "/GnomeCommander/SearchTool/Profile/Path"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE_TEXT, "/GnomeCommander/SearchTool/Profile/Text"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY, "/GnomeCommander/SearchTool/History"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN, "/GnomeCommander/SearchTool/History/Pattern"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATH, "/GnomeCommander/SearchTool/History/Path"},
+ {XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_TEXT, "/GnomeCommander/SearchTool/History/Text"}
};
load_data (xml_elem_names, xml_elem_data, G_N_ELEMENTS(xml_elem_data));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]