conduit r1846 - in trunk: . conduit conduit/gtkui data po



Author: jstowers
Date: Fri Jan 30 02:20:56 2009
New Revision: 1846
URL: http://svn.gnome.org/viewvc/conduit?rev=1846&view=rev

Log:
2009-01-30  John Stowers  <john stowers gmail com>

	* data/conduit-autostart.desktop.in.in: deleted

	* NEWS:
	* conduit/__init__.py:
	* conduit/defs.py.in:
	* conduit/gtkui/UI.py:
	* configure.ac:
	* data/Makefile.am: Manage our own autostart
	capability by copying the conduit desktop file
	the the user autostart directory.

	* data/conduit.glade: Add an option
	in the UI to reflect this.



Removed:
   trunk/data/conduit-autostart.desktop.in.in
Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/conduit/__init__.py
   trunk/conduit/defs.py.in
   trunk/conduit/gtkui/UI.py
   trunk/configure.ac
   trunk/data/Makefile.am
   trunk/data/conduit.glade
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/po/POTFILES.skip

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Fri Jan 30 02:20:56 2009
@@ -4,6 +4,8 @@
 * Support Google Bookmarks
 * Support Nautilus Bookmarks
 * Add dataprovider for changing desktop wallpaper
+* Autostart capability can now be controlled from 
+  the preferences UI
 
 NEW in 0.3.15:
 ==============

Modified: trunk/conduit/__init__.py
==============================================================================
--- trunk/conduit/__init__.py	(original)
+++ trunk/conduit/__init__.py	Fri Jan 30 02:20:56 2009
@@ -32,15 +32,13 @@
 IS_INSTALLED = not os.path.exists(os.path.join(DIRECTORY,"ChangeLog"))
 IS_DEVELOPMENT_VERSION = True
 
-# Check the profile directory to prevent crashes when saving settings, etc
-USER_DIR = os.path.join(
-                os.environ.get(
-                    "XDG_CONFIG_HOME",
-    			    os.path.join(os.environ['HOME'], ".config")),
-    			"conduit"
-    			)
-if not os.path.exists(USER_DIR):
-    os.makedirs(USER_DIR)
+#test the existance of some compulsory directories
+CONFIG_DIR = os.environ.get("XDG_CONFIG_HOME", os.path.join(os.environ['HOME'], ".config"))
+AUTOSTART_FILE_DIR = os.path.join(CONFIG_DIR,	"autostart")
+USER_DIR = os.path.join(CONFIG_DIR,	"conduit")
+for d in (AUTOSTART_FILE_DIR, USER_DIR):
+    if not os.path.exists(d):
+        os.makedirs(d)
 
 if IS_INSTALLED:
     from defs import *
@@ -50,8 +48,8 @@
     VERSION =                   "0.3.16"
     LOCALE_DIR =                os.path.join(DIRECTORY, "po")
     SHARED_DATA_DIR =           os.path.join(DIRECTORY, "data")
-    GLADE_FILE =                os.path.join(DIRECTORY, "data","conduit.glade")
     SHARED_MODULE_DIR =         os.path.join(DIRECTORY, "conduit", "modules")
+    DESKTOP_FILE_DIR =          os.path.join(DIRECTORY, "data")
                                 #{GnomeVfs, GIO, Python}
     FILE_IMPL =                 os.environ.get("CONDUIT_FILE_IMPL","GIO")
                                 #{gtkmozembed, webkit, system}

Modified: trunk/conduit/defs.py.in
==============================================================================
--- trunk/conduit/defs.py.in	(original)
+++ trunk/conduit/defs.py.in	Fri Jan 30 02:20:56 2009
@@ -5,6 +5,7 @@
 LOCALE_DIR = "@LOCALEDIR@"
 SHARED_DATA_DIR = "@PKGDATADIR@"
 SHARED_MODULE_DIR = "@MODULEDIR@"
+DESKTOP_FILE_DIR = "@DESKTOPFILEDIR@"
 
 #
 # Platform specific implementations

Modified: trunk/conduit/gtkui/UI.py
==============================================================================
--- trunk/conduit/gtkui/UI.py	(original)
+++ trunk/conduit/gtkui/UI.py	Fri Jan 30 02:20:56 2009
@@ -280,6 +280,43 @@
             conduit.GLOBALS.mappingDB.delete()
             treeview.set_model(sqliteListStore)
 
+        def is_start_at_login_enabled():
+            autostartFile = os.path.join(conduit.AUTOSTART_FILE_DIR, "conduit.desktop")
+            if os.path.exists(autostartFile):
+                #if it contains X-GNOME-Autostart-enabled=false then it has
+                #has been disabled by the user in the session applet, otherwise
+                #it is enabled
+                return open(autostartFile).read().find("X-GNOME-Autostart-enabled=false") == -1
+            else:
+                return False
+
+        def update_start_at_login(update):
+            autostartFile = os.path.join(conduit.AUTOSTART_FILE_DIR, "conduit.desktop")
+            desktopFile = os.path.join(conduit.DESKTOP_FILE_DIR, "conduit.desktop")
+
+            if os.path.exists(autostartFile):
+                log.info("Removing autostart desktop file")
+                os.remove(autostartFile)
+
+
+
+            if update and os.path.exists(desktopFile):
+                log.info("Adding autostart desktop file")
+                #copy the original file to the new file, but 
+                #add -i to the exec line (start iconified)
+                old = open(desktopFile, "r")
+                new = open(autostartFile, "w")
+
+                for l in old.readlines():         
+                    if l.startswith("Exec="):
+                        new.write(l[0:-1])
+                        new.write(" -i\n")
+                    else:
+                        new.write(l)
+
+                old.close()
+                new.close()
+               
         #Build some liststores to display
         CONVERT_FROM_MESSAGE = _("Convert from")
         CONVERT_INTO_MESSAGE = _("into")
@@ -362,6 +399,13 @@
         show_hints_check = tree.get_widget("show_hints_check")
         show_hints_check.set_active(conduit.GLOBALS.settings.get("gui_show_hints"))
 
+        #special case start at login. Because we copy the desktop file from the
+        #system to ~/.config/autostart, we require conduit to be installed
+        start_at_login_check = tree.get_widget("start_at_login")
+        if conduit.IS_INSTALLED:
+            start_at_login_check.set_active(is_start_at_login_enabled())
+        else:
+            start_at_login_check.set_sensitive(False)
 
         #restore the current policy
         for policyName in Conduit.CONFLICT_POLICY_NAMES:
@@ -396,6 +440,7 @@
             conduit.GLOBALS.settings.set("show_status_icon", status_icon_check.get_active())
             conduit.GLOBALS.settings.set("gui_minimize_to_tray", minimize_to_tray_check.get_active())
             conduit.GLOBALS.settings.set("gui_show_hints", show_hints_check.get_active())
+            update_start_at_login(start_at_login_check.get_active())
             #save the current policy
             for policyName in Conduit.CONFLICT_POLICY_NAMES:
                 for policyValue in Conduit.CONFLICT_POLICY_VALUES:

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Fri Jan 30 02:20:56 2009
@@ -120,7 +120,9 @@
 AS_AC_EXPAND(LIBDIR, $libdir)
 AS_AC_EXPAND(LOCALEDIR, $datarootdir/locale)
 AS_AC_EXPAND(PKGDATADIR, $datarootdir/$PACKAGE)
+AS_AC_EXPAND(DATADIR, $datarootdir/$PACKAGE)
 AS_AC_EXPAND(MODULEDIR, $libdir/$PACKAGE/modules)
+AS_AC_EXPAND(DESKTOPFILEDIR, $datadir/applications)
 
 ################################################################################
 #-------------------------------------------------------------------------------
@@ -178,7 +180,6 @@
 conduit/modules/Firefox3Module/Makefile
 data/Makefile
 data/conduit.desktop.in
-data/conduit-autostart.desktop.in
 data/conduit.pc
 data/icons/Makefile
 data/icons/hicolor/Makefile

Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am	(original)
+++ trunk/data/Makefile.am	Fri Jan 30 02:20:56 2009
@@ -53,16 +53,12 @@
 conduitbindir = $(libdir)/conduit
 
 ################################################################################
-# Desktop and autostart file
+# Desktop file
 ################################################################################
 desktopdir = $(datadir)/applications
 desktop_in_files = conduit.desktop.in 
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
-autostartdir = $(datadir)/gnome/autostart
-autostart_in_files = conduit-autostart.desktop.in
-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
-
 @INTLTOOL_DESKTOP_RULE@
 
 ################################################################################
@@ -87,15 +83,13 @@
 
 DISTCLEANFILES = \
 	$(pkgconfig_DATA) \
-	$(desktop_DATA) \
-	$(autostart_DATA)
+	$(desktop_DATA)
 
 EXTRA_DIST = \
 	$(resources_DATA) \
 	$(pkgconfig_in_files) \
 	$(dbusservice_in_files) \
 	conduit.desktop.in.in \
-	conduit-autostart.desktop.in.in \
 	COPYING
 	
 CLEANFILES = conduit.desktop org.conduit.service

Modified: trunk/data/conduit.glade
==============================================================================
--- trunk/data/conduit.glade	(original)
+++ trunk/data/conduit.glade	Fri Jan 30 02:20:56 2009
@@ -750,6 +750,15 @@
                             <property name="visible">True</property>
                             <property name="spacing">5</property>
                             <child>
+                              <widget class="GtkCheckButton" id="start_at_login">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label" translatable="yes">Start Conduit at login</property>
+                                <property name="response_id">0</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                            </child>
+                            <child>
                               <widget class="GtkCheckButton" id="save_settings_check">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
@@ -761,6 +770,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
@@ -775,7 +785,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
-                                <property name="position">1</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                             <child>
@@ -790,7 +800,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
-                                <property name="position">2</property>
+                                <property name="position">3</property>
                               </packing>
                             </child>
                             <child>
@@ -802,7 +812,7 @@
                                 <property name="draw_indicator">True</property>
                               </widget>
                               <packing>
-                                <property name="position">3</property>
+                                <property name="position">4</property>
                               </packing>
                             </child>
                           </widget>

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Fri Jan 30 02:20:56 2009
@@ -1,6 +1,5 @@
 [encoding: UTF-8]
 data/conduit.desktop.in.in
-data/conduit-autostart.desktop.in.in
 data/conduit.glade
 conduit/gtkui/Canvas.py
 conduit/gtkui/ConflictResolver.py

Modified: trunk/po/POTFILES.skip
==============================================================================
--- trunk/po/POTFILES.skip	(original)
+++ trunk/po/POTFILES.skip	Fri Jan 30 02:20:56 2009
@@ -1,5 +1,4 @@
 conduit/Main.py
-data/conduit-autostart.desktop.in
 data/conduit.desktop.in
 tools/eog-plugin/config.glade
 tools/totem-plugin/conduit.py



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