Exemple #1
0
    def _create_indicator(self, subtype, sender, body,
                          extra_text = '', icid=None):
        """
        This creates a new indicator item, called by on_message, online & offline.
        """
        if indicate:
            try:
                # Ubuntu 9.10+
                ind = indicate.Indicator()
            except Exception:
                # Ubuntu 9.04
                ind = indicate.IndicatorMessage()

            #Get user icon.
            contact = self.handler.session.contacts.safe_get(body)
            pixbuf = utils.safe_gtk_pixbuf_load(contact.picture or '', (48, 48))
            if pixbuf is not None:
                ind.set_property_icon("icon", pixbuf)

            ind.set_property("subtype", subtype)
            ind.set_property("sender", sender + extra_text)
            if icid is not None:
                ind.set_property("body", str(icid))
            else:
                ind.set_property("body", body)
            ind.set_property_time("time", time.time())
            ind.set_property("draw-attention", "true")
            ind.connect("user-display", self._display)
            ind.show()

            # Add indicator to the dictionary
            if subtype == "im":
                self.indicator_dict[ind] = icid
                self.r_indicator_dict[icid] = ind

            for old_icid in self.indicator_dict.values():
                if old_icid not in self.handler.session.conversations.keys():
                    # workaround: kill the orphan indicator
                    ind = self.r_indicator_dict[old_icid]
                    del self.indicator_dict[ind]
                    del self.r_indicator_dict[old_icid]
        else:
            return
 def create_indicator(self, acc):
     indicator = Indicate.Indicator()
     indicator.set_property("name", acc.get_name())
     indicator.set_property("count", str(acc.get_total_unread()))
     #TODO indicator.set_property_icon("icon", acc.get_icon())
     indicator.show()
     indicator.connect("user-display", self.on_indicator_display_cb)
     acc.indicator = indicator
     indicator.account = acc
     acc.is_error_icon = False
     logger.debug("Indicator created")
Exemple #3
0
    def add_indicator(self, feed_id, feed_title, feed_count):
        if feed_id in self.indicators.keys():
            indicator = self.indicators[feed_id]
        else:
            indicator = Indicate.Indicator()
            indicator.set_property("subtype", "mail")
            indicator.set_property("name", feed_title)
            indicator.connect("user-display", self.display_feed, feed_id)
            self.indicators[feed_id] = indicator
            self.server.add_indicator(indicator)

        indicator.set_property('count', str(feed_count))
        indicator.set_property('draw-attention', 'true')
        indicator.show()
Exemple #4
0
    def __init__(self, handler, main_window=None):
        """constructor"""
        gui.BaseTray.__init__(self, handler)
        self.main_window = main_window
        self.signals_have_been_connected = False
        # if system-wide desktop file is not present
        # fallback to a custom .desktop file to be placed in /mesinyer/
        self.desktop_file = os.path.join("/usr/share/applications/", "emesene.desktop")
        if not utils.file_readable(self.desktop_file):
            self.desktop_file = os.path.join(os.getcwd(), "data/share/applications/emesene.desktop")

        self.indicator_dict = {}
        self.r_indicator_dict = {}

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.emesene")
        self.server.set_desktop_file(self.desktop_file)
        self.sid = self.server.connect("server-display", self._server_display)
        self.server.show()
Exemple #5
0
    def __init__ (self, handler, main_window=None):
        '''constructor'''
        gui.BaseTray.__init__(self, handler)
        self.main_window = main_window
        self.signals_have_been_connected = False
        # if system-wide desktop file is not present
        # fallback to a custom .desktop file to be placed in /mesinyer/
        self.desktop_file = os.path.join("/usr/share/applications/",
                                         "emesene.desktop")
        if not utils.file_readable(self.desktop_file):
            self.desktop_file = os.path.join(os.getcwd(),
                                    "data/share/applications/emesene.desktop")

        self.indicator_dict = {}
        self.r_indicator_dict = {}

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.emesene")
        self.server.set_desktop_file(self.desktop_file)
        self.sid = self.server.connect("server-display", self._server_display)
        self.server.show()