[gnome-menus] editor: Fix to work with latest pygi
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-menus] editor: Fix to work with latest pygi
- Date: Wed, 23 Feb 2011 01:55:43 +0000 (UTC)
commit 2966b4886b300a0bba438242fa5f44ac9f16f1c0
Author: Vincent Untz <vuntz gnome org>
Date: Wed Feb 23 02:55:18 2011 +0100
editor: Fix to work with latest pygi
https://bugzilla.gnome.org/show_bug.cgi?id=643019
simple-editor/GMenuSimpleEditor/maindialog.py | 21 +++++++++------------
simple-editor/GMenuSimpleEditor/menufilewriter.py | 21 +++++++++------------
simple-editor/GMenuSimpleEditor/menutreemodel.py | 16 ++++++++--------
3 files changed, 26 insertions(+), 32 deletions(-)
---
diff --git a/simple-editor/GMenuSimpleEditor/maindialog.py b/simple-editor/GMenuSimpleEditor/maindialog.py
index 3c4d47d..d62b4e8 100644
--- a/simple-editor/GMenuSimpleEditor/maindialog.py
+++ b/simple-editor/GMenuSimpleEditor/maindialog.py
@@ -58,15 +58,15 @@ class MenuEditorDialog:
def __revert_to_system_default (self, parent_iter = None):
model = self.menu_tree_model
- (has_iter, iter) = model.iter_children (parent_iter)
- while has_iter:
+ iter = model.iter_children (parent_iter)
+ while iter is not None:
if model.get_value (iter, model.COLUMN_IS_ENTRY):
visible = model.get_value (iter, model.COLUMN_SYSTEM_VISIBLE)
model.set_value (iter, model.COLUMN_USER_VISIBLE, visible)
else:
self.__revert_to_system_default (iter)
- has_iter = model.iter_next (iter)
+ iter = model.iter_next (iter)
def __dialog_destroyed (self, dialog):
Gtk.main_quit ()
@@ -74,10 +74,10 @@ class MenuEditorDialog:
def __dialog_response (self, dialog, response_id):
if response_id == Gtk.ResponseType.REJECT:
self.__revert_to_system_default ()
- (has_iter, iter) = self.menu_tree_model.get_iter_first ()
- while has_iter:
+ iter = self.menu_tree_model.get_iter_first ()
+ while iter is not None:
self.menu_file_writer.queue_sync (iter)
- has_iter = self.menu_tree_model.iter_next (iter)
+ iter = self.menu_tree_model.iter_next (iter)
return
dialog.destroy ()
@@ -140,18 +140,15 @@ class MenuEditorDialog:
real_path = Gtk.TreePath.new_from_string (path)
child_path = self.entries_model.convert_path_to_child_path (real_path)
- (has_iter, child_iter) = self.menu_tree_model.get_iter (child_path)
+ child_iter = self.menu_tree_model.get_iter (child_path)
- if not has_iter:
- return
-
toggle_value (self.menu_tree_model, child_iter, self.menu_tree_model.COLUMN_USER_VISIBLE)
self.menu_file_writer.queue_sync (child_iter)
def __menus_selection_changed (self, selection):
- (is_selected, model, iter) = selection.get_selected ()
- if not is_selected:
+ (model, iter) = selection.get_selected ()
+ if iter is None:
self.entries_list.set_model (None)
return
diff --git a/simple-editor/GMenuSimpleEditor/menufilewriter.py b/simple-editor/GMenuSimpleEditor/menufilewriter.py
index 5f8ee75..c31fade 100644
--- a/simple-editor/GMenuSimpleEditor/menufilewriter.py
+++ b/simple-editor/GMenuSimpleEditor/menufilewriter.py
@@ -101,8 +101,8 @@ class MenuFileWriter:
includes = []
excludes = []
- (has_iter, child_iter) = self.model.iter_children (iter)
- while has_iter:
+ child_iter = self.model.iter_children (iter)
+ while child_iter is not None:
if self.model.get_value (child_iter, self.model.COLUMN_IS_ENTRY):
desktop_file_id = self.model.get_value (child_iter, self.model.COLUMN_ID)
system_visible = self.model.get_value (child_iter, self.model.COLUMN_SYSTEM_VISIBLE)
@@ -113,7 +113,7 @@ class MenuFileWriter:
elif system_visible and not user_visible:
excludes.append (desktop_file_id)
- has_iter = self.model.iter_next (child_iter)
+ child_iter = self.model.iter_next (child_iter)
if len (includes) > 0:
contents += indent + " <Include>\n"
@@ -129,8 +129,8 @@ class MenuFileWriter:
contents += indent + " </Exclude>\n"
has_changes = True
- (has_iter, child_iter) = self.model.iter_children (iter)
- while has_iter:
+ child_iter = self.model.iter_children (iter)
+ while child_iter is not None:
if not self.model.get_value (child_iter, self.model.COLUMN_IS_ENTRY):
(contents, subdir_has_changes) = self.__append_menu (contents,
indent + " ",
@@ -138,7 +138,7 @@ class MenuFileWriter:
if not has_changes:
has_changes = subdir_has_changes
- has_iter = self.model.iter_next (child_iter)
+ child_iter = self.model.iter_next (child_iter)
if has_changes:
return (contents + indent + "</Menu>\n", True)
@@ -167,10 +167,7 @@ class MenuFileWriter:
del self.sync_idle_handlers[path]
real_path = Gtk.TreePath.new_from_string (path)
- (has_iter, iter) = self.model.get_iter(real_path)
-
- if not has_iter:
- return False
+ iter = self.model.get_iter(real_path)
self.sync (iter)
return False
@@ -180,8 +177,8 @@ class MenuFileWriter:
if model.get_value (iter, model.COLUMN_MENU_FILE):
return iter
- (has_iter, parent_iter) = model.iter_parent (iter)
- if not has_iter:
+ parent_iter = model.iter_parent (iter)
+ if parent_iter is None:
return None
return find_menu_file_parent (model, parent_iter)
diff --git a/simple-editor/GMenuSimpleEditor/menutreemodel.py b/simple-editor/GMenuSimpleEditor/menutreemodel.py
index a067ea9..1541f2c 100644
--- a/simple-editor/GMenuSimpleEditor/menutreemodel.py
+++ b/simple-editor/GMenuSimpleEditor/menutreemodel.py
@@ -125,13 +125,13 @@ class MenuTreeModel (Gtk.TreeStore):
if not directory:
return
- (has_iter, iter) = self.iter_children (parent_iter)
- while has_iter:
+ iter = self.iter_children (parent_iter)
+ while iter is not None:
if self.get_value(iter, self.COLUMN_ID) == directory.menu_id:
break
- has_iter = self.iter_next (iter)
+ iter = self.iter_next (iter)
- if not has_iter:
+ if iter is None:
row = (False, directory.menu_id, directory.name, load_icon (self.icon_theme, directory.icon), menu_file, False, False)
iter = self.append (parent_iter, row)
@@ -147,15 +147,15 @@ class MenuTreeModel (Gtk.TreeStore):
if not isinstance (child_item, gmenu.Entry):
continue
- (has_iter, child_iter) = self.iter_children (iter)
- while has_iter:
+ child_iter = self.iter_children (iter)
+ while child_iter is not None:
if child_item.type == gmenu.TYPE_ENTRY and \
self.get_value(child_iter, self.COLUMN_IS_ENTRY) and \
self.get_value(child_iter, self.COLUMN_ID) == child_item.desktop_file_id:
break
- has_iter = self.iter_next (child_iter)
+ child_iter = self.iter_next (child_iter)
- if not has_iter:
+ if child_iter is None:
row = (True, child_item.desktop_file_id, child_item.display_name, load_icon (self.icon_theme, child_item.icon), None, False, False)
child_iter = self.append (iter, row)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]