コード例 #1
0
def notify_process():
    global notifications, notifying, last_notify

    if len(notifications) == 0:
        return


#    if notifying == True:
#        #See Bug #622021 on gnome
#        diff = datetime.now() - last_notify
#        if diff.seconds > 30:
#            logger.debug("30 seconds from the last notification, reactivating")
#            notifying = False
#        else:
#            return

    if not Notify.is_initted():
        logger.warn('The notification library has not been initialized yet')
        return

    while len(notifications) > 0:
        n = notifications.pop(0)
        #n.connect("closed", notify_closed_cb)
        n.show()

    notifying = True
    last_notify = datetime.now()
    #TODO Do it better and configuable
    sound = Sound()
    sound.play(config.add_data_prefix("drip.ogg"))
コード例 #2
0
 def __init__(self, name,id_provider = None):
     Provider.__init__(self, name)
     self.id_provider = id_provider
     if not id_provider:
         self.id_provider = name
     self.id_provider = self.id_provider.lower()
     self.icon = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix(self.id_provider + '.png'))
コード例 #3
0
def notify_process ():
    global notifications, notifying, last_notify

    if len(notifications) == 0:
        return;

#    if notifying == True:
#        #See Bug #622021 on gnome
#        diff = datetime.now() - last_notify
#        if diff.seconds > 30:
#            logger.debug("30 seconds from the last notification, reactivating")
#            notifying = False
#        else:
#            return

    if not Notify.is_initted():
        logger.warn('The notification library has not been initialized yet')
        return

    while len(notifications) > 0:
        n = notifications.pop(0)
        #n.connect("closed", notify_closed_cb)
        n.show()

    notifying= True
    last_notify = datetime.now()
    #TODO Do it better and configuable
    sound = Sound()
    sound.play(config.add_data_prefix("drip.ogg"))
コード例 #4
0
 def _create_dialog(self, parent):
     self._builder=gtk.Builder()
     self._builder.set_translation_domain("cloudsn")
     self._builder.add_from_file(config.add_data_prefix(self.id_provider + ".ui"))
     dialog = self._builder.get_object("main")
     self._builder.connect_signals(self)
     return dialog
コード例 #5
0
 def load(self):
     self.builder = Gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("imap-account.ui"))
     self.box = self.builder.get_object("container")
     self.labels_store = self.builder.get_object("labels_store")
     self.labels_treeview = self.builder.get_object("labels_treeview")
     self.builder.connect_signals(self)
     if self.account:
         credentials = self.account.get_credentials_save()
         self.builder.get_object("host_entry").set_text(
             self.account["host"])
         self.builder.get_object("username_entry").set_text(
             credentials.username)
         self.builder.get_object("password_entry").set_text(
             credentials.password)
         self.builder.get_object("port_entry").set_text(
             str(self.account["port"]))
         self.builder.get_object("ssl_check").set_active(
             utils.get_boolean(self.account["ssl"]))
         if 'labels' in self.account.get_properties():
             labels = [l.strip() for l in self.account["labels"].split(",")]
             for label in labels:
                 if label != '':
                     siter = self.labels_store.append()
                     self.labels_store.set_value(siter, 0, label)
     return self.box
コード例 #6
0
 def __init__(self, name, id_provider = None):
     Provider.__init__(self, name)
     self.id_provider = id_provider
     if not id_provider:
         self.id_provider = name
     self.id_provider = self.id_provider.lower()
     self.icon = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix(self.id_provider + '.png'))
コード例 #7
0
    def load_window(self):
        from cloudsn.core.controller import Controller

        self.builder=Gtk.Builder()
        self.builder.set_translation_domain("cloudsn")
        self.builder.add_from_file(config.add_data_prefix("preferences.ui"))
        self.builder.connect_signals(self)
        self.window=self.builder.get_object("main_window")
        self.window.connect ("delete-event", self.window_delete_event_cb)
        self.window.set_icon(config.get_cloudsn_icon())
        self.main_account_tree = self.builder.get_object("main_account_tree");
        self.main_store = self.builder.get_object("account_store");
        self.providers_combo = self.builder.get_object("providers_combo");
        self.providers_store = self.builder.get_object("providers_store");
        self.play_button = self.builder.get_object("tool_play");
        self.read_button = self.builder.get_object("main_read_button");

        #Populate accounts
        for acc in self.am.get_accounts():
            self.main_store.append([acc.get_icon(), acc.get_name(),
                self.__get_account_date(acc), acc.get_active(),
                acc.get_total_unread()])

        #Populate providers
        for prov in self.pm.get_providers():
            self.providers_store.append([prov.get_icon(), prov.get_name()])

        #Update the last check date
        Controller.get_instance().connect ("account-checked",
            self.__on_account_checked_cb)

        Controller.get_instance().connect ("account-check-error",
            self.__on_account_check_error_cb)

        self.set_play_active (Controller.get_instance().get_active())
コード例 #8
0
 def _create_dialog(self, parent):
     self._builder=gtk.Builder()
     self._builder.set_translation_domain("cloudsn")
     self._builder.add_from_file(config.add_data_prefix(self.id_provider + ".ui"))
     dialog = self._builder.get_object("main")
     self._builder.connect_signals(self)
     return dialog
コード例 #9
0
 def __init__(self, name, id_provider = None):
     Provider.__init__(self, name)
     self.id_provider = id_provider
     if not id_provider:
         self.id_provider = name
     self.id_provider = self.id_provider.lower()
     self.icon_path = config.add_data_prefix(self.id_provider + '.png')
     self.icon = GdkPixbuf.Pixbuf.new_from_file(self.icon_path)
     self.gicon = Gio.FileIcon.new(Gio.File.new_for_path(self.icon_path))
コード例 #10
0
 def on_startup_check_toggled(self, widget, data=None):
     if widget.get_active():
         if not os.path.exists(config.get_startup_file_path()):
             if not os.path.exists(config.get_startup_file_dir()):
                 os.makedirs(config.get_startup_file_dir())
             shutil.copyfile(config.add_data_prefix("cloudsn.desktop"),
                 config.get_startup_file_path())
     else:
         os.remove (config.get_startup_file_path())
コード例 #11
0
 def __init__(self, name, id_provider=None):
     Provider.__init__(self, name)
     self.id_provider = id_provider
     if not id_provider:
         self.id_provider = name
     self.id_provider = self.id_provider.lower()
     self.icon_path = config.add_data_prefix(self.id_provider + '.png')
     self.icon = GdkPixbuf.Pixbuf.new_from_file(self.icon_path)
     self.gicon = Gio.FileIcon.new(Gio.File.new_for_path(self.icon_path))
コード例 #12
0
def show_about_dialog():
    dialog = gtk.AboutDialog()
    dialog.set_name(const.APP_LONG_NAME)
    dialog.set_version(const.APP_VERSION)
    dialog.set_copyright (const.APP_COPYRIGHT)
    dialog.set_comments(const.APP_DESCRIPTION)
    dialog.set_website (const.APP_WEBSITE)
    dialog.set_logo(gtk.gdk.pixbuf_new_from_file(config.add_data_prefix('cloudsn120.png')))
    dialog.set_authors (["Jesús Barbero Rodríguez"])
    dialog.run()
    dialog.hide()
コード例 #13
0
    def load_window(self):
        from cloudsn.core.controller import Controller
        builder=gtk.Builder()
        builder.set_translation_domain("cloudsn")
        builder.add_from_file(config.add_data_prefix("preferences.ui"))
        builder.connect_signals(self)
        self.window=builder.get_object("dialog")
        self.minutes=builder.get_object("minutes_spin")
        self.max_not_spin=builder.get_object("max_not_spin")
        #tests
        self.store = builder.get_object("account_store");
        self.account_tree = builder.get_object("account_treeview");
        self.dialog_new = builder.get_object("account_new_dialog");
        self.providers_combo = builder.get_object("providers_combo");
        self.providers_store = builder.get_object("providers_store");
        self.account_name_entry = builder.get_object("account_name_entry");
        self.startup_check = builder.get_object("startup_check")
        self.indicator_combo = builder.get_object("indicator_combo")
        self.indicators_store = builder.get_object("indicators_store");
        for prov in self.pm.get_providers():
            self.providers_store.append([prov.get_icon(), prov.get_name()])
        for acc in self.am.get_accounts():
            self.store.append([acc.get_icon(), acc.get_name(),
                self.__get_account_date(acc), acc.get_active()])

        self.providers_combo.set_active(0)
        self.minutes.set_value (float(self.config.get_prefs()["minutes"]))
        self.max_not_spin.set_value (float(self.config.get_prefs()["max_notifications"]))

        self.window.set_icon(config.get_cloudsn_icon())
        self.dialog_new.set_icon(config.get_cloudsn_icon())

        if os.path.exists(config.get_startup_file_path()):
            self.startup_check.set_active(True)
        else:
            self.startup_check.set_active(False)
        #Populate indicator combo
        i=0
        indicator_name = self.config.get_prefs()["indicator"]
        for indi in self.im.get_indicators():
            self.indicators_store.append([indi.get_name()])
            if indi.get_name() == indicator_name:
                self.indicator_combo.set_active(i)
            i+=1

        #Update the last check date
        Controller.get_instance().connect ("account-checked", 
            self.__on_account_checked_cb)
        
        Controller.get_instance().connect ("account-check-error", 
            self.__on_account_check_error_cb)
コード例 #14
0
 def load(self):
     self.builder=gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("twitter-account.ui"))
     self.box = self.builder.get_object("container")
     self.permission_button = self.builder.get_object("permission_button")
     self.pin_entry = self.builder.get_object("pin_entry")
     
     self.auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
     auth_url = self.auth.get_authorization_url()
     self.permission_button.set_uri(auth_url)
     
     self.builder.connect_signals(self)
     if self.account:
         #Do not support editting
         pass
     return self.box
コード例 #15
0
    def load(self):
        self.builder=Gtk.Builder()
        self.builder.set_translation_domain("cloudsn")
        self.builder.add_from_file(config.add_data_prefix("twitter-account.ui"))
        self.box = self.builder.get_object("container")
        self.permission_button = self.builder.get_object("permission_button")
        self.pin_entry = self.builder.get_object("pin_entry")

        self.auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
        auth_url = self.auth.get_authorization_url()
        self.permission_button.set_uri(auth_url)

        self.builder.connect_signals(self)
        if self.account:
            #Do not support editting
            pass
        return self.box
コード例 #16
0
 def preferences_action_activate_cb (self, widget, data=None):
     self.pref_dialog = self.builder.get_object("preferences_dialog")
     self.pref_dialog.set_transient_for(self.window)
     self.pref_dialog.set_destroy_with_parent (True)
     indicator_combo = self.builder.get_object("indicator_combo")
     indicators_store = self.builder.get_object("indicators_store");
     minutes=self.builder.get_object("minutes_spin")
     max_not_spin=self.builder.get_object("max_not_spin")
     startup_check = self.builder.get_object("startup_check")
     
     minutes.set_value (float(self.config.get_prefs()["minutes"]))
     max_not_spin.set_value (float(self.config.get_prefs()["max_notifications"]))
     if os.path.exists(config.get_startup_file_path()):
         startup_check.set_active(True)
     else:
         startup_check.set_active(False)
     #Populate indicator combo
     i=0
     indicator_name = self.config.get_prefs()["indicator"]
     indicators_store.clear()
     for indi in self.im.get_indicators():
         indicators_store.append([indi.get_name()])
         if indi.get_name() == indicator_name:
             indicator_combo.set_active(i)
         i+=1
     response = self.pref_dialog.run()
     self.pref_dialog.hide()
     self.config.set_pref ("minutes", minutes.get_value())
     self.config.set_pref ("max_notifications", max_not_spin.get_value())
     iiter = indicator_combo.get_active_iter()
     if iiter:
         self.config.set_pref ("indicator", indicators_store.get_value(iiter,0))
     
     #Check startup checkbox
     if startup_check.get_active():
         if not os.path.exists(config.get_startup_file_path()):
             if not os.path.exists(config.get_startup_file_dir()):
                 os.makedirs(config.get_startup_file_dir())
             shutil.copyfile(config.add_data_prefix("cloudsn.desktop"),
                 config.get_startup_file_path())
     else:
         if os.path.exists(config.get_startup_file_path()):
             os.remove (config.get_startup_file_path())
         
     self.config.save_prefs()
コード例 #17
0
 def get_account_data_widget (self, account=None):
     self.builder=gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("gmail-account.ui"))
     box = self.builder.get_object("container")
     self.labels_store = self.builder.get_object("labels_store")
     self.labels_treeview = self.builder.get_object("labels_treeview")
     self.builder.connect_signals(self)
     if account:
         self.builder.get_object("username_entry").set_text(account["username"])
         self.builder.get_object("password_entry").set_text(account["password"])
         if 'labels' in account.get_properties():
             labels = [l.strip() for l in account["labels"].split(",")]
             for label in labels:
                 if label != '':
                     siter = self.labels_store.append()
                     self.labels_store.set_value(siter, 0, label)
     return box
コード例 #18
0
 def get_account_data_widget(self, account=None):
     self.builder = Gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("gmail-account.ui"))
     box = self.builder.get_object("container")
     self.labels_store = self.builder.get_object("labels_store")
     self.labels_treeview = self.builder.get_object("labels_treeview")
     self.builder.connect_signals(self)
     if account:
         credentials = account.get_credentials_save()
         self.builder.get_object("username_entry").set_text(
             credentials.username)
         self.builder.get_object("password_entry").set_text(
             credentials.password)
         if 'labels' in account.get_properties():
             labels = [l.strip() for l in account["labels"].split(",")]
             for label in labels:
                 if label != '':
                     siter = self.labels_store.append()
                     self.labels_store.set_value(siter, 0, label)
     return box
コード例 #19
0
 def load(self):
     self.builder=Gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("imap-account.ui"))
     self.box = self.builder.get_object("container")
     self.labels_store = self.builder.get_object("labels_store")
     self.labels_treeview = self.builder.get_object("labels_treeview")
     self.builder.connect_signals(self)
     if self.account:
         credentials = self.account.get_credentials_save()
         self.builder.get_object("host_entry").set_text(self.account["host"])
         self.builder.get_object("username_entry").set_text(credentials.username)
         self.builder.get_object("password_entry").set_text(credentials.password)
         self.builder.get_object("port_entry").set_text(str(self.account["port"]))
         self.builder.get_object("ssl_check").set_active(utils.get_boolean(self.account["ssl"]))
         if 'labels' in self.account.get_properties():
             labels = [l.strip() for l in self.account["labels"].split(",")]
             for label in labels:
                 if label != '':
                     siter = self.labels_store.append()
                     self.labels_store.set_value(siter, 0, label)
     return self.box
コード例 #20
0
    def load_window(self):
        from cloudsn.core.controller import Controller

        self.builder = gtk.Builder()
        self.builder.set_translation_domain("cloudsn")
        self.builder.add_from_file(config.add_data_prefix("preferences.ui"))
        self.builder.connect_signals(self)
        self.window = self.builder.get_object("main_window")
        self.window.connect("delete-event", self.window_delete_event_cb)
        self.window.set_icon(config.get_cloudsn_icon())
        self.main_account_tree = self.builder.get_object("main_account_tree")
        self.main_store = self.builder.get_object("account_store")
        self.providers_combo = self.builder.get_object("providers_combo")
        self.providers_store = self.builder.get_object("providers_store")
        self.play_button = self.builder.get_object("tool_play")
        self.read_button = self.builder.get_object("main_read_button")

        #Populate accounts
        for acc in self.am.get_accounts():
            self.main_store.append([
                acc.get_icon(),
                acc.get_name(),
                self.__get_account_date(acc),
                acc.get_active(),
                acc.get_total_unread()
            ])

        #Populate providers
        for prov in self.pm.get_providers():
            self.providers_store.append([prov.get_icon(), prov.get_name()])

        #Update the last check date
        Controller.get_instance().connect("account-checked",
                                          self.__on_account_checked_cb)

        Controller.get_instance().connect("account-check-error",
                                          self.__on_account_check_error_cb)

        self.set_play_active(Controller.get_instance().get_active())
コード例 #21
0
def notify_process():
    global notifications, notifying, last_notify

    if len(notifications) == 0:
        return

    if notifying == True:
        #See Bug #622021 on gnome
        diff = datetime.now() - last_notify
        if diff.seconds > 30:
            logger.debug("30 seconds from the last notification, reactivating")
            notifying = False
        else:
            return

    n = notifications[0]
    n.connect("closed", notify_closed_cb)
    n.show()

    notifying = True
    last_notify = datetime.now()
    #TODO Do it better and configuable
    sound = Sound()
    sound.play(config.add_data_prefix("drip.ogg"))
コード例 #22
0
def notify_process ():
    global notifications, notifying, last_notify

    if len(notifications) == 0:
        return;

    if notifying == True:
        #See Bug #622021 on gnome
        diff = datetime.now() - last_notify
        if diff.seconds > 30:
            logger.debug("30 seconds from the last notification, reactivating")
            notifying = False
        else:
            return

    n = notifications[0]
    n.connect("closed", notify_closed_cb)
    n.show()

    notifying= True
    last_notify = datetime.now()
    #TODO Do it better and configuable
    sound = Sound()
    sound.play(config.add_data_prefix("drip.ogg"))
コード例 #23
0
def get_account_error_pixbuf(acc):
    original = acc.get_provider().get_icon().copy()
    error = GdkPixbuf.Pixbuf.new_from_file(config.add_data_prefix('error.png'))
    error.composite(original, 10, 10, 22, 22, 10, 10, 1.0, 1.0,
                    GdkPixbuf.InterpType.HYPER, 220)
    return original
コード例 #24
0
    def preferences_action_activate_cb(self, widget, data=None):
        self.pref_dialog = self.builder.get_object("preferences_dialog")
        self.pref_dialog.set_transient_for(self.window)
        self.pref_dialog.set_destroy_with_parent(True)
        indicator_combo = self.builder.get_object("indicator_combo")
        indicators_store = self.builder.get_object("indicators_store")
        keyring_combo = self.builder.get_object("keyring_combo")
        keyring_store = self.builder.get_object("keyring_store")
        minutes = self.builder.get_object("minutes_spin")
        max_not_spin = self.builder.get_object("max_not_spin")
        startup_check = self.builder.get_object("startup_check")
        enable_sounds_check = self.builder.get_object("enable_sounds_check")

        minutes.set_value(float(self.config.get_prefs()["minutes"]))
        max_not_spin.set_value(
            float(self.config.get_prefs()["max_notifications"]))
        if os.path.exists(config.get_startup_file_path()):
            startup_check.set_active(True)
        else:
            startup_check.set_active(False)

        enable_sounds_check.set_active(
            coreutils.get_boolean(self.config.get_prefs()["enable_sounds"]))

        #Populate indicator combo
        i = 0
        indicator_name = self.config.get_prefs()["indicator"]
        indicators_store.clear()
        for indi in self.im.get_indicators():
            indicators_store.append([indi.get_name()])
            if indi.get_name() == indicator_name:
                indicator_combo.set_active(i)
            i += 1
        i = 0
        keyring_id = self.config.get_prefs()["keyring"]
        keyring_store.clear()
        for k in self.km.get_managers():
            keyring_store.append([k.get_name(), k.get_id()])
            if k.get_id() == keyring_id:
                keyring_combo.set_active(i)
            i += 1
        response = self.pref_dialog.run()
        self.pref_dialog.hide()
        self.config.set_pref("minutes", minutes.get_value())
        self.config.set_pref("max_notifications", max_not_spin.get_value())
        self.config.set_pref("enable_sounds", enable_sounds_check.get_active())
        iiter = indicator_combo.get_active_iter()
        if iiter:
            self.config.set_pref("indicator",
                                 indicators_store.get_value(iiter, 0))
        iiter = keyring_combo.get_active_iter()

        selected = keyring_store.get_value(iiter, 1)
        for m in self.km.get_managers():
            logger.debug("selected %s, current %s" % (selected, m.get_id()))
            if m.get_id() == selected:
                self.km.set_manager(m)
                break

        self.config.set_pref("keyring", selected)

        #Check startup checkbox
        if startup_check.get_active():
            if not os.path.exists(config.get_startup_file_path()):
                if not os.path.exists(config.get_startup_file_dir()):
                    os.makedirs(config.get_startup_file_dir())
                shutil.copyfile(config.add_data_prefix("cloudsn.desktop"),
                                config.get_startup_file_path())
        else:
            if os.path.exists(config.get_startup_file_path()):
                os.remove(config.get_startup_file_path())

        self.config.save_prefs()
コード例 #25
0
 def __init__(self):
     if ImapProvider.__default:
        raise ImapProvider.__default
     ProviderBase.__init__(self, "Imap")
     self.icon = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix('imap.png'))
コード例 #26
0
 def __init__(self):
     if GMailProvider.__default:
         raise GMailProvider.__default
     Provider.__init__(self, "GMail")
     self.icon = gtk.gdk.pixbuf_new_from_file(
         config.add_data_prefix('gmail.png'))
コード例 #27
0
 def __init__(self):
     if ImapProvider.__default:
         raise ImapProvider.__default
     ProviderBase.__init__(self, "Imap")
     self.icon = gtk.gdk.pixbuf_new_from_file(
         config.add_data_prefix('imap.png'))
コード例 #28
0
def get_account_error_pixbuf (acc):
    original = acc.get_provider().get_icon().copy()
    error = GdkPixbuf.Pixbuf.new_from_file(config.add_data_prefix('error.png'))
    error.composite(original, 10, 10, 22, 22, 10, 10, 1.0, 1.0, GdkPixbuf.InterpType.HYPER, 220)
    return original
コード例 #29
0
def get_account_error_pixbuf (acc):
    original = acc.get_provider().get_icon().copy()
    error = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix('error.png'))
    error.composite(original, 10, 10, 22, 22, 10, 10, 1.0, 1.0, gtk.gdk.INTERP_HYPER, 220)
    return original
コード例 #30
0
 def __init__(self):
     if GMailProvider.__default:
        raise GMailProvider.__default
     Provider.__init__(self, "GMail")
     self.icon = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix('gmail.png'))
コード例 #31
0
def get_account_error_gicon (acc):
    return Gio.FileIcon.new(Gio.File.new_for_path(config.add_data_prefix('error.png')))
コード例 #32
0
 def __init__(self):
     if FeedsProvider.__default:
        raise FeedsProvider.__default
     ProviderUtilsBuilder.__init__(self, _("RSS news"), 'rss')
     self.icon = gtk.gdk.pixbuf_new_from_file(config.add_data_prefix('rss.png'))
コード例 #33
0
    def preferences_action_activate_cb (self, widget, data=None):
        self.pref_dialog = self.builder.get_object("preferences_dialog")
        self.pref_dialog.set_transient_for(self.window)
        self.pref_dialog.set_destroy_with_parent (True)
        indicator_combo = self.builder.get_object("indicator_combo")
        indicators_store = self.builder.get_object("indicators_store");
        keyring_combo = self.builder.get_object("keyring_combo")
        keyring_store = self.builder.get_object("keyring_store");
        minutes=self.builder.get_object("minutes_spin")
        max_not_spin=self.builder.get_object("max_not_spin")
        startup_check = self.builder.get_object("startup_check")
        enable_sounds_check = self.builder.get_object("enable_sounds_check")

        minutes.set_value (float(self.config.get_prefs()["minutes"]))
        max_not_spin.set_value (float(self.config.get_prefs()["max_notifications"]))
        if os.path.exists(config.get_startup_file_path()):
            startup_check.set_active(True)
        else:
            startup_check.set_active(False)

        enable_sounds_check.set_active(coreutils.get_boolean(self.config.get_prefs()["enable_sounds"]))

        #Populate indicator combo
        i=0
        indicator_name = self.config.get_prefs()["indicator"]
        indicators_store.clear()
        for indi in self.im.get_indicators():
            indicators_store.append([indi.get_name()])
            if indi.get_name() == indicator_name:
                indicator_combo.set_active(i)
            i+=1
        i=0
        keyring_id = self.config.get_prefs()["keyring"]
        keyring_store.clear()
        for k in self.km.get_managers():
            keyring_store.append([k.get_name(), k.get_id()])
            if k.get_id() == keyring_id:
                keyring_combo.set_active(i)
            i+=1
        response = self.pref_dialog.run()
        self.pref_dialog.hide()
        self.config.set_pref ("minutes", minutes.get_value())
        self.config.set_pref ("max_notifications", max_not_spin.get_value())
        self.config.set_pref ("enable_sounds", enable_sounds_check.get_active())
        iiter = indicator_combo.get_active_iter()
        if iiter:
            self.config.set_pref ("indicator", indicators_store.get_value(iiter,0))
        iiter = keyring_combo.get_active_iter()

        selected = keyring_store.get_value(iiter,1)
        for m in self.km.get_managers():
            logger.debug("selected %s, current %s" % (selected, m.get_id()))
            if m.get_id() == selected:
                self.km.set_manager(m)
                break

        self.config.set_pref ("keyring", selected)

        #Check startup checkbox
        if startup_check.get_active():
            if not os.path.exists(config.get_startup_file_path()):
                if not os.path.exists(config.get_startup_file_dir()):
                    os.makedirs(config.get_startup_file_dir())
                shutil.copyfile(config.add_data_prefix("cloudsn.desktop"),
                    config.get_startup_file_path())
        else:
            if os.path.exists(config.get_startup_file_path()):
                os.remove (config.get_startup_file_path())

        self.config.save_prefs()
コード例 #34
0
def get_account_error_gicon(acc):
    return Gio.FileIcon.new(
        Gio.File.new_for_path(config.add_data_prefix('error.png')))