Beispiel #1
0
    def __init__(self, dock, conn_manager, conn_zone):
        # Call parent constructor
        SystrayBase.__init__(self, dock, conn_manager, conn_zone)

        ### Instantiate a gtk.StatusIcon ###
        # gnome-shell checks XClassHint.res_class with ShellTrayIcon.
        # gtk_status_icon_set_name() can set XClassHint.res_class .
        # However gtk_status_icon_new() also calls gtk_window_realize() so
        # gtk_status_icon_set_visible() needs to be called to set WM_CLASS
        # so that gtk_window_realize() is called later again.
        # set_title is for gnome-shell notificationDaemon in bottom right.
        self.__sicon = gtk.StatusIcon()
        self.__sicon.set_visible(False)
        self.__sicon.set_title(self._config.get_app_name())
        self.__sicon.set_visible(True)
        self.__set_status_trayicon(is_connected=False, is_sms_pending=False)
        self.open.set_label(_('Open %s') % self._config.get_app_name())

        # Prepare the tooltip
        self.__update_tooltip()

        # Connect various signals
        self._connect_signals()

        self.__timeout = None
        if self._is_connected():
            self._on_connected()
        else:
            self._on_disconnected()
Beispiel #2
0
    def __init__(self, dock, conn_manager, conn_zone):
        # Call parent constructor
        SystrayBase.__init__(self, dock, conn_manager, conn_zone)

        ### Instantiate a gtk.StatusIcon ###
        # gnome-shell checks XClassHint.res_class with ShellTrayIcon.
        # gtk_status_icon_set_name() can set XClassHint.res_class .
        # However gtk_status_icon_new() also calls gtk_window_realize() so
        # gtk_status_icon_set_visible() needs to be called to set WM_CLASS
        # so that gtk_window_realize() is called later again.
        # set_title is for gnome-shell notificationDaemon in bottom right.
        self.__sicon = gtk.StatusIcon()
        self.__sicon.set_visible(False)
        self.__sicon.set_title(self._config.get_app_name())
        self.__sicon.set_visible(True)
        self.__set_status_trayicon(is_connected = False, is_sms_pending = False)
        self.open.set_label(_('Open %s') % self._config.get_app_name())

        # Prepare the tooltip
        self.__update_tooltip()

        # Connect various signals
        self._connect_signals()

        self.__timeout = None
        if self._is_connected():
            self._on_connected()
        else:
            self._on_disconnected()
Beispiel #3
0
    def __init__(self, dock, conn_manager, conn_zone):
        # Call parent constructor
        SystrayBase.__init__(self, dock, conn_manager, conn_zone)

        # Instantiate a AppIndicator
        self.__indicator = appindicator.Indicator(
                'tgcm-%s' % tgcm.country_support, '__indicator-messages',
                appindicator.CATEGORY_APPLICATION_STATUS)
        self.__indicator.set_status(appindicator.STATUS_ACTIVE)
        self.__indicator.set_property('title', self._config.get_app_name())

        # Get the location of the icons
        icon_theme_path = os.path.dirname(self._theme_manager.get_icon('icons', 'conectado.png'))
        self.__indicator.set_icon_theme_path(icon_theme_path)

        ### Glade menu modifications ###

        # Substitute the current open entry with a new with a checkbutton
        self.open.hide()
        self.open_item = gtk.CheckMenuItem(_('Show the dock'))
        self.open_item.set_active(self._config.get_ui_general_key_value('systray_showing_mw'))
        self.open_item.show()
        self.menu.insert(self.open_item, 0)

        # Add a menu separator
        item = gtk.SeparatorMenuItem()
        item.show()
        self.menu.insert(item, 1)

        # Create menu entries about connection status, statistics, etc.
        self.__labels = {}
        labels = ['connection', 'speed', 'time', 'data_usage', 'sms']
        i = 2
        for label in labels:
            item = SystrayIndicator.IndicatorLabelEntry()
            item.set_text(label)
            self.menu.insert(item.get_item(), i)
            self.__labels[label] = item
            i += 1

        # Load the gtk.Menu object into AppIndicator
        self.__indicator.set_menu(self.menu)

        # Prepare the labels
        self.__update_labels()

        # Connect various signals
        self._connect_signals()