gnome-commander r2047 - in trunk: . src



Author: epiotr
Date: Fri Sep  5 17:13:36 2008
New Revision: 2047
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2047&view=rev

Log:
GnomeCmdFileCollection::remove(): return TRUE if success, FALSE otherwise

Modified:
   trunk/ChangeLog
   trunk/src/gnome-cmd-file-collection.cc
   trunk/src/gnome-cmd-file-collection.h

Modified: trunk/src/gnome-cmd-file-collection.cc
==============================================================================
--- trunk/src/gnome-cmd-file-collection.cc	(original)
+++ trunk/src/gnome-cmd-file-collection.cc	Fri Sep  5 17:13:36 2008
@@ -36,26 +36,31 @@
 }
 
 
-void GnomeCmdFileCollection::remove(GnomeCmdFile *file)
+gboolean GnomeCmdFileCollection::remove(GnomeCmdFile *file)
 {
-    g_return_if_fail (GNOME_CMD_IS_FILE (file));
+    g_return_val_if_fail (GNOME_CMD_IS_FILE (file), FALSE);
 
     list = g_list_remove (list, file);
 
     gchar *uri_str = gnome_cmd_file_get_uri_str (file);
-    g_hash_table_remove (map, uri_str);
+    gboolean retval = g_hash_table_remove (map, uri_str);
     g_free (uri_str);
+
+    return retval;
 }
 
 
-void GnomeCmdFileCollection::remove(const gchar *uri_str)
+gboolean GnomeCmdFileCollection::remove(const gchar *uri_str)
 {
-    g_return_if_fail (uri_str != NULL);
+    g_return_val_if_fail (uri_str != NULL, FALSE);
 
     GnomeCmdFile *file = find(uri_str);
 
+    if (!file)
+        return FALSE;
+
     list = g_list_remove (list, file);
-    g_hash_table_remove (map, uri_str);
+    return g_hash_table_remove (map, uri_str);
 }
 
 

Modified: trunk/src/gnome-cmd-file-collection.h
==============================================================================
--- trunk/src/gnome-cmd-file-collection.h	(original)
+++ trunk/src/gnome-cmd-file-collection.h	Fri Sep  5 17:13:36 2008
@@ -40,8 +40,8 @@
 
     void add(GnomeCmdFile *file);
     void add(GList *files);
-    void remove(GnomeCmdFile *file);
-    void remove(const gchar *uri_str);
+    gboolean remove(GnomeCmdFile *file);
+    gboolean remove(const gchar *uri_str);
 
     GList *get_list()   {  return list;  }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]