def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring tencent accounts"""
    gtk.VBox.__init__( self, False, 20 )
    self.ui = gtk.Builder()
    self.ui.set_translation_domain ("gwibber")
    self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-tencent.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False)
    self.show_all()
    self.ui.get_object("hbox_tencent_pin").hide()

    self.account = account or {}
    self.dialog = dialog
    has_secret_key = True
    if self.account.has_key("id"):
      try:
        value = gnomekeyring.find_items_sync(gnomekeyring.ITEM_GENERIC_SECRET, {"id": str("%s/%s" % (self.account["id"], "secret_token"))})[0].secret
      except gnomekeyring.NoMatchError:
        has_secret_key = False

    try:
      if self.account.has_key("access_token") and self.account.has_key("secret_token") and self.account.has_key("username") and has_secret_key and not self.dialog.condition:
        self.ui.get_object("hbox_tencent_auth").hide()
        self.ui.get_object("tencent_auth_done_label").set_label(_("%s has been authorized by Tencent") % self.account["username"])
        self.ui.get_object("hbox_tencent_auth_done").show()
      else:
        self.ui.get_object("hbox_tencent_auth_done").hide()
        if self.dialog.ui:
          self.dialog.ui.get_object('vbox_create').hide()
    except:
      self.ui.get_object("hbox_tencent_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object("vbox_create").hide()
Example #2
0
  def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring identi.ca accounts"""
    gtk.VBox.__init__( self, False, 20 )
    self.ui = gtk.Builder()
    self.ui.set_translation_domain ("gwibber")
    self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-identica.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False)
    self.show_all()

    self.account = account or {}
    self.dialog = dialog
    self.url_prefix = "https://identi.ca"
    has_secret_key = True
    if self.account.has_key("id"):
      try:
        value = gnomekeyring.find_items_sync(gnomekeyring.ITEM_GENERIC_SECRET, {"id": str("%s/%s" % (self.account["id"], "secret_token"))})[0].secret
      except gnomekeyring.NoMatchError:
        has_secret_key = False

    try:
      if self.account.has_key("access_token") and self.account.has_key("secret_token") and self.account.has_key("username") and has_secret_key:
        self.ui.get_object("hbox_statusnet_auth").hide()
        self.ui.get_object("statusnet_auth_done_label").set_label(_("%s has been authorized by %s") % (self.account["username"]))
        self.ui.get_object("hbox_statusnet_auth_done").show()
      else:
        self.ui.get_object("hbox_statusnet_auth_done").hide()
        if self.dialog.ui:
          self.dialog.ui.get_object('vbox_create').hide()
    except:
      self.ui.get_object("hbox_statusnet_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object("vbox_create").hide()
Example #3
0
  def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring facebook accounts"""
    Gtk.VBox.__init__( self, False, 20 )
    self.ui = Gtk.Builder()
    self.ui.set_translation_domain ("gwibber")
    self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-facebook.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False, 0)
    self.show_all()
    if account:
      self.account = account
    else:
      self.account = {}
    self.dialog = dialog
    self.window = dialog.dialog
    has_access_token = False
    if self.account.has_key("id"):
        has_secret_key = get_from_keyring(self.account['id'],
                                          'secret_token') is not None

    try:
      if self.account["access_token"] and self.account["username"] and has_access_token and not self.dialog.condition:
        self.ui.get_object("hbox_facebook_auth").hide()
        self.ui.get_object("fb_auth_done_label").set_label(_("%s has been authorized by Facebook") % str(self.account["username"]))
        self.ui.get_object("hbox_facebook_auth_done").show()
      else:
        self.ui.get_object("hbox_facebook_auth_done").hide()
        if self.dialog.ui:
          self.dialog.ui.get_object('vbox_create').hide()
    except:
      self.ui.get_object("hbox_facebook_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object("vbox_create").hide()
Example #4
0
  def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring identi.ca accounts"""
    Gtk.VBox.__init__( self, False, 20 )
    self.ui = Gtk.Builder()
    self.ui.set_translation_domain ("gwibber")
    self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-identica.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False, 0)
    self.show_all()

    self.account = account or {}
    self.dialog = dialog
    self.window = dialog.dialog
    self.url_prefix = "https://identi.ca"
    has_secret_key = False
    if self.account.has_key("id") and self.account.has_key("access_token") \
      and self.account.has_key("secret_token") and self.account.has_key("username"):
      if self.account["secret_token"] and self.account["access_token"]:
        has_secret_key = get_from_keyring(self.account['id'],
                                          'secret_token') is not None

    try:
      if has_secret_key:
        self.ui.get_object("hbox_statusnet_auth").hide()
        self.ui.get_object("statusnet_auth_done_label").set_label(_("%s has been authorized by %s") % (self.account["username"]))
        self.ui.get_object("hbox_statusnet_auth_done").show()
      else:
        self.ui.get_object("hbox_statusnet_auth_done").hide()
        if self.dialog.ui:
          self.dialog.ui.get_object('vbox_create').hide()
    except:
      self.ui.get_object("hbox_statusnet_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object("vbox_create").hide()
Example #5
0
  def action(self, w, client, msg):
    client.service.PerformOp(json.dumps({
      "account": msg["account"],
      "operation": "delete",
      "args": {"message": msg},
      "transient": False,
    }))

    image = resources.get_ui_asset("gwibber.svg")
    expire_timeout = 5000
    n = gwibber.microblog.util.notify(_("Deleted"), _("The message has been deleted."), image, expire_timeout)
 def __init__(self, account=None, dialog=None):
   """Creates the account pane for configuring pingfm accounts"""
   gtk.VBox.__init__( self, False, 20 )
   self.ui = gtk.Builder()
   self.ui.set_translation_domain ("gwibber")
   self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-pingfm.ui"))
   self.ui.connect_signals(self)
   self.vbox_settings = self.ui.get_object("vbox_settings")
   self.pack_start(self.vbox_settings, False, False)
   self.show_all()
   if dialog.ui:
     dialog.ui.get_object("vbox_create").show()
Example #7
0
 def __init__(self, account=None, dialog=None):
     """Creates the account pane for configuring digg accounts"""
     gtk.VBox.__init__(self, False, 20)
     self.ui = gtk.Builder()
     self.ui.set_translation_domain("gwibber")
     self.ui.add_from_file(
         resources.get_ui_asset("gwibber-accounts-digg.ui"))
     self.ui.connect_signals(self)
     self.vbox_settings = self.ui.get_object("vbox_settings")
     self.pack_start(self.vbox_settings, False, False)
     self.show_all()
     if dialog.ui:
         dialog.ui.get_object("vbox_create").show()
Example #8
0
    def action(self, w, client, msg):
        client.service.PerformOp(
            json.dumps({
                "account": msg["account"],
                "operation": "delete",
                "args": {
                    "message": msg
                },
                "transient": False,
            }))

        image = resources.get_ui_asset("gwibber.svg")
        expire_timeout = 5000
        n = gwibber.microblog.util.notify(_("Deleted"),
                                          _("The message has been deleted."),
                                          image, expire_timeout)
Example #9
0
 def __init__(self, account=None, dialog=None):
     """Creates the account pane for configuring facebook accounts"""
     gtk.VBox.__init__(self, False, 20)
     self.ui = gtk.Builder()
     self.ui.set_translation_domain("gwibber")
     self.ui.add_from_file(
         resources.get_ui_asset("gwibber-accounts-facebook.ui"))
     self.ui.connect_signals(self)
     self.vbox_settings = self.ui.get_object("vbox_settings")
     self.pack_start(self.vbox_settings, False, False)
     self.show_all()
     if account:
         self.account = account
     else:
         self.account = {}
     self.dialog = dialog
     has_access_token = True
     if self.account.has_key("id"):
         try:
             value = gnomekeyring.find_items_sync(
                 gnomekeyring.ITEM_GENERIC_SECRET, {
                     "id": str("%s/%s" %
                               (self.account["id"], "access_token"))
                 })[0].secret
         except gnomekeyring.NoMatchError:
             has_access_token = False
     try:
         if self.account["access_token"] and self.account[
                 "username"] and has_access_token and not self.dialog.condition:
             self.ui.get_object("hbox_facebook_auth").hide()
             self.ui.get_object("fb_auth_done_label").set_label(
                 _("%s has been authorized by Facebook") %
                 str(self.account["username"]))
             self.ui.get_object("hbox_facebook_auth_done").show()
         else:
             self.ui.get_object("hbox_facebook_auth_done").hide()
             if self.dialog.ui:
                 self.dialog.ui.get_object('vbox_create').hide()
     except:
         self.ui.get_object("hbox_facebook_auth_done").hide()
         if self.dialog.ui:
             self.dialog.ui.get_object("vbox_create").hide()
Example #10
0
  def __init__(self, selected_account=None, condition=None, message=None):
    self.icon_theme = Gtk.IconTheme.get_default ()
    self.icon_theme.prepend_search_path ("/usr/share/gwibber/ui/icons/")
    if os.path.exists(os.path.join("data", "icons")):
      self.icon_theme.prepend_search_path (os.path.realpath(os.path.join("data", "icons")))

    self.selected_account = []
    if selected_account:
      self.selected_account = selected_account.split(",")
    self.condition = condition
    self.message = message
    self.gwibber = GwibberPublic()
    self.services = json.loads(self.gwibber.GetServices())
    self.ui = Gtk.Builder()
    self.ui.set_translation_domain("gwibber")
    self.ui.add_from_file(resources.get_ui_asset("gwibber-accounts-dialog.ui"))
    self.ui.connect_signals(self)

    self.dialog = self.ui.get_object("accounts_dialog")
    self.dialog.resize(640,400)
    self.dialog.set_icon_name("gwibber")
    self.dialog.set_wmclass("gwibber", "Gwibber")
    self.dialog.show_all()
    if hasattr(Gtk, "InfoBar"):
      self.alignment_infobar = self.ui.get_object("alignment_infobar")
      self.infobar = Gtk.InfoBar()
      self.alignment_infobar.add(self.infobar)
      self.infobar.hide()

    # Hide the help button until we have help :)
    button_help = self.ui.get_object("button_help")
    button_help.hide()

    # This should check for configured accounts, and if there are any hide this
    self.ui.get_object('frame_new_account').hide()
    self.ui.get_object('vbox_save').hide()
    self.ui.get_object('vbox_create').hide()
    
    self.setup_account_tree()
    self.populate_account_tree()
Example #11
0
    def __init__(self, account=None, dialog=None):
        """Creates the account pane for configuring Twitter accounts"""
        Gtk.VBox.__init__(self, False, 20)
        self.ui = Gtk.Builder()
        self.ui.set_translation_domain("gwibber")
        self.ui.add_from_file(resources.get_ui_asset("gwibber-accounts-twitter.ui"))
        self.ui.connect_signals(self)
        self.vbox_settings = self.ui.get_object("vbox_settings")
        self.pack_start(self.vbox_settings, True, True, 0)
        self.show_all()

        self.account = account or {}
        self.dialog = dialog
        self.window = dialog.dialog
        has_secret_key = False
        if self.account.has_key("id"):
            has_secret_key = get_from_keyring(self.account["id"], "secret_token") is not None

        try:
            if (
                self.account.has_key("access_token")
                and self.account.has_key("secret_token")
                and self.account.has_key("username")
                and has_secret_key
                and not self.dialog.condition
            ):
                self.ui.get_object("hbox_twitter_auth").hide()
                self.ui.get_object("twitter_auth_done_label").set_label(
                    _("%s has been authorized by Twitter") % self.account["username"]
                )
                self.ui.get_object("hbox_twitter_auth_done").show()
            else:
                self.ui.get_object("hbox_twitter_auth_done").hide()
                if self.dialog.ui:
                    self.dialog.ui.get_object("vbox_create").hide()
        except:
            self.ui.get_object("hbox_twitter_auth_done").hide()
            if self.dialog.ui:
                self.dialog.ui.get_object("vbox_create").hide()
Example #12
0
  def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring Buzz accounts"""
    gtk.VBox.__init__( self, False, 20 )
    self.ui = gtk.Builder()
    self.ui.set_translation_domain ("gwibber")
    self.ui.add_from_file (resources.get_ui_asset("gwibber-accounts-buzz.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False)
    self.show_all()

    self.account = account or {}
    self.dialog = dialog

    if self.account.get("access_token", 0) and self.account.get("username", 0):
      self.ui.get_object("hbox_buzz_auth").hide()
      self.ui.get_object("fb_auth_done_label").set_label(_("%s has been authorized by Buzz") % self.account["username"])
      self.ui.get_object("hbox_buzz_auth_done").show()
    else:
      self.ui.get_object("hbox_buzz_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object('vbox_create').hide()
Example #13
0
  def populate(self):
    self.account_list = []
    for account in json.loads(self.accounts.List()):
      if self.services.has_key(account["service"]) and "send" in self.services[account["service"]]["features"]:
        self.account_list.append(account)

    for account in self.account_list:
      img = Gtk.Image ()
      img.set_from_file(resources.get_ui_asset("icons/breakdance/16x16/" + account["service"] + ".png"))
      img.show();
      but = Gtk.ToggleButton ()
      but.set_active (account["send_enabled"])
      if not account["send_enabled"]:
        but.set_tooltip_text (account["service"] + "(" + account["username"] + ") - " + _("Disabled"))
      else:
        but.set_tooltip_text (account["service"] + "(" + account["username"] + ")")
      but.set_image(img);
      but.connect("clicked", self.on_account_toggled, account["id"])
      self.targetbar.pack_start(but, False, False, 0)
      but.show_all ()
      but.set_focus_on_click(False)
      self.buttons[account["id"]] = but
  def __init__(self, account=None, dialog=None):
    """Creates the account pane for configuring Google+ accounts"""
    gtk.VBox.__init__(self, False, 20)
    self.ui = gtk.Builder()
    self.ui.set_translation_domain("gwibber")
    self.ui.add_from_file(resources.get_ui_asset("gwibber-accounts-googleplus.ui"))
    self.ui.connect_signals(self)
    self.vbox_settings = self.ui.get_object("vbox_settings")
    self.pack_start(self.vbox_settings, False, False)
    self.show_all()

    self.account = account or {}
    self.dialog = dialog

    if self.account.get("access_token", 0) and self.account.get("username", 0):
      self.ui.get_object("hbox_googleplus_auth").hide()
      self.ui.get_object("googleplus_auth_done_label"). \
              set_label(_("%s has been authorized by Google+") %
                        self.account["username"])
      self.ui.get_object("hbox_googleplus_auth_done").show()
    else:
      self.ui.get_object("hbox_googleplus_auth_done").hide()
      if self.dialog.ui:
        self.dialog.ui.get_object('vbox_create').hide()