Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv8599/src

Modified Files:
        file.c file.h prefs_window.c 
Log Message:
        * gtkpod.glade
          src/file.c
          src/prefs_window.c: file exclusion mask when adding tracks
          -- thanks to Richard Hyde for the patch.



Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- file.c      30 Aug 2006 14:04:29 -0000      1.182
+++ file.c      1 Sep 2006 13:18:42 -0000       1.183
@@ -1,4 +1,4 @@
-/* Time-stamp: <2006-08-29 23:05:02 jcs>
+/* Time-stamp: <2006-09-01 22:12:31 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -159,6 +159,37 @@
 }
 
 
+/** check a filename against the "excludes file mask" from the preferences
+ *  and return TRUE if it should be excluded based on the mask
+ */
+static gboolean excludefile (gchar *filename)
+{
+    gboolean matched = FALSE;
+    gchar **masks, *prefs_masks;
+
+    prefs_masks = prefs_get_string ("exclude_file_mask");
+    
+    if (prefs_masks == NULL) 
+        return FALSE;
+    
+    masks = g_strsplit (prefs_masks, ";", -1);
+
+    if (masks != NULL)
+    {
+       gint i;
+        for(i=0; !matched && masks[i]; i++)
+       {
+           matched = g_pattern_match_simple (g_strstrip(masks[i]), filename);
+       }
+        g_strfreev (masks);
+    }
+    
+    g_free(prefs_masks);
+    
+    return matched;
+}
+
+
 /*------------------------------------------------------------------*\
  *                                                                  *
  *      Add Playlists                                               *
@@ -1700,6 +1731,15 @@
       gtkpod_statusbar_message (_("Processing '%s'..."), bn_utf8);
       while (widgets_blocked && gtk_events_pending ())  gtk_main_iteration ();
       g_free (bn_utf8);
+
+      if (excludefile(basename))
+      {
+          gtkpod_warning (_("File skipped. match exclude masks: '%s'\n"), 
basename);
+         while (widgets_blocked && gtk_events_pending ())
+             gtk_main_iteration ();
+         g_free (basename);
+         return FALSE;
+      }
   }
   C_FREE (basename);
 
@@ -2208,3 +2248,4 @@
     }
     return result;
 }
+

Index: file.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- file.h      11 Jun 2006 16:04:47 -0000      1.54
+++ file.h      1 Sep 2006 13:18:42 -0000       1.55
@@ -1,4 +1,4 @@
-/* Time-stamp: <2006-06-11 18:05:04 jcs>
+/* Time-stamp: <2006-09-01 22:00:03 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -d -r1.182 -r1.183
--- prefs_window.c      27 Jun 2006 00:31:52 -0000      1.182
+++ prefs_window.c      1 Sep 2006 13:18:42 -0000       1.183
@@ -230,7 +230,6 @@
     g_free (buf);
 }
 
-
 /* turn the prefs window insensitive (if it's open) */
 void prefs_window_block (void)
 {
@@ -657,6 +656,12 @@
     {
        gtk_notebook_set_current_page (GTK_NOTEBOOK (w), page);
     }
+    
+    w = gtkpod_xml_get_widget (prefs_window_xml, "exclude_file_mask_entry");
+    buf = prefs_get_string("exclude_file_mask");
+    gtk_entry_set_text(GTK_ENTRY(w), buf);
+    g_free(buf);
+    
     prefs_window_show_hide_tooltips ();
     gtk_widget_show(prefs_window);
 }
@@ -1989,3 +1994,13 @@
     temp_prefs_set_int(sort_temp_prefs, "case_sensitive",
                       val);
 }
+
+void on_exclude_file_mask_entry_changed (GtkEditable   *editable,
+                                        gpointer       user_data)
+{
+    gchar *buf = gtk_editable_get_chars(editable, 0, -1);
+
+    temp_prefs_set_string (temp_prefs, "exclude_file_mask", buf);
+    g_free (buf);
+}
+


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to