gnome-commander r1593 - branches/gcmd-1-3/src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1593 - branches/gcmd-1-3/src
- Date: Tue, 26 Feb 2008 15:09:01 +0000 (GMT)
Author: epiotr
Date: Tue Feb 26 15:09:01 2008
New Revision: 1593
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1593&view=rev
Log:
Code cleanup
Modified:
branches/gcmd-1-3/src/gnome-cmd-app.cc
branches/gcmd-1-3/src/gnome-cmd-con-device.cc
branches/gcmd-1-3/src/gnome-cmd-con.cc
branches/gcmd-1-3/src/gnome-cmd-file-collection.cc
branches/gcmd-1-3/src/gnome-cmd-pixmap.cc
branches/gcmd-1-3/src/gnome-cmd-pixmap.h
branches/gcmd-1-3/src/imageloader.cc
Modified: branches/gcmd-1-3/src/gnome-cmd-app.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-app.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-app.cc Tue Feb 26 15:09:01 2008
@@ -121,8 +121,7 @@
g_free (app->priv->name);
g_free (app->priv->cmd);
g_free (app->priv->icon_path);
- if (app->priv->pixmap)
- gnome_cmd_pixmap_free (app->priv->pixmap);
+ gnome_cmd_pixmap_free (app->priv->pixmap);
g_free (app->priv);
g_free (app);
@@ -163,8 +162,7 @@
g_free (app->priv->icon_path);
- if (app->priv->pixmap)
- gnome_cmd_pixmap_free (app->priv->pixmap);
+ gnome_cmd_pixmap_free (app->priv->pixmap);
app->priv->icon_path = g_strdup (icon_path);
Modified: branches/gcmd-1-3/src/gnome-cmd-con-device.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-con-device.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-con-device.cc Tue Feb 26 15:09:01 2008
@@ -458,12 +458,9 @@
GnomeCmdCon *con = GNOME_CMD_CON (dev);
- if (con->go_pixmap)
- gnome_cmd_pixmap_free (con->go_pixmap);
- if (con->open_pixmap)
- gnome_cmd_pixmap_free (con->open_pixmap);
- if (con->close_pixmap)
- gnome_cmd_pixmap_free (con->close_pixmap);
+ gnome_cmd_pixmap_free (con->go_pixmap);
+ gnome_cmd_pixmap_free (con->open_pixmap);
+ gnome_cmd_pixmap_free (con->close_pixmap);
con->go_pixmap = NULL;
con->open_pixmap = NULL;
Modified: branches/gcmd-1-3/src/gnome-cmd-con.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-con.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-con.cc Tue Feb 26 15:09:01 2008
@@ -91,12 +91,10 @@
gtk_object_unref (GTK_OBJECT (con->base_path));
g_free (con->open_text);
g_free (con->open_tooltip);
- if (con->open_pixmap)
- gnome_cmd_pixmap_free (con->open_pixmap);
+ gnome_cmd_pixmap_free (con->open_pixmap);
g_free (con->close_text);
g_free (con->close_tooltip);
- if (con->close_pixmap)
- gnome_cmd_pixmap_free (con->close_pixmap);
+ gnome_cmd_pixmap_free (con->close_pixmap);
if (con->priv->cwd)
gnome_cmd_dir_unref (con->priv->cwd);
Modified: branches/gcmd-1-3/src/gnome-cmd-file-collection.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-file-collection.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-file-collection.cc Tue Feb 26 15:09:01 2008
@@ -37,8 +37,7 @@
* Gtk class implementation
*******************************/
-static void
-destroy (GtkObject *obj)
+static void destroy (GtkObject *obj)
{
GnomeCmdFileCollection *collection = GNOME_CMD_FILE_COLLECTION (obj);
@@ -51,8 +50,7 @@
}
-static void
-class_init (GnomeCmdFileCollectionClass *klass)
+static void class_init (GnomeCmdFileCollectionClass *klass)
{
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
@@ -62,8 +60,7 @@
}
-static void
-init (GnomeCmdFileCollection *collection)
+static void init (GnomeCmdFileCollection *collection)
{
collection->priv = g_new0 (GnomeCmdFileCollectionPrivate, 1);
collection->priv->map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)gnome_cmd_file_unref);
@@ -76,8 +73,7 @@
* Public functions
***********************************/
-GtkType
-gnome_cmd_file_collection_get_type (void)
+GtkType gnome_cmd_file_collection_get_type (void)
{
static GtkType type = 0;
@@ -101,16 +97,13 @@
}
-GnomeCmdFileCollection *
-gnome_cmd_file_collection_new (void)
+GnomeCmdFileCollection *gnome_cmd_file_collection_new (void)
{
return (GnomeCmdFileCollection *) gtk_type_new (gnome_cmd_file_collection_get_type ());
}
-void
-gnome_cmd_file_collection_add (GnomeCmdFileCollection *collection,
- GnomeCmdFile *file)
+void gnome_cmd_file_collection_add (GnomeCmdFileCollection *collection, GnomeCmdFile *file)
{
g_return_if_fail (GNOME_CMD_IS_FILE_COLLECTION (collection));
g_return_if_fail (GNOME_CMD_IS_FILE (file));
@@ -123,18 +116,14 @@
}
-void
-gnome_cmd_file_collection_add_list (GnomeCmdFileCollection *collection,
- GList *files)
+void gnome_cmd_file_collection_add_list (GnomeCmdFileCollection *collection, GList *files)
{
for (; files; files = files->next)
gnome_cmd_file_collection_add (collection, GNOME_CMD_FILE (files->data));
}
-void
-gnome_cmd_file_collection_remove (GnomeCmdFileCollection *collection,
- GnomeCmdFile *file)
+void gnome_cmd_file_collection_remove (GnomeCmdFileCollection *collection, GnomeCmdFile *file)
{
g_return_if_fail (GNOME_CMD_IS_FILE_COLLECTION (collection));
g_return_if_fail (GNOME_CMD_IS_FILE (file));
@@ -147,9 +136,7 @@
}
-void
-gnome_cmd_file_collection_remove_by_uri (GnomeCmdFileCollection *collection,
- const gchar *uri_str)
+void gnome_cmd_file_collection_remove_by_uri (GnomeCmdFileCollection *collection, const gchar *uri_str)
{
g_return_if_fail (GNOME_CMD_IS_FILE_COLLECTION (collection));
g_return_if_fail (uri_str != NULL);
Modified: branches/gcmd-1-3/src/gnome-cmd-pixmap.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-pixmap.cc (original)
+++ branches/gcmd-1-3/src/gnome-cmd-pixmap.cc Tue Feb 26 15:09:01 2008
@@ -66,19 +66,3 @@
return pixmap;
}
-
-
-void gnome_cmd_pixmap_free (GnomeCmdPixmap *pixmap)
-{
- g_return_if_fail (pixmap != NULL);
- g_return_if_fail (pixmap->pixbuf != NULL);
- g_return_if_fail (pixmap->pixmap != NULL);
- g_return_if_fail (pixmap->mask != NULL);
-
- gdk_pixbuf_unref (pixmap->pixbuf);
- gdk_pixmap_unref (pixmap->pixmap);
- gdk_bitmap_unref (pixmap->mask);
-
- g_free (pixmap);
-}
-
Modified: branches/gcmd-1-3/src/gnome-cmd-pixmap.h
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-pixmap.h (original)
+++ branches/gcmd-1-3/src/gnome-cmd-pixmap.h Tue Feb 26 15:09:01 2008
@@ -33,6 +33,21 @@
GnomeCmdPixmap *gnome_cmd_pixmap_new_from_file (const gchar *filepath, int width=-1, int height=-1);
GnomeCmdPixmap *gnome_cmd_pixmap_new_from_icon (const gchar *icon_name, gint size, GtkIconLookupFlags flags=(GtkIconLookupFlags) 0);
GnomeCmdPixmap *gnome_cmd_pixmap_new_from_pixbuf (GdkPixbuf *pixbuf);
-void gnome_cmd_pixmap_free (GnomeCmdPixmap *pixmap);
+
+inline void gnome_cmd_pixmap_free (GnomeCmdPixmap *pixmap)
+{
+ if (!pixmap)
+ return;
+
+ g_return_if_fail (pixmap->pixbuf != NULL);
+ g_return_if_fail (pixmap->pixmap != NULL);
+ g_return_if_fail (pixmap->mask != NULL);
+
+ gdk_pixbuf_unref (pixmap->pixbuf);
+ gdk_pixmap_unref (pixmap->pixmap);
+ gdk_bitmap_unref (pixmap->mask);
+
+ g_free (pixmap);
+}
#endif // __GNOME_CMD_PIXMAP_H__
Modified: branches/gcmd-1-3/src/imageloader.cc
==============================================================================
--- branches/gcmd-1-3/src/imageloader.cc (original)
+++ branches/gcmd-1-3/src/imageloader.cc Tue Feb 26 15:09:01 2008
@@ -51,36 +51,31 @@
};
-static const gchar *pixmap_files[NUM_PIXMAPS] = {
- "",
- "gnome_cmd_arrow_up.xpm",
- "gnome_cmd_arrow_down.xpm",
- "gnome_cmd_arrow_blank.xpm",
-
- "gnome-commander.xpm",
- "exec_wheel.xpm",
- "menu_bookmark.xpm",
-
- "overlay_symlink.xpm",
- "overlay_umount.xpm",
- "parent_dir.xpm",
- "root_dir.xpm",
- "toggle_vertical.xpm",
- "toggle_horizontal.xpm",
-
- "internal-viewer.xpm"
-};
-
-
-#define NUM_CATEGORIES 6
-static const gchar *categories[NUM_CATEGORIES][2] = {
- {"text", "gnome-text-plain.png"},
- {"video", "gnome-video-plain.png"},
- {"image", "gnome-image-plain.png"},
- {"audio", "gnome-audio-plain.png"},
- {"pack", "gnome-pack-plain.png"},
- {"font", "gnome-font-plain.png"}
-};
+static const gchar *pixmap_files[NUM_PIXMAPS] = {"",
+ "gnome_cmd_arrow_up.xpm",
+ "gnome_cmd_arrow_down.xpm",
+ "gnome_cmd_arrow_blank.xpm",
+
+ "gnome-commander.xpm",
+ "exec_wheel.xpm",
+ "menu_bookmark.xpm",
+
+ "overlay_symlink.xpm",
+ "overlay_umount.xpm",
+ "parent_dir.xpm",
+ "root_dir.xpm",
+ "toggle_vertical.xpm",
+ "toggle_horizontal.xpm",
+
+ "internal-viewer.xpm"};
+
+
+static const gchar *categories[][2] = {{"text", "gnome-text-plain.png"},
+ {"video", "gnome-video-plain.png"},
+ {"image", "gnome-image-plain.png"},
+ {"audio", "gnome-audio-plain.png"},
+ {"pack", "gnome-pack-plain.png"},
+ {"font", "gnome-font-plain.png"}};
static GnomeCmdPixmap *pixmaps[NUM_PIXMAPS];
static CacheEntry file_type_pixmaps[NUM_FILE_TYPE_PIXMAPS];
@@ -89,12 +84,7 @@
static GdkPixbuf *symlink_pixbuf = NULL;
-static gboolean
-load_icon (const gchar *icon_path,
- GdkPixmap **pm,
- GdkBitmap **bm,
- GdkPixmap **lpm,
- GdkBitmap **lbm);
+static gboolean load_icon (const gchar *icon_path, GdkPixmap **pm, GdkBitmap **bm, GdkPixmap **lpm, GdkBitmap **lbm);
/*
@@ -288,7 +278,7 @@
*/
inline gchar *get_category_icon_path (const gchar *mime_type, const gchar *icon_dir)
{
- for (gint i=0; i<NUM_CATEGORIES; i++)
+ for (gint i=0; i<G_N_ELEMENTS(categories); i++)
if (g_str_has_prefix (mime_type, categories[i][0]))
return g_build_path (G_DIR_SEPARATOR_S, icon_dir, categories[i][1], NULL);
@@ -299,12 +289,7 @@
/**
* Tries to load an image from the specified path
*/
-static gboolean
-load_icon (const gchar *icon_path,
- GdkPixmap **pm,
- GdkBitmap **bm,
- GdkPixmap **lpm,
- GdkBitmap **lbm)
+static gboolean load_icon (const gchar *icon_path, GdkPixmap **pm, GdkBitmap **bm, GdkPixmap **lpm, GdkBitmap **lbm)
{
GdkPixbuf *pixbuf;
GdkPixbuf *lnk_pixbuf;
@@ -513,11 +498,9 @@
void IMAGE_free (void)
{
- int i;
-
- for (i=0; i<NUM_PIXMAPS; i++)
+ for (int i=0; i<NUM_PIXMAPS; i++)
{
- if (pixmaps[i]) gnome_cmd_pixmap_free (pixmaps[i]);
+ gnome_cmd_pixmap_free (pixmaps[i]);
pixmaps[i] = NULL;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]