[postr] Disable remove photos menu and button if no photos have been added
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [postr] Disable remove photos menu and button if no photos have been added
- Date: Thu, 5 Nov 2009 14:02:28 +0000 (UTC)
commit fea82885c85c1509cdca39c3cff01f2d8267f1a3
Author: David Ignacio <deignacio gmail com>
Date: Thu Nov 5 11:00:08 2009 -0300
Disable remove photos menu and button if no photos have been added
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
src/postr.glade | 2 +-
src/postr.py | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/postr.glade b/src/postr.glade
index 22a5d29..35de277 100644
--- a/src/postr.glade
+++ b/src/postr.glade
@@ -38,7 +38,7 @@
</widget>
</child>
<child>
- <widget class="GtkImageMenuItem" id="remove">
+ <widget class="GtkImageMenuItem" id="remove_menu">
<property name="visible">True</property>
<property name="label" translatable="yes">_Remove Photos</property>
<property name="use_underline">True</property>
diff --git a/src/postr.py b/src/postr.py
index cc8eaf1..ec7aee2 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -80,6 +80,8 @@ class Postr(UniqueApp):
("window",
"upload_menu",
"upload_button",
+ "remove_menu",
+ "remove_button",
"avatar_image",
"statusbar",
"thumbnail_image",
@@ -151,6 +153,9 @@ class Postr(UniqueApp):
# Disable the Upload menu until the user has authenticated
self.update_upload()
+ # We don't have any photos yet, disable remove buttons
+ self.update_remove()
+
# Update the proxy configuration
client = gconf.client_get_default()
client.add_dir("/system/http_proxy", gconf.CLIENT_PRELOAD_RECURSIVE)
@@ -233,6 +238,7 @@ class Postr(UniqueApp):
# We don't care about the arguments, because we just want to know when
# the model was changed, not what was changed.
self.update_upload()
+ self.update_remove()
def auth_open_url(self, state):
"""Callback from midway through Flickr authentication. At this point we
@@ -268,6 +274,11 @@ class Postr(UniqueApp):
self.upload_menu.set_sensitive(connected)
self.upload_button.set_sensitive(connected)
+ def update_remove(self):
+ have_photos = self.model.iter_n_children(None) > 0
+ self.remove_menu.set_sensitive(have_photos)
+ self.remove_button.set_sensitive(have_photos)
+
def update_statusbar(self):
"""Recalculate how much is to be uploaded, and update the status bar."""
size = 0
@@ -456,6 +467,8 @@ class Postr(UniqueApp):
self.upload_menu.set_sensitive(False)
self.upload_button.set_sensitive(False)
+ self.remove_menu.set_sensitive(False)
+ self.remove_button.set_sensitive(False)
self.uploading = True
self.thumbview.set_sensitive(False)
self.progress_dialog.show()
@@ -779,6 +792,7 @@ class Postr(UniqueApp):
self.window.set_title(_("Flickr Uploader"))
self.upload_menu.set_sensitive(True)
self.upload_button.set_sensitive(True)
+ self.update_remove()
self.uploading = False
self.progress_dialog.hide()
self.thumbview.set_sensitive(True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]