Permalink
Browse files

Fixed bugs migrating to gtk-3/gir

  • Loading branch information...
1 parent 16b2e22 commit ee01bad0ce07bb138fc4cae02b2a90621eb3629d @chuchiperriman committed May 10, 2012
Showing with 20 additions and 20 deletions.
  1. +4 −4 src/cloudsn/core/utils.py
  2. +1 −1 src/cloudsn/providers/identicaprovider.py
  3. +15 −15 src/cloudsn/ui/window.py
@@ -14,9 +14,9 @@ def show_url(url):
#from Gtk.gdk import screen_get_default
#from glib import GError
try:
- Gtk.show_uri(Gdk.screen_get_default(), url, Gtk.get_current_event_time())
- except Gtk.Glib.GError, e:
- logger.exception("Error in Gtk.show_uri: %s", e)
+ Gtk.show_uri(Gdk.Screen.get_default(), url, Gtk.get_current_event_time())
+ except:
+ logger.exception("Error in Gtk.show_uri: %s")
def invoke_subprocess(cmdline):
setsid = getattr(os, 'setsid', None)
@@ -75,7 +75,7 @@ def download_image_to_tmp(url):
def download_image_to_pixbuf(url):
path = download_image_to_tmp(url)
- return Gdk.pixbuf_new_from_file(path)
+ return GdkPixbuf.Pixbuf.new_from_file(path)
def execute_command(acc, command):
open_command = replace_variables(acc, command)
@@ -99,7 +99,7 @@ def get_message_icon(self,m):
try:
icon = utils.download_image_to_pixbuf(m.user.profile_image_url)
except Exception, e:
- logger.exception("Error loading the user avatar",e)
+ logger.exception("Error loading the user avatar")
return icon
@@ -6,7 +6,6 @@
from cloudsn.core import config, provider, account, indicator, keyring
from cloudsn import logger
import cloudsn.core.utils as coreutils
-from cloudsn.ui import about, utils
STOP_RESPONSE = 1
@@ -36,12 +35,13 @@ def get_instance():
def get_main_account_selected (self):
selection = self.main_account_tree.get_selection()
- model, paths = selection.get_selected_rows()
- for path in paths:
- citer = self.main_store.get_iter(path)
- account_name = self.main_store.get_value(citer, 1)
- acc = self.am.get_account(account_name)
- return acc, citer
+ if selection:
+ model, paths = selection.get_selected_rows()
+ for path in paths:
+ citer = self.main_store.get_iter(path)
+ account_name = self.main_store.get_value(citer, 1)
+ acc = self.am.get_account(account_name)
+ return acc, citer
return None, None
@@ -204,9 +204,9 @@ def main_delete_button_clicked_cb(self, widget, data=None):
msg = (_('Are you sure you want to delete the account %s?')) % (acc.get_name());
dia = Gtk.MessageDialog(self.window,
- Gtk.DIALOG_MODAL | Gtk.DIALOG_DESTROY_WITH_PARENT,
+ Gtk.DIALOG_MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MESSAGE_QUESTION,
- Gtk.BUTTONS_YES_NO,
+ Gtk.ButtonsType.YES_NO,
msg)
dia.show_all()
if dia.run() == Gtk.RESPONSE_YES:
@@ -299,8 +299,8 @@ def new_action_activate_cb(self, widget, data=None):
except Exception, e:
logger.error ('Error adding a new account: %s', e)
md = Gtk.MessageDialog(self.window,
- Gtk.DIALOG_DESTROY_WITH_PARENT, Gtk.MESSAGE_ERROR,
- Gtk.BUTTONS_CLOSE,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
_('Error adding a new account: ') + str(e))
md.run()
md.destroy()
@@ -352,8 +352,8 @@ def edit_action_activate_cb(self, widget, data=None):
except Exception, e:
logger.exception ('Error editing the account: %s', e)
md = Gtk.MessageDialog(self.window,
- Gtk.DIALOG_DESTROY_WITH_PARENT, Gtk.MESSAGE_ERROR,
- Gtk.BUTTONS_CLOSE,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
_('Error editing the account: ') + str(e))
md.run()
md.destroy()
@@ -380,8 +380,8 @@ def providers_combo_changed_cb(self, widget, data=None):
if provider.get_import_error():
md = Gtk.MessageDialog(self.window,
- Gtk.DIALOG_DESTROY_WITH_PARENT, Gtk.MESSAGE_ERROR,
- Gtk.BUTTONS_CLOSE,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
_('Error loading the provider: ') + str(provider.get_import_error()))
md.run()
md.destroy()

0 comments on commit ee01bad

Please sign in to comment.