alacarte r410 - in trunk: . Alacarte
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: alacarte r410 - in trunk: . Alacarte
- Date: Mon, 19 Jan 2009 15:40:26 +0000 (UTC)
Author: cosimoc
Date: Mon Jan 19 15:40:26 2009
New Revision: 410
URL: http://svn.gnome.org/viewvc/alacarte?rev=410&view=rev
Log:
2009-01-19 Cosimo Cecchi <cosimoc gnome org>
* Alacarte/MainWindow.py:
* configure.ac: port to GIO. Based on a patch from Gian Mario
Tagliaretti (#514574)
Modified:
trunk/Alacarte/MainWindow.py
trunk/ChangeLog
trunk/configure.ac
Modified: trunk/Alacarte/MainWindow.py
==============================================================================
--- trunk/Alacarte/MainWindow.py (original)
+++ trunk/Alacarte/MainWindow.py Mon Jan 19 15:40:26 2009
@@ -16,10 +16,11 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import gtk, gtk.glade, gmenu, gobject, gnomevfs, gnome.ui
+import gtk, gtk.glade, gmenu, gobject, gio, gnome.ui
import cgi, os
import gettext
import subprocess
+import urllib
try:
from Alacarte import config
gettext.bindtextdomain('alacarte',config.localedir)
@@ -535,21 +536,18 @@
else:
path = (len(items) - 1,)
after = items[path][3]
- file_path = gnomevfs.unescape_string(selection.data, '').strip()
+ file_path = urllib.unquote(selection.data).strip()
if not file_path.startswith('file:'):
return
- file_info = gnomevfs.get_file_info(
- file_path, gnomevfs.FILE_INFO_GET_MIME_TYPE|
- gnomevfs.FILE_INFO_FORCE_SLOW_MIME_TYPE|
- gnomevfs.FILE_INFO_FOLLOW_LINKS|gnomevfs.FILE_INFO_DEFAULT
- )
- if file_info.mime_type == 'application/x-desktop':
- handle = gnomevfs.open(file_path)
- data = handle.read(file_info.size)
- open('/tmp/alacarte-dnd.desktop', 'w').write(data)
+ myfile = gio.File(uri=file_path)
+ file_info = myfile.query_info(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
+ content_type = file_info.get_content_type()
+ if content_type == 'application/x-desktop':
+ input_stream = myfile.read()
+ open('/tmp/alacarte-dnd.desktop', 'w').write(input_stream.read())
parser = util.DesktopParser('/tmp/alacarte-dnd.desktop')
self.editor.createItem(parent, parser.get('Icon'), parser.get('Name', self.editor.locale), parser.get('Comment', self.editor.locale), parser.get('Exec'), parser.get('Terminal'), before, after)
- elif file_info.mime_type in ('application/x-shellscript', 'application/x-executable'):
+ elif content_type in ('application/x-shellscript', 'application/x-executable'):
self.editor.createItem(parent, None, os.path.split(file_path)[1].strip(), None, file_path.replace('file://', '').strip(), False, before, after)
self.drag_data = None
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Jan 19 15:40:26 2009
@@ -6,6 +6,7 @@
AM_INIT_AUTOMAKE([1.7])
AM_MAINTAINER_MODE
+m4_define(required_pygobject_version, 2.15.1)
m4_define(required_pygtk_version, 2.8.0)
dnl put the ACLOCAL flags in the makefile
@@ -22,6 +23,20 @@
PKG_CHECK_MODULES(ALACARTE, libgnome-menu >= 2.15)
+dnl Check for correctly installed pygobject
+AC_MSG_CHECKING(for pygobject required_pygobject_version installed for python required_python_abi)
+prog="
+import gobject
+assert gobject.pygobject_version >= tuple(map(int, 'required_pygobject_version'.split('.')))
+"
+
+if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC; then
+ AC_MSG_RESULT(found)
+else
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(required pygobject version not found)
+fi
+
dnl Check for correctly installed pygtk
AC_MSG_CHECKING(for pygtk required_pygtk_version installed for python ${PYTHON_VERSION})
prog="
@@ -29,6 +44,7 @@
import gobject
assert gobject.pygtk_version >= tuple(map(int, 'required_pygtk_version'.split('.')))
"
+
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC; then
AC_MSG_RESULT(found)
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]