[gnome-commander] GnomeCmdData: move Layout options to GnomeCmdData::Options
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdData: move Layout options to GnomeCmdData::Options
- Date: Wed, 9 Nov 2011 18:42:43 +0000 (UTC)
commit b5be08d548d212f151deb08309bbda00e3ef7c3d
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Wed Nov 9 19:23:39 2011 +0100
GnomeCmdData: move Layout options to GnomeCmdData::Options
src/gnome-cmd-data.cc | 195 +++++++++++++++++----------------------
src/gnome-cmd-data.h | 44 +++++++---
src/gnome-cmd-file-list.cc | 22 ++--
src/gnome-cmd-options-dialog.cc | 36 ++++----
src/gnome-cmd-style.cc | 2 +-
src/imageloader.cc | 6 +-
6 files changed, 148 insertions(+), 157 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 89f580e..631afe9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -50,9 +50,6 @@ struct GnomeCmdData::Private
GnomeCmdConList *con_list;
GList *fav_apps;
GnomeCmdColorTheme color_themes[GNOME_CMD_NUM_COLOR_MODES];
- gchar *list_font;
- gchar *theme_icon_dir;
- gchar *document_icon_dir;
gchar *last_pattern;
GList *auto_load_plugins;
gint sort_column[2];
@@ -63,8 +60,6 @@ struct GnomeCmdData::Private
gchar *symlink_prefix;
gchar *ftp_anonymous_password;
-
- GnomeCmdLsColorsPalette ls_colors_palette;
};
@@ -840,14 +835,11 @@ GnomeCmdData::GnomeCmdData(): search_defaults(selections)
confirm_copy_overwrite = GNOME_CMD_CONFIRM_OVERWRITE_QUERY;
confirm_move_overwrite = GNOME_CMD_CONFIRM_OVERWRITE_QUERY;
confirm_mouse_dnd = TRUE;
- color_mode = GNOME_CMD_COLOR_DEEP_BLUE;
memset(&filter_settings, 0, sizeof(filter_settings));
filter_settings.hidden = TRUE;
filter_settings.backup = TRUE;
- layout = GNOME_CMD_LAYOUT_MIME_ICONS;
- ext_disp_mode = GNOME_CMD_EXT_DISP_BOTH;
list_orientation = FALSE;
toolbar_visibility = TRUE;
@@ -856,14 +848,9 @@ GnomeCmdData::GnomeCmdData(): search_defaults(selections)
cmdline_visibility = TRUE;
buttonbar_visibility = TRUE;
- use_ls_colors = FALSE;
-
- icon_size = 16;
dev_icon_size = 16;
device_only_icon = FALSE;
- list_row_height = 16;
memset(fs_col_width, 0, sizeof(fs_col_width));
- icon_scale_quality = GDK_INTERP_HYPER;
gui_update_rate = DEFAULT_GUI_UPDATE_RATE;
button_relief = GTK_RELIEF_NONE;
@@ -917,9 +904,6 @@ void GnomeCmdData::free()
// free the anonymous password string
g_free (priv->ftp_anonymous_password);
- // free the font name strings
- g_free (priv->list_font);
-
g_free (priv);
}
}
@@ -1025,9 +1009,9 @@ void GnomeCmdData::load()
options.date_format = g_locale_from_utf8 (utf8_date_format, -1, NULL, NULL, NULL);
g_free (utf8_date_format);
- layout = (GnomeCmdLayout) gnome_cmd_data_get_int ("/options/layout", GNOME_CMD_LAYOUT_MIME_ICONS);
+ options.layout = (GnomeCmdLayout) gnome_cmd_data_get_int ("/options/layout", GNOME_CMD_LAYOUT_MIME_ICONS);
- list_row_height = gnome_cmd_data_get_int ("/options/list_row_height", 16);
+ options.list_row_height = gnome_cmd_data_get_int ("/options/list_row_height", 16);
confirm_delete = gnome_cmd_data_get_bool ("/confirm/delete", TRUE);
confirm_copy_overwrite = (GnomeCmdConfirmOverwriteMode) gnome_cmd_data_get_int ("/confirm/copy_overwrite", GNOME_CMD_CONFIRM_OVERWRITE_QUERY);
@@ -1057,8 +1041,8 @@ void GnomeCmdData::load()
g_free (tmp);
}
- color_mode = (GnomeCmdColorMode) gnome_cmd_data_get_int ("/colors/mode", gcmd_owner.is_root() ? GNOME_CMD_COLOR_GREEN_TIGER :
- GNOME_CMD_COLOR_DEEP_BLUE);
+ options.color_mode = (GnomeCmdColorMode) gnome_cmd_data_get_int ("/colors/mode", gcmd_owner.is_root() ? GNOME_CMD_COLOR_GREEN_TIGER :
+ GNOME_CMD_COLOR_DEEP_BLUE);
gnome_cmd_data_get_color ("/colors/norm_fg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].norm_fg);
gnome_cmd_data_get_color ("/colors/norm_bg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].norm_bg);
@@ -1069,38 +1053,38 @@ void GnomeCmdData::load()
gnome_cmd_data_get_color ("/colors/curs_fg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].curs_fg);
gnome_cmd_data_get_color ("/colors/curs_bg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].curs_bg);
- use_ls_colors = gnome_cmd_data_get_bool ("/colors/use_ls_colors", FALSE);
-
- priv->ls_colors_palette.black_fg = gdk_color_new (0, 0, 0);
- priv->ls_colors_palette.black_bg = gdk_color_new (0, 0, 0);
- priv->ls_colors_palette.red_fg = gdk_color_new (0xffff, 0, 0);
- priv->ls_colors_palette.red_bg = gdk_color_new (0xffff, 0, 0);
- priv->ls_colors_palette.green_fg = gdk_color_new (0, 0xffff, 0);
- priv->ls_colors_palette.green_bg = gdk_color_new (0, 0xffff, 0);
- priv->ls_colors_palette.yellow_fg = gdk_color_new (0xffff, 0xffff, 0);
- priv->ls_colors_palette.yellow_bg = gdk_color_new (0xffff, 0xffff, 0);
- priv->ls_colors_palette.blue_fg = gdk_color_new (0, 0, 0xffff);
- priv->ls_colors_palette.blue_bg = gdk_color_new (0, 0, 0xffff);
- priv->ls_colors_palette.magenta_fg = gdk_color_new (0xffff, 0, 0xffff);
- priv->ls_colors_palette.magenta_bg = gdk_color_new (0xffff, 0, 0xffff);
- priv->ls_colors_palette.cyan_fg = gdk_color_new (0, 0xffff, 0xffff);
- priv->ls_colors_palette.cyan_bg = gdk_color_new (0, 0xffff, 0xffff);
- priv->ls_colors_palette.white_fg = gdk_color_new (0xffff, 0xffff, 0xffff);
- priv->ls_colors_palette.white_bg = gdk_color_new (0xffff, 0xffff, 0xffff);
-
- priv->list_font = gnome_cmd_data_get_string ("/options/list_font", "-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso8859-1");
-
- ext_disp_mode = (GnomeCmdExtDispMode) gnome_cmd_data_get_int ("/options/ext_disp_mode", GNOME_CMD_EXT_DISP_BOTH);
+ options.use_ls_colors = gnome_cmd_data_get_bool ("/colors/use_ls_colors", FALSE);
+
+ options.ls_colors_palette.black_fg = gdk_color_new (0, 0, 0);
+ options.ls_colors_palette.black_bg = gdk_color_new (0, 0, 0);
+ options.ls_colors_palette.red_fg = gdk_color_new (0xffff, 0, 0);
+ options.ls_colors_palette.red_bg = gdk_color_new (0xffff, 0, 0);
+ options.ls_colors_palette.green_fg = gdk_color_new (0, 0xffff, 0);
+ options.ls_colors_palette.green_bg = gdk_color_new (0, 0xffff, 0);
+ options.ls_colors_palette.yellow_fg = gdk_color_new (0xffff, 0xffff, 0);
+ options.ls_colors_palette.yellow_bg = gdk_color_new (0xffff, 0xffff, 0);
+ options.ls_colors_palette.blue_fg = gdk_color_new (0, 0, 0xffff);
+ options.ls_colors_palette.blue_bg = gdk_color_new (0, 0, 0xffff);
+ options.ls_colors_palette.magenta_fg = gdk_color_new (0xffff, 0, 0xffff);
+ options.ls_colors_palette.magenta_bg = gdk_color_new (0xffff, 0, 0xffff);
+ options.ls_colors_palette.cyan_fg = gdk_color_new (0, 0xffff, 0xffff);
+ options.ls_colors_palette.cyan_bg = gdk_color_new (0, 0xffff, 0xffff);
+ options.ls_colors_palette.white_fg = gdk_color_new (0xffff, 0xffff, 0xffff);
+ options.ls_colors_palette.white_bg = gdk_color_new (0xffff, 0xffff, 0xffff);
+
+ options.list_font = gnome_cmd_data_get_string ("/options/list_font", "-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso8859-1");
+
+ options.ext_disp_mode = (GnomeCmdExtDispMode) gnome_cmd_data_get_int ("/options/ext_disp_mode", GNOME_CMD_EXT_DISP_BOTH);
options.left_mouse_button_mode = (LeftMouseButtonMode) gnome_cmd_data_get_int ("/options/left_mouse_button_mode", LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK);
options.left_mouse_button_unselects = gnome_cmd_data_get_bool ("/options/left_mouse_button_unselects", TRUE);
options.middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int ("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
options.right_mouse_button_mode = (RightMouseButtonMode) gnome_cmd_data_get_int ("/options/right_mouse_button_mode", RIGHT_BUTTON_POPUPS_MENU);
- icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
+ options.icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
dev_icon_size = gnome_cmd_data_get_int ("/options/dev_icon_size", 16);
- icon_scale_quality = (GdkInterpType) gnome_cmd_data_get_int ("/options/icon_scale_quality", GDK_INTERP_HYPER);
- priv->theme_icon_dir = gnome_cmd_data_get_string ("/options/theme_icon_dir", theme_icon_dir);
+ options.icon_scale_quality = (GdkInterpType) gnome_cmd_data_get_int ("/options/icon_scale_quality", GDK_INTERP_HYPER);
+ options.theme_icon_dir = gnome_cmd_data_get_string ("/options/theme_icon_dir", theme_icon_dir);
g_free (theme_icon_dir);
- priv->document_icon_dir = gnome_cmd_data_get_string ("/options/document_icon_dir", document_icon_dir);
+ options.document_icon_dir = gnome_cmd_data_get_string ("/options/document_icon_dir", document_icon_dir);
g_free (document_icon_dir);
cmdline_history_length = gnome_cmd_data_get_int ("/options/cmdline_history_length", 16);
button_relief = (GtkReliefStyle) gnome_cmd_data_get_int ("/options/btn_relief", GTK_RELIEF_NONE);
@@ -1144,22 +1128,22 @@ void GnomeCmdData::load()
device_only_icon = gnome_cmd_data_get_bool ("/devices/only_icon", FALSE);
- gnome_cmd_data_get_color ("/colors/ls_colors_black_fg", priv->ls_colors_palette.black_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_black_bg", priv->ls_colors_palette.black_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_red_fg", priv->ls_colors_palette.red_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_red_bg", priv->ls_colors_palette.red_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_green_fg", priv->ls_colors_palette.green_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_green_bg", priv->ls_colors_palette.green_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_yellow_fg", priv->ls_colors_palette.yellow_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_yellow_bg", priv->ls_colors_palette.yellow_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_blue_fg", priv->ls_colors_palette.blue_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_blue_bg", priv->ls_colors_palette.blue_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_magenta_fg", priv->ls_colors_palette.magenta_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_magenta_bg", priv->ls_colors_palette.magenta_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_cyan_fg", priv->ls_colors_palette.cyan_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_cyan_bg", priv->ls_colors_palette.cyan_bg);
- gnome_cmd_data_get_color ("/colors/ls_colors_white_fg", priv->ls_colors_palette.white_fg);
- gnome_cmd_data_get_color ("/colors/ls_colors_white_bg", priv->ls_colors_palette.white_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_black_fg", options.ls_colors_palette.black_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_black_bg", options.ls_colors_palette.black_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_red_fg", options.ls_colors_palette.red_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_red_bg", options.ls_colors_palette.red_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_green_fg", options.ls_colors_palette.green_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_green_bg", options.ls_colors_palette.green_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_yellow_fg", options.ls_colors_palette.yellow_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_yellow_bg", options.ls_colors_palette.yellow_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_blue_fg", options.ls_colors_palette.blue_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_blue_bg", options.ls_colors_palette.blue_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_magenta_fg", options.ls_colors_palette.magenta_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_magenta_bg", options.ls_colors_palette.magenta_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_cyan_fg", options.ls_colors_palette.cyan_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_cyan_bg", options.ls_colors_palette.cyan_bg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_white_fg", options.ls_colors_palette.white_fg);
+ gnome_cmd_data_get_color ("/colors/ls_colors_white_bg", options.ls_colors_palette.white_bg);
options.save_dirs_on_exit = gnome_cmd_data_get_bool ("/options/save_dirs_on_exit", TRUE);
options.save_tabs_on_exit = gnome_cmd_data_get_bool ("/options/save_tabs_on_exit", TRUE);
@@ -1459,8 +1443,8 @@ void GnomeCmdData::save()
{
gnome_cmd_data_set_int ("/options/size_disp_mode", options.size_disp_mode);
gnome_cmd_data_set_int ("/options/perm_disp_mode", options.perm_disp_mode);
- gnome_cmd_data_set_int ("/options/layout", layout);
- gnome_cmd_data_set_int ("/options/list_row_height", list_row_height);
+ gnome_cmd_data_set_int ("/options/layout", options.layout);
+ gnome_cmd_data_set_int ("/options/list_row_height", options.list_row_height);
gchar *utf8_date_format = g_locale_to_utf8 (options.date_format, -1, NULL, NULL, NULL);
gnome_cmd_data_set_string ("/options/date_disp_mode", utf8_date_format);
@@ -1485,7 +1469,7 @@ void GnomeCmdData::save()
gnome_cmd_data_set_bool ("/sort/case_sensitive", options.case_sens_sort);
- gnome_cmd_data_set_int ("/colors/mode", color_mode);
+ gnome_cmd_data_set_int ("/colors/mode", options.color_mode);
gnome_cmd_data_set_color ("/colors/norm_fg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].norm_fg);
gnome_cmd_data_set_color ("/colors/norm_bg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].norm_bg);
@@ -1496,37 +1480,37 @@ void GnomeCmdData::save()
gnome_cmd_data_set_color ("/colors/curs_fg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].curs_fg);
gnome_cmd_data_set_color ("/colors/curs_bg", priv->color_themes[GNOME_CMD_COLOR_CUSTOM].curs_bg);
- gnome_cmd_data_set_bool ("/colors/use_ls_colors", use_ls_colors);
-
- gnome_cmd_data_set_color ("/colors/ls_colors_black_fg", priv->ls_colors_palette.black_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_black_bg", priv->ls_colors_palette.black_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_red_fg", priv->ls_colors_palette.red_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_red_bg", priv->ls_colors_palette.red_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_green_fg", priv->ls_colors_palette.green_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_green_bg", priv->ls_colors_palette.green_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_yellow_fg", priv->ls_colors_palette.yellow_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_yellow_bg", priv->ls_colors_palette.yellow_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_blue_fg", priv->ls_colors_palette.blue_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_blue_bg", priv->ls_colors_palette.blue_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_magenta_fg", priv->ls_colors_palette.magenta_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_magenta_bg", priv->ls_colors_palette.magenta_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_cyan_fg", priv->ls_colors_palette.cyan_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_cyan_bg", priv->ls_colors_palette.cyan_bg);
- gnome_cmd_data_set_color ("/colors/ls_colors_white_fg", priv->ls_colors_palette.white_fg);
- gnome_cmd_data_set_color ("/colors/ls_colors_white_bg", priv->ls_colors_palette.white_bg);
-
- gnome_cmd_data_set_string ("/options/list_font", priv->list_font);
-
- gnome_cmd_data_set_int ("/options/ext_disp_mode", ext_disp_mode);
+ gnome_cmd_data_set_bool ("/colors/use_ls_colors", options.use_ls_colors);
+
+ gnome_cmd_data_set_color ("/colors/ls_colors_black_fg", options.ls_colors_palette.black_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_black_bg", options.ls_colors_palette.black_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_red_fg", options.ls_colors_palette.red_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_red_bg", options.ls_colors_palette.red_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_green_fg", options.ls_colors_palette.green_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_green_bg", options.ls_colors_palette.green_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_yellow_fg", options.ls_colors_palette.yellow_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_yellow_bg", options.ls_colors_palette.yellow_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_blue_fg", options.ls_colors_palette.blue_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_blue_bg", options.ls_colors_palette.blue_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_magenta_fg", options.ls_colors_palette.magenta_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_magenta_bg", options.ls_colors_palette.magenta_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_cyan_fg", options.ls_colors_palette.cyan_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_cyan_bg", options.ls_colors_palette.cyan_bg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_white_fg", options.ls_colors_palette.white_fg);
+ gnome_cmd_data_set_color ("/colors/ls_colors_white_bg", options.ls_colors_palette.white_bg);
+
+ gnome_cmd_data_set_string ("/options/list_font", options.list_font);
+
+ gnome_cmd_data_set_int ("/options/ext_disp_mode", options.ext_disp_mode);
gnome_cmd_data_set_int ("/options/left_mouse_button_mode", options.left_mouse_button_mode);
gnome_cmd_data_set_bool ("/options/left_mouse_button_unselects", options.left_mouse_button_unselects);
gnome_cmd_data_set_int ("/options/middle_mouse_button_mode", options.middle_mouse_button_mode);
gnome_cmd_data_set_int ("/options/right_mouse_button_mode", options.right_mouse_button_mode);
- gnome_cmd_data_set_int ("/options/icon_size", icon_size);
+ gnome_cmd_data_set_int ("/options/icon_size", options.icon_size);
gnome_cmd_data_set_int ("/options/dev_icon_size", dev_icon_size);
- gnome_cmd_data_set_int ("/options/icon_scale_quality", icon_scale_quality);
- gnome_cmd_data_set_string ("/options/theme_icon_dir", priv->theme_icon_dir);
- gnome_cmd_data_set_string ("/options/document_icon_dir", priv->document_icon_dir);
+ gnome_cmd_data_set_int ("/options/icon_scale_quality", options.icon_scale_quality);
+ gnome_cmd_data_set_string ("/options/theme_icon_dir", options.theme_icon_dir);
+ gnome_cmd_data_set_string ("/options/document_icon_dir", options.document_icon_dir);
gnome_cmd_data_set_int ("/options/cmdline_history_length", cmdline_history_length);
gnome_cmd_data_set_int ("/options/btn_relief", button_relief);
gnome_cmd_data_set_bool ("/options/list_orientation", list_orientation);
@@ -1738,7 +1722,7 @@ void gnome_cmd_data_set_fav_apps (GList *apps)
GnomeCmdColorTheme *gnome_cmd_data_get_current_color_theme ()
{
- return &gnome_cmd_data.priv->color_themes[gnome_cmd_data.color_mode];
+ return &gnome_cmd_data.priv->color_themes[gnome_cmd_data.options.color_mode];
}
@@ -1750,48 +1734,35 @@ GnomeCmdColorTheme *gnome_cmd_data_get_custom_color_theme ()
GnomeCmdLsColorsPalette *gnome_cmd_data_get_ls_colors_palette ()
{
- return &gnome_cmd_data.priv->ls_colors_palette;
-}
-
-
-const gchar *gnome_cmd_data_get_list_font ()
-{
- return gnome_cmd_data.priv->list_font;
-}
-
-
-void gnome_cmd_data_set_list_font (const gchar *list_font)
-{
- g_free (gnome_cmd_data.priv->list_font);
- gnome_cmd_data.priv->list_font = g_strdup (list_font);
+ return &gnome_cmd_data.options.ls_colors_palette;
}
const gchar *gnome_cmd_data_get_theme_icon_dir ()
{
- return gnome_cmd_data.priv->theme_icon_dir;
+ return gnome_cmd_data.options.theme_icon_dir;
}
void gnome_cmd_data_set_theme_icon_dir (const gchar *dir)
{
- g_free (gnome_cmd_data.priv->theme_icon_dir);
+ g_free (gnome_cmd_data.options.theme_icon_dir);
- gnome_cmd_data.priv->theme_icon_dir = g_strdup (dir);
+ gnome_cmd_data.options.theme_icon_dir = g_strdup (dir);
}
const gchar *gnome_cmd_data_get_document_icon_dir ()
{
- return gnome_cmd_data.priv->document_icon_dir;
+ return gnome_cmd_data.options.document_icon_dir;
}
void gnome_cmd_data_set_document_icon_dir (const gchar *dir)
{
- g_free (gnome_cmd_data.priv->document_icon_dir);
+ g_free (gnome_cmd_data.options.document_icon_dir);
- gnome_cmd_data.priv->document_icon_dir = g_strdup (dir);
+ gnome_cmd_data.options.document_icon_dir = g_strdup (dir);
}
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 34ed42c..095b120 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -84,6 +84,19 @@ struct GnomeCmdData
GnomeCmdSizeDispMode size_disp_mode;
GnomeCmdPermDispMode perm_disp_mode;
GnomeCmdDateFormat date_format; // NOTE: internally stored as locale (which not always defaults to UTF8), needs converting from/to UTF8 for editing and cfg load/save
+ // Layout
+ gchar *list_font;
+ gint list_row_height;
+ GnomeCmdExtDispMode ext_disp_mode;
+ GnomeCmdLayout layout;
+ GnomeCmdColorMode color_mode;
+ gboolean use_ls_colors;
+ GnomeCmdLsColorsPalette ls_colors_palette;
+ guint icon_size;
+ GdkInterpType icon_scale_quality;
+ gchar *theme_icon_dir;
+ gchar *document_icon_dir;
+
Options(): left_mouse_button_mode(LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
left_mouse_button_unselects(TRUE),
@@ -99,13 +112,25 @@ struct GnomeCmdData
save_dir_history_on_exit(TRUE),
size_disp_mode(GNOME_CMD_SIZE_DISP_MODE_POWERED),
perm_disp_mode(GNOME_CMD_PERM_DISP_MODE_TEXT),
- date_format(NULL)
+ date_format(NULL),
+ list_font(NULL),
+ list_row_height(16),
+ ext_disp_mode(GNOME_CMD_EXT_DISP_BOTH),
+ layout(GNOME_CMD_LAYOUT_MIME_ICONS),
+ color_mode(GNOME_CMD_COLOR_DEEP_BLUE),
+ use_ls_colors(FALSE),
+ icon_size(16),
+ icon_scale_quality(GDK_INTERP_HYPER),
+ theme_icon_dir(NULL),
+ document_icon_dir(NULL)
{
+ memset(&ls_colors_palette, 0, sizeof(ls_colors_palette));
}
~Options()
{
g_free (date_format);
+ g_free (list_font);
}
void set_date_format (const GnomeCmdDateFormat format)
@@ -113,6 +138,12 @@ struct GnomeCmdData
g_free (date_format);
date_format = g_strdup (format);
}
+
+ void set_list_font (const gchar *font)
+ {
+ g_free (list_font);
+ list_font = g_strdup (font);
+ }
};
struct Selection
@@ -251,7 +282,6 @@ struct GnomeCmdData
GnomeCmdConfirmOverwriteMode confirm_copy_overwrite;
GnomeCmdConfirmOverwriteMode confirm_move_overwrite;
gboolean confirm_mouse_dnd;
- GnomeCmdColorMode color_mode;
Options options;
@@ -264,8 +294,6 @@ struct GnomeCmdData
IntViewerConfig intviewer_defaults;
BookmarksConfig bookmarks_defaults;
- GnomeCmdLayout layout;
- GnomeCmdExtDispMode ext_disp_mode;
gboolean list_orientation;
gboolean toolbar_visibility;
@@ -274,14 +302,9 @@ struct GnomeCmdData
gboolean cmdline_visibility;
gboolean buttonbar_visibility;
- gboolean use_ls_colors;
-
- guint icon_size;
guint dev_icon_size;
gboolean device_only_icon;
- gint list_row_height;
guint fs_col_width[GnomeCmdFileList::NUM_COLUMNS];
- GdkInterpType icon_scale_quality;
guint gui_update_rate;
GtkReliefStyle button_relief;
@@ -369,9 +392,6 @@ inline void GnomeCmdData::set_term(const gchar *command)
term = g_strdup (command);
}
-const gchar *gnome_cmd_data_get_list_font ();
-void gnome_cmd_data_set_list_font (const gchar *list_font);
-
const gchar *gnome_cmd_data_get_theme_icon_dir ();
void gnome_cmd_data_set_theme_icon_dir (const gchar *dir);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index a626234..3e1becf 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -302,7 +302,7 @@ gchar FileFormatData::empty_string[] = "";
inline FileFormatData::FileFormatData(GnomeCmdFile *f, gboolean tree_size)
{
// If the user wants a character instead of icon for filetype set it now
- if (gnome_cmd_data.layout == GNOME_CMD_LAYOUT_TEXT)
+ if (gnome_cmd_data.options.layout == GNOME_CMD_LAYOUT_TEXT)
text[GnomeCmdFileList::COLUMN_ICON] = (gchar *) f->get_type_string();
else
text[GnomeCmdFileList::COLUMN_ICON] = NULL;
@@ -314,7 +314,7 @@ inline FileFormatData::FileFormatData(GnomeCmdFile *f, gboolean tree_size)
g_free (t1);
g_free (t2);
- if (gnome_cmd_data.ext_disp_mode == GNOME_CMD_EXT_DISP_STRIPPED
+ if (gnome_cmd_data.options.ext_disp_mode == GNOME_CMD_EXT_DISP_STRIPPED
&& f->info->type == GNOME_VFS_FILE_TYPE_REGULAR)
{
gchar *t = strip_extension (f->get_name());
@@ -324,7 +324,7 @@ inline FileFormatData::FileFormatData(GnomeCmdFile *f, gboolean tree_size)
else
fname = get_utf8 (f->get_name());
- if (gnome_cmd_data.ext_disp_mode != GNOME_CMD_EXT_DISP_WITH_FNAME)
+ if (gnome_cmd_data.options.ext_disp_mode != GNOME_CMD_EXT_DISP_WITH_FNAME)
fext = get_utf8 (f->get_extension());
else
fext = NULL;
@@ -425,7 +425,7 @@ static void get_focus_row_coordinates (GnomeCmdFileList *fl, gint &x, gint &y, g
y = y0 + row*rowh + GTK_CLIST (fl)->voffset;
width = GTK_CLIST (fl)->column[GnomeCmdFileList::COLUMN_NAME].area.width + 2*COLUMN_INSET;
- if (gnome_cmd_data.ext_disp_mode != GNOME_CMD_EXT_DISP_BOTH)
+ if (gnome_cmd_data.options.ext_disp_mode != GNOME_CMD_EXT_DISP_BOTH)
width += GTK_CLIST (fl)->column[GnomeCmdFileList::COLUMN_EXT].area.width + 2*COLUMN_INSET + CELL_SPACING;
height = rowh + 2*CELL_SPACING;
@@ -462,7 +462,7 @@ void GnomeCmdFileList::select_file(GnomeCmdFile *f, gint row)
return;
- if (!gnome_cmd_data.use_ls_colors)
+ if (!gnome_cmd_data.options.use_ls_colors)
gtk_clist_set_row_style (*this, row, row%2 ? alt_sel_list_style : sel_list_style);
else
{
@@ -497,7 +497,7 @@ void GnomeCmdFileList::unselect_file(GnomeCmdFile *f, gint row)
priv->selected_files.remove(f);
- if (!gnome_cmd_data.use_ls_colors)
+ if (!gnome_cmd_data.options.use_ls_colors)
gtk_clist_set_row_style (*this, row, row%2 ? alt_list_style : list_style);
else
if (LsColor *col = ls_colors_get (f))
@@ -1652,7 +1652,7 @@ inline void add_file_to_clist (GnomeCmdFileList *fl, GnomeCmdFile *f, gint in_ro
gint row = in_row == -1 ? gtk_clist_append (clist, data.text) : gtk_clist_insert (clist, in_row, data.text);
// Setup row data and color
- if (!gnome_cmd_data.use_ls_colors)
+ if (!gnome_cmd_data.options.use_ls_colors)
gtk_clist_set_row_style (clist, row, row%2 ? alt_list_style : list_style);
else
{
@@ -1669,7 +1669,7 @@ inline void add_file_to_clist (GnomeCmdFileList *fl, GnomeCmdFile *f, gint in_ro
gtk_clist_set_row_data (clist, row, f);
// If the use wants icons to show file types set it now
- if (gnome_cmd_data.layout != GNOME_CMD_LAYOUT_TEXT)
+ if (gnome_cmd_data.options.layout != GNOME_CMD_LAYOUT_TEXT)
{
GdkPixmap *pixmap;
GdkBitmap *mask;
@@ -1783,7 +1783,7 @@ void GnomeCmdFileList::update_file(GnomeCmdFile *f)
for (gint i=1; i<NUM_COLUMNS; i++)
gtk_clist_set_text (*this, row, i, data.text[i]);
- if (gnome_cmd_data.layout != GNOME_CMD_LAYOUT_TEXT)
+ if (gnome_cmd_data.options.layout != GNOME_CMD_LAYOUT_TEXT)
{
GdkPixmap *pixmap;
GdkBitmap *mask;
@@ -2540,7 +2540,7 @@ void GnomeCmdFileList::set_directory(GnomeCmdDir *dir)
void GnomeCmdFileList::update_style()
{
- gtk_clist_set_row_height (*this, gnome_cmd_data.list_row_height);
+ gtk_clist_set_row_height (*this, gnome_cmd_data.options.list_row_height);
gnome_cmd_clist_update_style (*this);
}
@@ -2646,7 +2646,7 @@ static gboolean do_scroll (GnomeCmdFileList *fl)
gdk_drawable_get_size (GTK_WIDGET (clist)->window, &w, &h);
offset = (0-clist->voffset);
- row_height = gnome_cmd_data.list_row_height;
+ row_height = gnome_cmd_data.options.list_row_height;
row_count = clist->rows;
focus_row = gnome_cmd_clist_get_row (*fl, 1, fl->priv->autoscroll_y);
top_row = gnome_cmd_clist_get_row (*fl, 1, 0);
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 9fabce8..a9f2589 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -686,9 +686,9 @@ inline GtkWidget *create_layout_tab (GtkWidget *parent, GnomeCmdData &cfg)
fpicker = create_font_picker (parent, "list_font_picker");
table_add (table, fpicker, 1, 0, GTK_FILL);
- gtk_font_button_set_font_name (GTK_FONT_BUTTON (fpicker), gnome_cmd_data_get_list_font ());
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (fpicker), cfg.options.list_font);
- spin = create_spin (parent, "row_height_spin", 8, 64, cfg.list_row_height);
+ spin = create_spin (parent, "row_height_spin", 8, 64, cfg.options.list_row_height);
table_add (table, spin, 1, 1, GTK_FILL);
label = create_label (parent, _("Font:"));
@@ -729,12 +729,12 @@ inline GtkWidget *create_layout_tab (GtkWidget *parent, GnomeCmdData &cfg)
btn = create_button_with_data (parent, _("Edit..."), GTK_SIGNAL_FUNC (on_colors_edit), parent);
g_object_set_data (G_OBJECT (parent), "color_btn", btn);
gtk_box_pack_start (GTK_BOX (hbox), btn, FALSE, TRUE, 0);
- gtk_widget_set_sensitive (btn, cfg.color_mode == GNOME_CMD_COLOR_CUSTOM);
+ gtk_widget_set_sensitive (btn, cfg.options.color_mode == GNOME_CMD_COLOR_CUSTOM);
// LS_COLORS
check = create_check (parent, _("Colorize files according to the LS_COLORS environment variable"), "use_ls_colors");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.use_ls_colors);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.use_ls_colors);
hbox = create_hbox (parent, FALSE, 6);
gtk_table_attach (GTK_TABLE (table), hbox, 0, 2, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
@@ -744,7 +744,7 @@ inline GtkWidget *create_layout_tab (GtkWidget *parent, GnomeCmdData &cfg)
btn = create_button_with_data (parent, _("Edit colors..."), GTK_SIGNAL_FUNC (on_ls_colors_edit), parent);
g_object_set_data (G_OBJECT (parent), "ls_colors_edit_btn", btn);
gtk_box_pack_start (GTK_BOX (hbox), btn, FALSE, TRUE, 0);
- gtk_widget_set_sensitive (btn, cfg.use_ls_colors);
+ gtk_widget_set_sensitive (btn, cfg.options.use_ls_colors);
// MIME icon settings
@@ -753,9 +753,9 @@ inline GtkWidget *create_layout_tab (GtkWidget *parent, GnomeCmdData &cfg)
g_object_set_data (G_OBJECT (parent), "mime_icon_settings_frame", cat);
gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, FALSE, 0);
- spin = create_spin (parent, "iconsize_spin", 8, 64, cfg.icon_size);
+ spin = create_spin (parent, "iconsize_spin", 8, 64, cfg.options.icon_size);
table_add (table, spin, 1, 0, (GtkAttachOptions) GTK_FILL);
- scale = create_scale (parent, "iconquality_scale", cfg.icon_scale_quality, 0, 3);
+ scale = create_scale (parent, "iconquality_scale", cfg.options.icon_scale_quality, 0, 3);
table_add (table, scale, 1, 1, (GtkAttachOptions) GTK_FILL);
entry = create_file_entry (parent, "theme_icondir_entry", gnome_cmd_data_get_theme_icon_dir ());
table_add (table, entry, 1, 2, (GtkAttachOptions)0);
@@ -772,9 +772,9 @@ inline GtkWidget *create_layout_tab (GtkWidget *parent, GnomeCmdData &cfg)
table_add (table, label, 0, 3, (GtkAttachOptions) GTK_FILL);
- gtk_option_menu_set_history (GTK_OPTION_MENU (fe_optmenu), (gint) cfg.ext_disp_mode);
- gtk_option_menu_set_history (GTK_OPTION_MENU (lm_optmenu), (gint) cfg.layout);
- gtk_option_menu_set_history (GTK_OPTION_MENU (cm_optmenu), (gint) cfg.color_mode);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (fe_optmenu), (gint) cfg.options.ext_disp_mode);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (lm_optmenu), (gint) cfg.options.layout);
+ gtk_option_menu_set_history (GTK_OPTION_MENU (cm_optmenu), (gint) cfg.options.color_mode);
return frame;
}
@@ -795,23 +795,23 @@ inline void store_layout_options (GtkWidget *dialog, GnomeCmdData &cfg)
GtkWidget *list_font_picker = lookup_widget (dialog, "list_font_picker");
- cfg.ext_disp_mode = (GnomeCmdExtDispMode) gtk_option_menu_get_history (GTK_OPTION_MENU (fe_optmenu));
- cfg.layout = (GnomeCmdLayout) gtk_option_menu_get_history (GTK_OPTION_MENU (lm_optmenu));
- cfg.color_mode = (GnomeCmdColorMode) gtk_option_menu_get_history (GTK_OPTION_MENU (cm_optmenu));
+ cfg.options.ext_disp_mode = (GnomeCmdExtDispMode) gtk_option_menu_get_history (GTK_OPTION_MENU (fe_optmenu));
+ cfg.options.layout = (GnomeCmdLayout) gtk_option_menu_get_history (GTK_OPTION_MENU (lm_optmenu));
+ cfg.options.color_mode = (GnomeCmdColorMode) gtk_option_menu_get_history (GTK_OPTION_MENU (cm_optmenu));
- cfg.use_ls_colors = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (use_ls));
+ cfg.options.use_ls_colors = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (use_ls));
const gchar *list_font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (list_font_picker));
- gnome_cmd_data_set_list_font (list_font);
+ cfg.options.set_list_font (list_font);
gnome_cmd_data_set_theme_icon_dir (gtk_entry_get_text (GTK_ENTRY (theme_icondir_entry)));
gnome_cmd_data_set_document_icon_dir (gtk_entry_get_text (GTK_ENTRY (doc_icondir_entry)));
- cfg.icon_size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (iconsize_spin));
+ cfg.options.icon_size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (iconsize_spin));
GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (iconquality_scale));
- cfg.icon_scale_quality = (GdkInterpType) adj->value;
+ cfg.options.icon_scale_quality = (GdkInterpType) adj->value;
- cfg.list_row_height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (row_height_spin));
+ cfg.options.list_row_height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (row_height_spin));
}
diff --git a/src/gnome-cmd-style.cc b/src/gnome-cmd-style.cc
index 9f744d5..1de4725 100644
--- a/src/gnome-cmd-style.cc
+++ b/src/gnome-cmd-style.cc
@@ -169,7 +169,7 @@ void gnome_cmd_style_create (GnomeCmdData &cfg)
if (alt_sel_list_style) g_object_unref (alt_sel_list_style);
GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
- const gchar *font_name = gnome_cmd_data_get_list_font ();
+ const gchar *font_name = gnome_cmd_data.options.list_font;
list_style = create_list_style (cols, font_name);
alt_list_style = create_alt_list_style (cols, font_name);
diff --git a/src/imageloader.cc b/src/imageloader.cc
index a6c12b6..34746be 100644
--- a/src/imageloader.cc
+++ b/src/imageloader.cc
@@ -282,13 +282,13 @@ static gboolean load_icon (const gchar *icon_path, GdkPixmap **pm, GdkBitmap **b
// Scale the pixmap if needed
- h = gnome_cmd_data.icon_size;
+ h = gnome_cmd_data.options.icon_size;
if (h != gdk_pixbuf_get_height (pixbuf))
{
scale = (gfloat)h/(gfloat)gdk_pixbuf_get_height (pixbuf);
w = (gint)(scale*(gfloat)gdk_pixbuf_get_width (pixbuf));
- GdkPixbuf *tmp = gdk_pixbuf_scale_simple (pixbuf, w, h, gnome_cmd_data.icon_scale_quality);
+ GdkPixbuf *tmp = gdk_pixbuf_scale_simple (pixbuf, w, h, gnome_cmd_data.options.icon_scale_quality);
g_object_unref (pixbuf);
pixbuf = tmp;
}
@@ -424,7 +424,7 @@ gboolean IMAGE_get_pixmap_and_mask (GnomeVFSFileType type,
GdkPixmap **pixmap,
GdkBitmap **mask)
{
- switch (gnome_cmd_data.layout)
+ switch (gnome_cmd_data.options.layout)
{
case GNOME_CMD_LAYOUT_TYPE_ICONS:
return get_type_icon (type, symlink, pixmap, mask);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]