[prev in list] [next in list] [prev in thread] [next in thread] 

List:       klik-devel
Subject:    [klik-devel] [klikclient commit] r960 -
From:       codesite-noreply () google ! com
Date:       2008-01-29 22:55:12
Message-ID: 0016364176f10444e45138902910ef85 () google ! com
[Download RAW message or body]

Author: KillerKiwi2005
Date: Tue Jan 29 14:52:54 2008
New Revision: 960

Modified:
   trunk/client/trunk/klikclient/lib/klik/integration.py

Log:
- changed to use full paths so we dont get file clashs

- still an issue with klikd that calls klik register

Modified: trunk/client/trunk/klikclient/lib/klik/integration.py
==============================================================================
--- trunk/client/trunk/klikclient/lib/klik/integration.py	(original)
+++ trunk/client/trunk/klikclient/lib/klik/integration.py	Tue Jan 29 
14:52:54 2008
@@ -32,7 +32,7 @@
 			# Make sure CMG path is absolute
 			if cmg_path[0] != "/":
 				cmg_path = os.path.abspath(cmg_path)
-			cmg_name = os.path.split( cmg_path )[1]
+			cmg_name = cmg_path #os.path.split( cmg_path )[1] - need to use the 
entire path!
 	
 			print _("Registering %s") % cmg_name
 	
@@ -110,11 +110,12 @@
 		self.base.xdg.desktop_update()

 		# Notification
-		self.notify_event( _("The following menu items have been added") 
+ ":\n\n%s\n\n" +
-				   ngettext("To uninstall remove the file from your application folder",
-					    "To uninstall remove the files from your application folder",
-					    len(applications)) + ".\n",
-				   applications, notify_icon )
+		if len(applications) > 0:
+			self.notify_event( _("The following menu items have been added") 
+ ":\n\n%s\n\n" +
+					   ngettext("To uninstall remove the file from your application folder",
+						    "To uninstall remove the files from your application folder",
+						    len(applications)) + ".\n",
+					   applications, notify_icon )

 	

@@ -139,24 +140,24 @@
 		apps_to_notify = []
 	
 		for cmg_name in cmg_list:
-
-			print _("Unregistering %s") % cmg_name
+			if cmg_name != "" and cmg_name != None:
+				print _("Unregistering %s") % cmg_name
+			
+				# Remove directory if necessary
+				#cmg_name = os.path.split( cmg_name )[1]
+				# Remove extension if necessary
+				#cmg_name = os.path.splitext( cmg_name )[0]
 			
-			# Remove directory if necessary
-			cmg_name = os.path.split( cmg_name )[1]
-			# Remove extension if necessary
-			cmg_name = os.path.splitext( cmg_name )[0]
-	
-			package_id_pre = "cmg-" + urllib.quote_plus( cmg_name )
-	
-			for file in os.listdir( self.base.xdg.get_xdg_apps_path() ):
-				if file.startswith(package_id_pre) and file.endswith(".desktop"):
-					file_name = os.path.splitext( file )[0]
-					self.base.xdg.desktop_uninstall( file, noupdate=True )
-					self.base.xdg.icon_uninstall( file_name, noupdate=True, 
uninstall_all=True )
-					# Rescue name of menu entry
-					app_name = urllib.unquote_plus( 
file_name[file_name.rfind(".cmg-")+5:] )
-					apps_to_notify.append( " - " + app_name )
+				package_id_pre = "cmg-" + urllib.quote_plus( cmg_name )
+
+				for file in os.listdir( self.base.xdg.get_xdg_apps_path() ):
+					if file.startswith(package_id_pre) and file.endswith(".desktop"):
+						file_name = os.path.splitext( file )[0]
+						self.base.xdg.desktop_uninstall( file, noupdate=True )
+						self.base.xdg.icon_uninstall( file_name, noupdate=True, 
uninstall_all=True )
+						# Rescue name of menu entry
+						app_name = urllib.unquote_plus( 
file_name[file_name.rfind(".cmg-")+5:] )
+						apps_to_notify.append( " - " + app_name )
 	
 		self.base.xdg.icon_update()
 		self.base.xdg.desktop_update()
@@ -193,9 +194,17 @@
 		### Unregister packages that left litter in .desktop or icon directories
 	
 		# List of registered packages, in all Applications directories
+		
+		def filter_cmg( path, base ):
+			return self.base.is_valid_cmg(os.path.join( base, path ))
+		
+		
 		registered_apps = set()
 		for dir in apps_dirs:
-			registered_apps.update( filter( self.base.is_valid_cmg, os.listdir( 
dir ) ) )
+			for f in os.listdir( dir ):
+				fpath = os.path.join( dir, f )
+				if  self.base.is_valid_cmg(fpath):
+					registered_apps.add(fpath)

 		def purge_dir(data_dir, registered_apps):
 			# For each file in data_dir, look if there is an associated CMG
@@ -212,18 +221,21 @@
 			for file in os.listdir( data_dir ):
 				if file.startswith("cmg-"):
 					cmg_name = urllib.unquote_plus( file[4:file.find(".cmg")+4] )
-					if cmg_name not in registered_apps:
+			
+					if cmg_name != None and cmg_name != "" and cmg_name not in registered_apps:
 						packages_to_unregister.add( cmg_name )
 			return packages_to_unregister

+
 		packages_to_unregister = set()
-	
+
 		# Orphan .desktop files
  		packages_to_unregister.update( purge_dir( 
self.base.xdg.get_xdg_apps_path(), registered_apps ) )
 		
-		for icon_path in self.base.xdg.get_xdg_icon_paths():
+		# this isnt working with long path names
+		#for icon_path in self.base.xdg.get_xdg_icon_paths():
 			# Orphan icon files
-			packages_to_unregister.update( purge_dir( icon_path, 
registered_apps ) )
+		#	packages_to_unregister.update( purge_dir( icon_path, 
registered_apps ) )

 		if packages_to_unregister:
 			self.unregister( packages_to_unregister )
_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic