[gnome-commander] XML config: write opened tabs on exit
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] XML config: write opened tabs on exit
- Date: Thu, 1 Jul 2010 21:57:12 +0000 (UTC)
commit 3dbc6349a6a43888ebaba0a2e092d221c7242208
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Thu Jul 1 23:56:13 2010 +0200
XML config: write opened tabs on exit
src/gnome-cmd-data.cc | 3 +++
src/gnome-cmd-file-list.cc | 6 ++++++
src/gnome-cmd-file-list.h | 3 +++
src/gnome-cmd-file-selector.cc | 18 ++++++++++++++++++
src/gnome-cmd-file-selector.h | 3 +++
src/gnome-cmd-main-win.cc | 13 +++++++++++++
src/gnome-cmd-main-win.h | 3 +++
7 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 4cce00d..d09a82a 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1672,6 +1672,9 @@ void GnomeCmdData::save()
xml << XML::comment("Created with GNOME Commander (http://www.nongnu.org/gcmd/)");
xml << XML::tag("GnomeCommander") << XML::attr("version") << VERSION;
+ if (save_tabs_on_exit)
+ xml << *main_win;
+
xml << advrename_defaults;
xml << search_defaults;
xml << bookmarks_defaults;
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 4bc81ae..30512bd 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2951,3 +2951,9 @@ void GnomeCmdFileList::init_dnd()
g_signal_connect (this, "drag-leave", G_CALLBACK (drag_leave), this);
g_signal_connect (this, "drag-data-received", G_CALLBACK (drag_data_received), this);
}
+
+XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileList &fl)
+{
+ return xml << XML::tag("Tab") << XML::attr("dir") << gnome_cmd_file_get_path (GNOME_CMD_FILE (fl.cwd)) << XML::attr("sort") << fl.get_sort_column() << XML::attr("asc") << fl.get_sort_order() << XML::endtag();
+}
+
diff --git a/src/gnome-cmd-file-list.h b/src/gnome-cmd-file-list.h
index 3da6ed9..d834e6d 100644
--- a/src/gnome-cmd-file-list.h
+++ b/src/gnome-cmd-file-list.h
@@ -24,6 +24,7 @@
#include "gnome-cmd-file.h"
#include "gnome-cmd-dir.h"
#include "gnome-cmd-clist.h"
+#include "gnome-cmd-xml-config.h"
#define GNOME_CMD_TYPE_FILE_LIST (gnome_cmd_file_list_get_type ())
#define GNOME_CMD_FILE_LIST(obj) GTK_CHECK_CAST (obj, GNOME_CMD_TYPE_FILE_LIST, GnomeCmdFileList)
@@ -169,6 +170,8 @@ struct GnomeCmdFileList
gboolean key_pressed(GdkEventKey *event);
void init_dnd();
+
+ friend XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileList &fl);
};
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 13ad358..72c867e 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -1354,3 +1354,21 @@ GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, gboolean activate)
return scrolled_window;
}
+
+
+XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs)
+{
+ GList *tabs = gtk_container_get_children (*fs.notebook);
+
+ for (GList *i=tabs; i; i=i->next)
+ {
+ GnomeCmdFileList *fl = (GnomeCmdFileList *) gtk_bin_get_child (GTK_BIN (i->data));
+
+ if (GNOME_CMD_FILE_LIST (fl) && gnome_cmd_con_is_local (fl->con))
+ xml << *fl;
+ }
+
+ g_list_free (tabs);
+
+ return xml;
+}
diff --git a/src/gnome-cmd-file-selector.h b/src/gnome-cmd-file-selector.h
index a11c623..31958a3 100644
--- a/src/gnome-cmd-file-selector.h
+++ b/src/gnome-cmd-file-selector.h
@@ -31,6 +31,7 @@ struct GnomeCmdMainWin;
#include "gnome-cmd-con.h"
#include "gnome-cmd-dir.h"
#include "gnome-cmd-notebook.h"
+#include "gnome-cmd-xml-config.h"
typedef enum
@@ -107,6 +108,8 @@ struct GnomeCmdFileSelector
void update_concombo_visibility();
gboolean key_pressed(GdkEventKey *event);
+
+ friend XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs);
};
inline GnomeCmdFileList *GnomeCmdFileSelector::file_list(gint n) const
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index dec5749..f0db797 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1323,3 +1323,16 @@ void GnomeCmdMainWin::set_equal_panes()
{
slide_set_50_50 (NULL, NULL);
}
+
+
+XML::xstream &operator << (XML::xstream &xml, GnomeCmdMainWin &mw)
+{
+ xml << XML::tag("Layout");
+
+ xml << XML::tag("Panel") << XML::attr("name") << "left" << *mw.fs(LEFT) << XML::endtag();
+ xml << XML::tag("Panel") << XML::attr("name") << "right" << *mw.fs(RIGHT) << XML::endtag();
+
+ xml << XML::endtag();
+
+ return xml;
+}
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index 6cf152a..affc3f0 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -24,6 +24,7 @@
#include "gnome-cmd-file-selector.h"
#include "gnome-cmd-advrename-dialog.h"
#include "gnome-cmd-cmdline.h"
+#include "gnome-cmd-xml-config.h"
#include "plugin_manager.h"
#define GNOME_CMD_TYPE_MAIN_WIN (gnome_cmd_main_win_get_type ())
@@ -85,6 +86,8 @@ struct GnomeCmdMainWin
void update_list_orientation();
void add_plugin_menu(PluginData *data);
+
+ friend XML::xstream &operator << (XML::xstream &xml, GnomeCmdMainWin &mw);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]