[gnome-commander] Simplify creation of gcmd styles
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Simplify creation of gcmd styles
- Date: Sun, 6 Nov 2011 18:22:19 +0000 (UTC)
commit e3d868eff1504a7807b25c63fec864fdaea062ce
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Sun Nov 6 19:19:11 2011 +0100
Simplify creation of gcmd styles
Spare a few CPU cycles by reusing GnomeCmdColorTheme and font_name info
src/gnome-cmd-style.cc | 27 +++++++++++----------------
1 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/gnome-cmd-style.cc b/src/gnome-cmd-style.cc
index e28d80f..c965cf1 100644
--- a/src/gnome-cmd-style.cc
+++ b/src/gnome-cmd-style.cc
@@ -34,10 +34,8 @@ GtkStyle *sel_list_style = NULL;
GtkStyle *alt_sel_list_style = NULL;
-inline GtkStyle *create_list_style ()
+inline GtkStyle *create_list_style (GnomeCmdColorTheme *cols, const gchar *font_name)
{
- GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
- const gchar *font_name = gnome_cmd_data_get_list_font ();
GtkStyle *style = gtk_style_new ();
if (strcmp (font_name, "default") != 0)
@@ -68,10 +66,8 @@ inline GtkStyle *create_list_style ()
}
-inline GtkStyle *create_alt_list_style ()
+inline GtkStyle *create_alt_list_style (GnomeCmdColorTheme *cols, const gchar *font_name)
{
- GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
- const gchar *font_name = gnome_cmd_data_get_list_font ();
GtkStyle *style = gtk_style_new ();
if (strcmp (font_name, "default") != 0)
@@ -101,10 +97,8 @@ inline GtkStyle *create_alt_list_style ()
}
-inline GtkStyle *create_sel_list_style ()
+inline GtkStyle *create_sel_list_style (GnomeCmdColorTheme *cols, const gchar *font_name)
{
- GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
- const gchar *font_name = gnome_cmd_data_get_list_font ();
GtkStyle *style = gtk_style_new ();
if (strcmp (font_name, "default") != 0)
@@ -135,10 +129,8 @@ inline GtkStyle *create_sel_list_style ()
}
-inline GtkStyle *create_alt_sel_list_style ()
+inline GtkStyle *create_alt_sel_list_style (GnomeCmdColorTheme *cols, const gchar *font_name)
{
- GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
- const gchar *font_name = gnome_cmd_data_get_list_font ();
GtkStyle *style = gtk_style_new ();
if (strcmp (font_name, "default") != 0)
@@ -176,8 +168,11 @@ void gnome_cmd_style_create ()
if (sel_list_style) g_object_unref (sel_list_style);
if (alt_sel_list_style) g_object_unref (alt_sel_list_style);
- list_style = create_list_style ();
- alt_list_style = create_alt_list_style ();
- sel_list_style = create_sel_list_style ();
- alt_sel_list_style = create_alt_sel_list_style ();
+ GnomeCmdColorTheme *cols = gnome_cmd_data_get_current_color_theme ();
+ const gchar *font_name = gnome_cmd_data_get_list_font ();
+
+ list_style = create_list_style (cols, font_name);
+ alt_list_style = create_alt_list_style (cols, font_name);
+ sel_list_style = create_sel_list_style (cols, font_name);
+ alt_sel_list_style = create_alt_sel_list_style (cols, font_name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]