[gnome-commander/gcmd-1-3] Bookmarks dlg: store window size in xml cfg
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-3] Bookmarks dlg: store window size in xml cfg
- Date: Thu, 12 Nov 2009 20:35:49 +0000 (UTC)
commit 59679e088170c3ca880bd404d9aabd8afc55120d
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Thu Nov 12 21:00:42 2009 +0100
Bookmarks dlg: store window size in xml cfg
src/gnome-cmd-bookmark-dialog.cc | 10 +++-------
src/gnome-cmd-data.cc | 13 +++++++++++++
src/gnome-cmd-data.h | 10 ++++++++++
src/gnome-cmd-xml-config.cc | 17 ++++++++++++++++-
4 files changed, 42 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-cmd-bookmark-dialog.cc b/src/gnome-cmd-bookmark-dialog.cc
index 6d38817..c132533 100644
--- a/src/gnome-cmd-bookmark-dialog.cc
+++ b/src/gnome-cmd-bookmark-dialog.cc
@@ -429,14 +429,10 @@ static void on_column_resize (GtkCList *clist, gint column, gint width, GnomeCmd
}
-static gint bookmark_dlg_width = 500;
-static gint bookmark_dlg_height = 500;
-
-
static void on_dialog_size_allocate (GtkWidget *widget, GtkAllocation *allocation, GnomeCmdBookmarkDialog *dialog)
{
- bookmark_dlg_width = allocation->width;
- bookmark_dlg_height = allocation->height;
+ gnome_cmd_data.bookmarks_defaults.width = allocation->width;
+ gnome_cmd_data.bookmarks_defaults.height = allocation->height;
}
@@ -494,7 +490,7 @@ static void init (GnomeCmdBookmarkDialog *in_dialog)
g_object_set_data (G_OBJECT (dialog), "dialog", dialog);
gtk_window_set_title (GTK_WINDOW (dialog), _("Bookmarks"));
gtk_widget_set_size_request (GTK_WIDGET (dialog), 400, 400);
- gtk_window_set_default_size (GTK_WINDOW (dialog), bookmark_dlg_width, bookmark_dlg_height);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), gnome_cmd_data.bookmarks_defaults.width, gnome_cmd_data.bookmarks_defaults.height);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE);
g_signal_connect (dialog, "size-allocate", G_CALLBACK (on_dialog_size_allocate), dialog);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index dbe66ff..b155fca 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1764,6 +1764,7 @@ void GnomeCmdData::save()
xml << advrename_defaults;
xml << search_defaults;
+ xml << bookmarks_defaults;
xml << XML::tag("Selections");
for (vector<Selection>::iterator i=selections.begin(); i!=selections.end(); ++i)
@@ -2131,3 +2132,15 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdData::SearchConfig &cfg)
return xml;
}
+
+
+XML::xstream &operator << (XML::xstream &xml, GnomeCmdData::BookmarksConfig &cfg)
+{
+ xml << XML::tag("BookmarksTool");
+
+ xml << XML::tag("WindowSize") << XML::attr("width") << cfg.width << XML::attr("height") << cfg.height << XML::endtag();
+
+ xml << XML::endtag();
+
+ return xml;
+}
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 42c6489..556343f 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -134,6 +134,15 @@ struct GnomeCmdData
case_sensitive(FALSE), search_mode(0) {}
};
+ struct BookmarksConfig
+ {
+ gint width, height;
+
+ BookmarksConfig(): width(400), height(250) {}
+
+ friend XML::xstream &operator << (XML::xstream &xml, BookmarksConfig &cfg);
+ };
+
struct FilterSettings
{
gboolean file_types[8];
@@ -192,6 +201,7 @@ struct GnomeCmdData
SearchConfig search_defaults;
AdvrenameConfig advrename_defaults;
IntViewerConfig intviewer_defaults;
+ BookmarksConfig bookmarks_defaults;
gboolean case_sens_sort;
GnomeCmdLayout layout;
diff --git a/src/gnome-cmd-xml-config.cc b/src/gnome-cmd-xml-config.cc
index 4e5afcf..186c425 100644
--- a/src/gnome-cmd-xml-config.cc
+++ b/src/gnome-cmd-xml-config.cc
@@ -353,6 +353,8 @@ enum {XML_ELEM_NOT_FOUND,
XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATTERN,
XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_PATH,
XML_GNOMECOMMANDER_SEARCHTOOL_HISTORY_TEXT,
+ XML_GNOMECOMMANDER_BOOKMARKSTOOL,
+ XML_GNOMECOMMANDER_BOOKMARKSTOOL_WINDOWSIZE,
XML_GNOMECOMMANDER_SELECTIONS,
XML_GNOMECOMMANDER_SELECTIONS_PROFILE,
XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATTERN,
@@ -472,6 +474,17 @@ static void xml_start(GMarkupParseContext *context,
}
break;
+ case XML_GNOMECOMMANDER_BOOKMARKSTOOL_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->bookmarks_defaults.width = atoi(param1);
+ cfg->bookmarks_defaults.height = atoi(param2);
+ }
+ break;
+
case XML_GNOMECOMMANDER_SEARCHTOOL_PROFILE:
case XML_GNOMECOMMANDER_SELECTIONS_PROFILE:
if (g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
@@ -703,7 +716,9 @@ gboolean gnome_cmd_xml_config_parse (const gchar *xml, gsize xml_len, GnomeCmdDa
{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"},
- {XML_GNOMECOMMANDER_SEARCHTOOL, "/GnomeCommander/Selections"},
+ {XML_GNOMECOMMANDER_BOOKMARKSTOOL, "/GnomeCommander/BookmarksTool"},
+ {XML_GNOMECOMMANDER_BOOKMARKSTOOL_WINDOWSIZE, "/GnomeCommander/BookmarksTool/WindowSize"},
+ {XML_GNOMECOMMANDER_SELECTIONS, "/GnomeCommander/Selections"},
{XML_GNOMECOMMANDER_SELECTIONS_PROFILE, "/GnomeCommander/Selections/Profile"},
{XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATTERN, "/GnomeCommander/Selections/Profile/Pattern"},
{XML_GNOMECOMMANDER_SELECTIONS_PROFILE_PATH, "/GnomeCommander/Selections/Profile/Path"},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]