def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)
 
    # Monitor the connection
    self.connection_monitor = util.getbus("Connection")
    self.connection_monitor.connect_to_signal("ConnectionOnline", self.on_connection_online)
    self.connection_monitor.connect_to_signal("ConnectionOffline", self.on_connection_offline)

    self.indicate = None 

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.indicate_server_ref_default()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      self.indicate.connect("server-display", self.on_indicator_server_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.indicate.show()
    self.indicator_items = {}
    self.notified_items = []
    self.notified_errors = {}
    self.messages_indicator = None
    self.replies_indicator = None
    self.private_indicator = None
    self.unseen_counts = {}
    for s in "messages", "replies", "private":
      self.unseen_counts[s] = 0

    self.refresh_count = 0
    self.mainloop = loop
    self.workerpool = multiprocessing.Pool()

    self.refresh_timer_id = None

    self.maintDone = False
    self.maintRunning = False
    self.refreshRunning = False

    if autorefresh:
      if self.refresh_timer_id:
        gobject.source_remove(self.refresh_timer_id)
      # wait a few seconds before alerting the world we are online
      self.refresh_timer_id = gobject.timeout_add_seconds(int(10), self.refresh)

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)
Ejemplo n.º 2
0
    def __init__(self, loop, autorefresh=True):
        self.bus = dbus.SessionBus()
        bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
        dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

        self.db = sqlite3.connect(SQLITE_DB_FILENAME)

        self.accounts = storage.AccountManager(self.db)
        self.searches = storage.SearchManager(self.db)
        self.streams = storage.StreamManager(self.db)
        self.messages = storage.MessageManager(self.db)
        self.collector = OperationCollector(self)

        if indicate and util.resources.get_desktop_file():
            self.indicate = indicate.indicate_server_ref_default()
            self.indicate.set_type("message.gwibber")
            self.indicate.set_desktop_file(util.resources.get_desktop_file())
            self.indicate.connect("server-display", self.on_indicator_activate)
            self.indicate.connect("interest-added",
                                  self.on_indicator_interest_added)
            self.indicate.connect("interest-removed",
                                  self.on_indicator_interest_removed)
            self.indicate.show()
        self.indicator_items = {}
        self.notified_items = []

        self.refresh_count = 0
        self.mainloop = loop
        self.workerpool = multiprocessing.Pool()

        self.refresh_timer_id = None

        if autorefresh:
            self.refresh()

        self.accounts_service = util.getbus("Accounts")
        self.accounts_service.connect_to_signal("Updated",
                                                self.on_account_updated)
        self.accounts_service.connect_to_signal("Deleted",
                                                self.on_account_deleted)
        self.accounts_service.connect_to_signal("Created",
                                                self.on_account_created)
Ejemplo n.º 3
0
  def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.indicate_server_ref_default()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      self.indicate.connect("server-display", self.on_indicator_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.indicate.show()
    self.indicator_items = {}
    self.notified_items = []

    self.refresh_count = 0
    self.mainloop = loop
    self.workerpool = multiprocessing.Pool()

    self.refresh_timer_id = None

    if autorefresh:
      self.refresh()

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)
Ejemplo n.º 4
0
  def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)
    self.mainloop = loop

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)
 
    # Monitor the connection
    self.connection_monitor = util.getbus("Connection")
    self.connection_monitor.connect_to_signal("ConnectionOnline", self.on_connection_online)
    self.connection_monitor.connect_to_signal("ConnectionOffline", self.on_connection_offline)

    self.indicator_items = {}
    self.notified_items = []
    self.notified_errors = {}
    self.messages_indicator = None
    self.replies_indicator = None
    self.private_indicator = None
    self.unseen_counts = {}
    for s in "messages", "replies", "private":
      self.unseen_counts[s] = 0

    self.indicate = None 
    self.launcher = None

    self.job_list = []

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.Server.ref_default ()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      if Dbusmenu and self.indicate:
        post_menu = Dbusmenu.Menuitem.new ()
        post_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Update Status"))
        post_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
        post_menu.connect("item-activated", self.show_poster)

        menu_server = Dbusmenu.Server.new("/messaging/commands")
        root = Dbusmenu.Menuitem.new ()
        root.child_append (post_menu)
        menu_server.set_root(root)
        self.indicate.set_menu (menu_server)
      self.indicate.connect("server-display", self.on_indicator_server_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.update_indicators(self.unseen_counts)
      self.indicate.show()

    if Unity and Dbusmenu:
      self.launcher = Unity.LauncherEntry.get_for_desktop_id ("gwibber.desktop")
      ql = Dbusmenu.Menuitem.new ()
      ql_post_menu = Dbusmenu.Menuitem.new ()
      ql_post_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Update Status"))
      ql_post_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      ql_post_menu.connect("item-activated", self.show_poster)

      ql.child_append (ql_post_menu)
      refresh_menu = Dbusmenu.Menuitem.new ()
      refresh_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Refresh"))
      refresh_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      refresh_menu.connect("item-activated", self.refresh)
      ql.child_append (refresh_menu)
      accounts_menu = Dbusmenu.Menuitem.new ()
      accounts_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Accounts"))
      accounts_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      accounts_menu.connect("item-activated", self.show_accounts)
      ql.child_append (accounts_menu)
      preferences_menu = Dbusmenu.Menuitem.new ()
      preferences_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Preferences"))
      preferences_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      preferences_menu.connect("item-activated", self.show_preferences)
      ql.child_append (preferences_menu)
      quit_menu = Dbusmenu.Menuitem.new ()
      quit_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Quit"))
      quit_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      quit_menu.connect("item-activated", self.shutdown)
      ql.child_append (quit_menu)
      self.launcher.set_property("quicklist", ql)
      self.launcher.set_property("count", 0)
      self.launcher.set_property("count_visible", False)

    self.refresh_count = 0

    self.refresh_timer_id = None

    self.maintDone = False
    self.maintRunning = False
    self.refreshRunning = False

    if autorefresh:
      if self.refresh_timer_id:
        GLib.source_remove(self.refresh_timer_id)
      # wait a few seconds before alerting the world we are online
      self.refresh_timer_id = GLib.timeout_add_seconds(int(10), self.refresh)

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)

    self.streams_service = util.getbus("Streams")
    self.streams_service.connect_to_signal("Created", self.perform_single_op)

    self.searches_service = util.getbus("Searches")
    self.searches_service.connect_to_signal("Created", self.perform_single_op)
Ejemplo n.º 5
0
    def __init__(self, loop, autorefresh=True):
        self.bus = dbus.SessionBus()
        bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
        dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

        self.db = sqlite3.connect(SQLITE_DB_FILENAME)

        self.accounts = storage.AccountManager(self.db)
        self.searches = storage.SearchManager(self.db)
        self.streams = storage.StreamManager(self.db)
        self.messages = storage.MessageManager(self.db)
        self.collector = OperationCollector(self)

        # Monitor the connection
        self.connection_monitor = util.getbus("Connection")
        self.connection_monitor.connect_to_signal("ConnectionOnline",
                                                  self.on_connection_online)
        self.connection_monitor.connect_to_signal("ConnectionOffline",
                                                  self.on_connection_offline)

        self.indicate = None

        if indicate and util.resources.get_desktop_file():
            self.indicate = indicate.indicate_server_ref_default()
            self.indicate.set_type("message.gwibber")
            self.indicate.set_desktop_file(util.resources.get_desktop_file())
            self.indicate.connect("server-display",
                                  self.on_indicator_server_activate)
            self.indicate.connect("interest-added",
                                  self.on_indicator_interest_added)
            self.indicate.connect("interest-removed",
                                  self.on_indicator_interest_removed)
            self.indicate.show()
        self.indicator_items = {}
        self.notified_items = []
        self.notified_errors = {}
        self.messages_indicator = None
        self.replies_indicator = None
        self.private_indicator = None
        self.unseen_counts = {}
        for s in "messages", "replies", "private":
            self.unseen_counts[s] = 0

        if Unity and Dbusmenu:
            launcher = Unity.LauncherEntry.get_for_desktop_id(
                "gwibber.desktop")
            ql = Dbusmenu.Menuitem.new()
            refresh_menu = Dbusmenu.Menuitem.new()
            refresh_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                      _("Refresh"))
            refresh_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                           True)
            refresh_menu.connect("item-activated", self.refresh)
            ql.child_append(refresh_menu)
            accounts_menu = Dbusmenu.Menuitem.new()
            accounts_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                       _("Accounts"))
            accounts_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                            True)
            accounts_menu.connect("item-activated", self.show_accounts)
            ql.child_append(accounts_menu)
            preferences_menu = Dbusmenu.Menuitem.new()
            preferences_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                          _("Preferences"))
            preferences_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                               True)
            preferences_menu.connect("item-activated", self.show_preferences)
            ql.child_append(preferences_menu)
            quit_menu = Dbusmenu.Menuitem.new()
            quit_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL, _("Quit"))
            quit_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True)
            quit_menu.connect("item-activated", self.shutdown)
            ql.child_append(quit_menu)
            launcher.set_property("quicklist", ql)

        self.refresh_count = 0
        self.mainloop = loop
        self.workerpool = multiprocessing.Pool()

        self.refresh_timer_id = None

        self.maintDone = False
        self.maintRunning = False
        self.refreshRunning = False

        if autorefresh:
            if self.refresh_timer_id:
                gobject.source_remove(self.refresh_timer_id)
            # wait a few seconds before alerting the world we are online
            self.refresh_timer_id = gobject.timeout_add_seconds(
                int(10), self.refresh)

        self.accounts_service = util.getbus("Accounts")
        self.accounts_service.connect_to_signal("Updated",
                                                self.on_account_updated)
        self.accounts_service.connect_to_signal("Deleted",
                                                self.on_account_deleted)
        self.accounts_service.connect_to_signal("Created",
                                                self.on_account_created)