[gnome-commander] GnomeCmdData: add copy constructor and assignment operator for GnomeCmdData::Options
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdData: add copy constructor and assignment operator for GnomeCmdData::Options
- Date: Fri, 25 Nov 2011 21:00:06 +0000 (UTC)
commit fbce084c1463c766cbc872e518c63e58d91277f6
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Fri Nov 25 21:59:23 2011 +0100
GnomeCmdData: add copy constructor and assignment operator for GnomeCmdData::Options
src/gnome-cmd-data.cc | 108 +++++++++++++++++++++++++++++++++++++++++++++++++
src/gnome-cmd-data.h | 4 ++
2 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index bda04b1..ee286af 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -23,6 +23,7 @@
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <fstream>
+#include <algorithm>
#include "gnome-cmd-includes.h"
#include "gnome-cmd-data.h"
@@ -62,6 +63,113 @@ DICT<guint> gdk_key_names(GDK_VoidSymbol);
DICT<guint> gdk_modifiers_names;
+GnomeCmdData::Options::Options(const Options &cfg)
+{
+ copy (cfg.color_themes, cfg.color_themes+G_N_ELEMENTS(cfg.color_themes), color_themes);
+ left_mouse_button_mode = cfg.left_mouse_button_mode;
+ left_mouse_button_unselects = cfg.left_mouse_button_unselects;
+ middle_mouse_button_mode = cfg.middle_mouse_button_mode;
+ right_mouse_button_mode = cfg.right_mouse_button_mode;
+ case_sens_sort = cfg.case_sens_sort;
+ alt_quick_search = cfg.alt_quick_search;
+ quick_search_exact_match_begin = cfg.quick_search_exact_match_begin;
+ quick_search_exact_match_end = cfg.quick_search_exact_match_end;
+ allow_multiple_instances = cfg.allow_multiple_instances;
+ save_dirs_on_exit = cfg.save_dirs_on_exit;
+ save_tabs_on_exit = cfg.save_tabs_on_exit;
+ save_dir_history_on_exit = cfg.save_dir_history_on_exit;
+ size_disp_mode = cfg.size_disp_mode;
+ perm_disp_mode = cfg.perm_disp_mode;
+ date_format = g_strdup (cfg.date_format);
+ list_font = g_strdup (cfg.list_font);
+ list_row_height = cfg.list_row_height;
+ ext_disp_mode = cfg.ext_disp_mode;
+ layout = cfg.layout;
+ color_mode = cfg.color_mode;
+ use_ls_colors = cfg.use_ls_colors;
+ ls_colors_palette = cfg.ls_colors_palette;
+ icon_size = cfg.icon_size;
+ icon_scale_quality = cfg.icon_scale_quality;
+ theme_icon_dir = cfg.theme_icon_dir;
+ document_icon_dir = cfg.document_icon_dir;
+ always_show_tabs = cfg.always_show_tabs;
+ tab_lock_indicator = cfg.tab_lock_indicator;
+ confirm_delete = cfg.confirm_delete;
+ confirm_copy_overwrite = cfg.confirm_copy_overwrite;
+ confirm_move_overwrite = cfg.confirm_move_overwrite;
+ confirm_mouse_dnd = cfg.confirm_mouse_dnd;
+ filter = cfg.filter;
+ backup_pattern = g_strdup (cfg.backup_pattern);
+ backup_pattern_list = patlist_new (cfg.backup_pattern);
+ honor_expect_uris = cfg.honor_expect_uris;
+ viewer = g_strdup (cfg.viewer);
+ use_internal_viewer = cfg.use_internal_viewer;
+ editor = g_strdup (cfg.editor);
+ differ = g_strdup (cfg.differ);
+ term = g_strdup (cfg.term);
+ fav_apps = cfg.fav_apps;
+ device_only_icon = cfg.device_only_icon;
+ skip_mounting = cfg.skip_mounting;
+}
+
+
+GnomeCmdData::Options &GnomeCmdData::Options::operator = (const Options &cfg)
+{
+ if (this != &cfg)
+ {
+ this->~Options(); // free allocated data
+
+ copy (cfg.color_themes, cfg.color_themes+G_N_ELEMENTS(cfg.color_themes), color_themes);
+ left_mouse_button_mode = cfg.left_mouse_button_mode;
+ left_mouse_button_unselects = cfg.left_mouse_button_unselects;
+ middle_mouse_button_mode = cfg.middle_mouse_button_mode;
+ right_mouse_button_mode = cfg.right_mouse_button_mode;
+ case_sens_sort = cfg.case_sens_sort;
+ alt_quick_search = cfg.alt_quick_search;
+ quick_search_exact_match_begin = cfg.quick_search_exact_match_begin;
+ quick_search_exact_match_end = cfg.quick_search_exact_match_end;
+ allow_multiple_instances = cfg.allow_multiple_instances;
+ save_dirs_on_exit = cfg.save_dirs_on_exit;
+ save_tabs_on_exit = cfg.save_tabs_on_exit;
+ save_dir_history_on_exit = cfg.save_dir_history_on_exit;
+ size_disp_mode = cfg.size_disp_mode;
+ perm_disp_mode = cfg.perm_disp_mode;
+ date_format = g_strdup (cfg.date_format);
+ list_font = g_strdup (cfg.list_font);
+ list_row_height = cfg.list_row_height;
+ ext_disp_mode = cfg.ext_disp_mode;
+ layout = cfg.layout;
+ color_mode = cfg.color_mode;
+ use_ls_colors = cfg.use_ls_colors;
+ ls_colors_palette = cfg.ls_colors_palette;
+ icon_size = cfg.icon_size;
+ icon_scale_quality = cfg.icon_scale_quality;
+ theme_icon_dir = cfg.theme_icon_dir;
+ document_icon_dir = cfg.document_icon_dir;
+ always_show_tabs = cfg.always_show_tabs;
+ tab_lock_indicator = cfg.tab_lock_indicator;
+ confirm_delete = cfg.confirm_delete;
+ confirm_copy_overwrite = cfg.confirm_copy_overwrite;
+ confirm_move_overwrite = cfg.confirm_move_overwrite;
+ confirm_mouse_dnd = cfg.confirm_mouse_dnd;
+ filter = cfg.filter;
+ backup_pattern = g_strdup (cfg.backup_pattern);
+ backup_pattern_list = patlist_new (cfg.backup_pattern);
+ honor_expect_uris = cfg.honor_expect_uris;
+ viewer = g_strdup (cfg.viewer);
+ use_internal_viewer = cfg.use_internal_viewer;
+ editor = g_strdup (cfg.editor);
+ differ = g_strdup (cfg.differ);
+ term = g_strdup (cfg.term);
+ fav_apps = cfg.fav_apps;
+ device_only_icon = cfg.device_only_icon;
+ skip_mounting = cfg.skip_mounting;
+ }
+
+ return *this;
+}
+
+
void GnomeCmdData::Selection::reset()
{
name.clear();
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 1429507..7ab88bd 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -186,6 +186,8 @@ struct GnomeCmdData
memset(&ls_colors_palette, 0, sizeof(ls_colors_palette));
}
+ Options(const Options &cfg);
+
~Options()
{
g_free (date_format);
@@ -200,6 +202,8 @@ struct GnomeCmdData
g_free (term);
}
+ Options &operator = (const Options &cfg);
+
GnomeCmdColorTheme *get_current_color_theme()
{
return &color_themes[color_mode];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]