[alacarte] Fix crash TypeError: Expected Gtk.TreePath, but got StructMeta
- From: Olav Vitters <ovitters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte] Fix crash TypeError: Expected Gtk.TreePath, but got StructMeta
- Date: Tue, 23 Aug 2011 22:09:36 +0000 (UTC)
commit 1629b3bdab555d3c71cf716536171de2c7e2e1c8
Author: Olav Vitters <olav vitters nl>
Date: Wed Aug 24 00:08:39 2011 +0200
Fix crash TypeError: Expected Gtk.TreePath, but got StructMeta
Gobject introspection doesn't allow comparison between a treepath and a
string. So avoid doing that.
Alacarte/MainWindow.py | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index ba6bdae..45711af 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+# vim: set noexpandtab:
# Alacarte Menu Editor - Simple fd.o Compliant Menu Editor
# Copyright (C) 2006 Travis Watkins
#
@@ -16,8 +17,6 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-## see line 180 and 217 - dnd wont work
-##
from gi.repository import Gtk, GObject, Gio, GdkPixbuf, Gdk
import gmenu
import cgi, os
@@ -90,18 +89,17 @@ class MainWindow:
item_tree = self.tree.get_object('item_tree')
items, iter = item_tree.get_selection().get_selected()
update_items = False
+ update_type = None
item_id, separator_path = None, None
if iter:
update_items = True
+ update_type = items[iter][3].get_type()
+ if items[iter][3].get_type() == gmenu.TYPE_ENTRY:
+ item_id = items[iter][3].get_desktop_file_id()
if items[iter][3].get_type() == gmenu.TYPE_DIRECTORY:
item_id = os.path.split(items[iter][3].get_desktop_file_path())[1]
- update_items = True
- elif items[iter][3].get_type() == gmenu.TYPE_ENTRY:
- item_id = items[iter][3].get_desktop_file_id()
- update_items = True
elif items[iter][3].get_type() == gmenu.TYPE_SEPARATOR:
item_id = items.get_path(iter)
- update_items = True
menus, iter = menu_tree.get_selection().get_selected()
update_menus = False
menu_id = None
@@ -123,11 +121,12 @@ class MainWindow:
i = 0
for item in item_tree.get_model():
found = False
- if item[3].get_type() == gmenu.TYPE_ENTRY and item[3].get_desktop_file_id() == item_id:
- found = True
- if item[3].get_type() == gmenu.TYPE_DIRECTORY and item[3].get_desktop_file_path():
- if os.path.split(item[3].get_desktop_file_path())[1] == item_id:
+ if update_type != gmenu.TYPE_SEPARATOR:
+ if item[3].get_type() == gmenu.TYPE_ENTRY and item[3].get_desktop_file_id() == item_id:
found = True
+ if item[3].get_type() == gmenu.TYPE_DIRECTORY and item[3].get_desktop_file_path() and update_type == gmenu.TYPE_DIRECTORY:
+ if os.path.split(item[3].get_desktop_file_path())[1] == item_id:
+ found = True
if item[3].get_type() == gmenu.TYPE_SEPARATOR:
if not isinstance(item_id, tuple):
#we may not skip the increment via "continue"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]