[gnome-commander/gcmd-1-2-8] Do not call IMAGE_get_pixmap_and_mask() twice when displaying file icons
- From: Piotr Eljasiak <epiotr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-commander/gcmd-1-2-8] Do not call IMAGE_get_pixmap_and_mask() twice when displaying file icons
- Date: Sat, 12 Sep 2009 11:57:01 +0000 (UTC)
commit c02a55df27fa8d1248db21d8cfb107159721ecd2
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Sat Sep 12 13:42:14 2009 +0200
Do not call IMAGE_get_pixmap_and_mask() twice when displaying file icons
That should spare a few cpu cycles when in file icon mode.
src/gnome-cmd-file-list.cc | 10 +++++++---
src/gnome-cmd-file.cc | 9 +++++++++
src/gnome-cmd-file.h | 1 +
3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index ef3d5d6..1d453d8 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1524,9 +1524,13 @@ void GnomeCmdFileList::update_file(GnomeCmdFile *f)
gtk_clist_set_text (*this, row, i, data.text[i]);
if (gnome_cmd_data.layout != GNOME_CMD_LAYOUT_TEXT)
- gtk_clist_set_pixmap (*this, row, 0,
- gnome_cmd_file_get_type_pixmap (f),
- gnome_cmd_file_get_type_mask (f));
+ {
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ if (gnome_cmd_file_get_type_pixmap_and_mask (f, &pixmap, &mask))
+ gtk_clist_set_pixmap (*this, row, 0, pixmap, mask);
+ }
}
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index e3332f9..561d29c 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -646,6 +646,15 @@ const gchar *gnome_cmd_file_get_type_desc (GnomeCmdFile *f)
}
+gboolean gnome_cmd_file_get_type_pixmap_and_mask (GnomeCmdFile *f, GdkPixmap **pixmap, GdkBitmap **mask)
+{
+ g_return_val_if_fail (f != NULL, NULL);
+ g_return_val_if_fail (f->info != NULL, NULL);
+
+ return IMAGE_get_pixmap_and_mask (f->info->type, f->info->mime_type, f->info->symlink_name != NULL, pixmap, mask);
+}
+
+
GdkPixmap *gnome_cmd_file_get_type_pixmap (GnomeCmdFile *f)
{
g_return_val_if_fail (f != NULL, NULL);
diff --git a/src/gnome-cmd-file.h b/src/gnome-cmd-file.h
index ee7a860..7f10bc6 100644
--- a/src/gnome-cmd-file.h
+++ b/src/gnome-cmd-file.h
@@ -106,6 +106,7 @@ gboolean gnome_cmd_file_mime_begins_with (GnomeCmdFile *f, const gchar *mime_typ
const gchar *gnome_cmd_file_get_type_string (GnomeCmdFile *f);
const gchar *gnome_cmd_file_get_type_desc (GnomeCmdFile *f);
+gboolean gnome_cmd_file_get_type_pixmap_and_mask (GnomeCmdFile *f, GdkPixmap **pixmap, GdkBitmap **mask);
GdkPixmap *gnome_cmd_file_get_type_pixmap (GnomeCmdFile *f);
GdkBitmap *gnome_cmd_file_get_type_mask (GnomeCmdFile *f);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]