Author: bgarret
Date: Sun Feb 17 21:29:01 2008
New Revision: 151
URL: http://svn.gnome.org/viewvc/hipo?rev=151&view=rev

Log:
2008-02-17  Benoit Garret  <[EMAIL PROTECTED]>

        * configure.ac:
        * data/Makefile.am:
        * data/hipo.schemas.in:
        * src/HipoMainWindow.cs:
        * src/Makefile.am:
        * src/Settings.cs:                                
        * src/Tools.cs: logging fixes
        * src/TracksSource.cs: logging fixes

        More logging.    
        Add gconf support and remember the last path
        opened in the filechooser.



Added:
   branches/bgarret/data/hipo.schemas.in
   branches/bgarret/src/Settings.cs
Modified:
   branches/bgarret/ChangeLog
   branches/bgarret/configure.ac
   branches/bgarret/data/Makefile.am
   branches/bgarret/src/HipoMainWindow.cs
   branches/bgarret/src/Makefile.am
   branches/bgarret/src/Tools.cs
   branches/bgarret/src/TracksSource.cs

Modified: branches/bgarret/configure.ac
==============================================================================
--- branches/bgarret/configure.ac       (original)
+++ branches/bgarret/configure.ac       Sun Feb 17 21:29:01 2008
@@ -23,6 +23,7 @@
                glade-sharp-2.0 >= $GTK_SHARP_REQUIRED \
                ipod-sharp >= $IPOD_SHARP_REQUIRED   \
                ipod-sharp-ui >= $IPOD_SHARP_REQUIRED \
+               gconf-sharp-2.0 \
                ndesk-dbus-glib-1.0 >= $NDESK_DBUS_GLIB_REQUIRED)
 
 AC_SUBST(HIPO_LIBS)
@@ -30,6 +31,17 @@
 IPOD_SHARP_FILES=`pkg-config --variable=Libraries ipod-sharp ipod-sharp-ui`
 AC_SUBST(IPOD_SHARP_FILES)
 
+# gconf routines taken from gnome-phone-manager
+
+AC_PATH_PROG(GCONFTOOL, gconftool-2)
+AM_GCONF_SOURCE_2
+
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+
+if test x"$GCONFTOOL" = xno; then
+  AC_MSG_ERROR([gconftool-2 executable not found in your path - should be 
installed with GConf])
+fi
+
 dnl Check for Mono
 AC_PATH_PROG(MCS, gmcs)
 AC_PATH_PROG(MONO, mono)

Modified: branches/bgarret/data/Makefile.am
==============================================================================
--- branches/bgarret/data/Makefile.am   (original)
+++ branches/bgarret/data/Makefile.am   Sun Feb 17 21:29:01 2008
@@ -1,5 +1,10 @@
 hicolordir = $(datadir)/icons/hicolor
 
+schema_in_files = hipo.schemas.in
+schemadir = $(GCONF_SCHEMA_FILE_DIR)
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
[EMAIL PROTECTED]@
+
 tango_icons =                          \
        multimedia-player-ipod-mini-blue.png            \
        multimedia-player-ipod-mini-silver.png          \
@@ -16,7 +21,7 @@
        multimedia-player-ipod-video-black.png          \
        multimedia-player-ipod-video-white.png
 
-install-data-local:
+install-data-local: $(schema_DATA)
        @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/16x16/apps
        $(INSTALL_DATA) $(srcdir)/multimedia-player-ipod-mini-blue.png 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-mini-blue.png
        $(INSTALL_DATA) $(srcdir)/multimedia-player-ipod-mini-silver.png 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-mini-silver.png
@@ -33,6 +38,14 @@
        $(INSTALL_DATA) $(srcdir)/multimedia-player-ipod-video-black.png 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-video-black.png
        $(INSTALL_DATA) $(srcdir)/multimedia-player-ipod-video-white.png 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-video-white.png
 
+if GCONF_SCHEMAS_INSTALL
+       if test -z "$(DESTDIR)" ; then \
+       for p in $^ ; do \
+               GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) 
--makefile-install-rule $$p 2>&1 > /dev/null; \
+       done \
+       fi
+endif
+
 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
 
 install-data-hook:
@@ -60,4 +73,4 @@
        rm -f 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-video-black.png
        rm -f 
$(DESTDIR)$(hicolordir)/16x16/apps/multimedia-player-ipod-video-white.png
 
-EXTRA_DIST = $(tango_icons) hipo-logo.png ipod.gif
+EXTRA_DIST = $(tango_icons) hipo-logo.png ipod.gif $(schema_in_files)

Added: branches/bgarret/data/hipo.schemas.in
==============================================================================
--- (empty file)
+++ branches/bgarret/data/hipo.schemas.in       Sun Feb 17 21:29:01 2008
@@ -0,0 +1,20 @@
+<gconfschemafile>
+    <schemalist>    
+
+      <schema>
+        <key>/schemas/apps/hipo/last_path</key>
+        <applyto>/apps/hipo/last_path</applyto>
+        <owner>hipo</owner>
+        <type>string</type>
+        <default>/</default>
+        <locale name="C">
+          <short>Last path opened</short>
+          <long>
+            This is a string containing the last path used in the filechooser
+          </long>
+        </locale>
+      </schema>
+      
+    </schemalist>
+</gconfschemafile>
+

Modified: branches/bgarret/src/HipoMainWindow.cs
==============================================================================
--- branches/bgarret/src/HipoMainWindow.cs      (original)
+++ branches/bgarret/src/HipoMainWindow.cs      Sun Feb 17 21:29:01 2008
@@ -278,7 +278,8 @@
                        
                        fileChooser.SelectMultiple = true;
                        fileChooser.LocalOnly = true;
-
+                       fileChooser.SetCurrentFolder (Settings.LastPath);
+                       
                        filter.Name = "audio files";
                        filter.AddMimeType ("audio/mpeg");
                        filter.AddMimeType ("audio/x-m4a");
@@ -286,6 +287,7 @@
                        
                        ResponseType res = (ResponseType)fileChooser.Run ();
                        uris = fileChooser.Uris;
+                       Settings.LastPath = fileChooser.CurrentFolder;
                        
                        fileChooser.Destroy ();
                        
@@ -306,9 +308,12 @@
                                                                                
                                                                                
         Stock.Add, ResponseType.Accept);
                        
                        fileChooser.LocalOnly = true;
+                       fileChooser.SetCurrentFolder (Settings.LastPath);
                        
                        ResponseType res = (ResponseType) fileChooser.Run ();
                        uris = fileChooser.Uris;
+                       Settings.LastPath = fileChooser.CurrentFolder;
+                       
                        fileChooser.Destroy ();
                        
                        if (res == ResponseType.Accept)

Modified: branches/bgarret/src/Makefile.am
==============================================================================
--- branches/bgarret/src/Makefile.am    (original)
+++ branches/bgarret/src/Makefile.am    Sun Feb 17 21:29:01 2008
@@ -10,6 +10,7 @@
 HIPO_GENERATED_FILES = Defines.cs
 
 HIPO_SOURCES =                                 \
+       $(srcdir)/Settings.cs                   \
        $(srcdir)/Saviour.cs                    \
        $(srcdir)/Tools.cs                      \
        $(srcdir)/Source.cs                     \
@@ -34,7 +35,7 @@
        $(top_srcdir)/data/hipo-logo.png \
        $(top_srcdir)/data/ipod.gif
 
-HIPO_ASSEMBLIES = -r:Mono.Posix 
-pkg:gtk-sharp-2.0,gnome-sharp-2.0,glade-sharp-2.0,ipod-sharp,ipod-sharp-ui,ndesk-dbus-glib-1.0
 -r:$(top_builddir)/taglib-sharp/taglib-sharp.dll
+HIPO_ASSEMBLIES = -r:Mono.Posix 
-pkg:gtk-sharp-2.0,gnome-sharp-2.0,gconf-sharp-2.0,glade-sharp-2.0,ipod-sharp,ipod-sharp-ui,ndesk-dbus-glib-1.0
        -r:$(top_builddir)/taglib-sharp/taglib-sharp.dll
 
 ASSEMBLY = hipo.exe
 

Added: branches/bgarret/src/Settings.cs
==============================================================================
--- (empty file)
+++ branches/bgarret/src/Settings.cs    Sun Feb 17 21:29:01 2008
@@ -0,0 +1,67 @@
+// Settings.cs
+//
+//  Copyright (C) 2008 Benoit Garret
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+//
+
+namespace Hipo
+{
+       public class Settings
+       {
+               static GConf.Client client = new GConf.Client ();
+
+               public static event GConf.NotifyEventHandler Changed
+               {
+                       add {
+                               client.AddNotify ("/apps/hipo", value);
+                       }
+                       remove{
+                               client.RemoveNotify ("/apps/hipo", value);
+                       }
+               }
+
+               public static string LastPath
+               {
+                       get {
+                               return (string) client.Get 
("/apps/hipo/last_path");
+                       }
+                       set {
+                               client.Set ("/apps/hipo/last_path", value);
+                       }
+               }
+
+               public static event GConf.NotifyEventHandler LastPathChanged
+               {
+                       add {
+                               client.AddNotify ("/apps/hipo/last_path", 
value);
+                       }
+                       remove{
+                               client.RemoveNotify ("/apps/hipo/last_path", 
value);
+                       }
+               }
+       }
+
+       public class SettingKeys
+       {
+               public static string LastPath
+               {
+                       get {
+                                return "/apps/hipo/last_path";
+                       }
+               }
+       }
+}

Modified: branches/bgarret/src/Tools.cs
==============================================================================
--- branches/bgarret/src/Tools.cs       (original)
+++ branches/bgarret/src/Tools.cs       Sun Feb 17 21:29:01 2008
@@ -46,11 +46,6 @@
                        Log (o, level, String.Format (format, args));
                }
                
-               private static void Log (string header, int level, string 
format, params object[] args)
-               {
-                       Log (header, level, String.Format (format, args));
-               }
-               
                private static void Log (string header, int level, string 
message)
                {
                        if (logLevel > 0)

Modified: branches/bgarret/src/TracksSource.cs
==============================================================================
--- branches/bgarret/src/TracksSource.cs        (original)
+++ branches/bgarret/src/TracksSource.cs        Sun Feb 17 21:29:01 2008
@@ -137,7 +137,8 @@
                        {
                                TagLib.File file = TagLib.File.Create (path);
                                
-                               track = tracksDb.CreateTrack ();
+                               lock (tracksDb)
+                                       track = tracksDb.CreateTrack ();
                                
                                if ((file.Tag.FirstArtist == null) || 
(file.Tag.FirstArtist == String.Empty))
                                        track.Artist = "Unknown";
@@ -164,6 +165,8 @@
                                track.TrackNumber = (int) file.Tag.Track;
                                
                                store.AppendValues (track);
+                               
+                               Tools.Log (this, 3, "Added {0}:{1}", track.Id, 
track.Title);
                        }
                        
                        if (save && (track != null))
@@ -238,6 +241,7 @@
                                if (track.Id == t.Id)
                                {
                                        store.Remove (ref iter);
+                                       Tools.Log (this, 3, "Removing track {0} 
from the database", track.Id);
                                        return true;
                                }
                                else
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to