def show_config(self, parent):
     dialog = gtk.Dialog(_("del.icio.us Account"), parent,
             gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
             (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
             gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
 
     table = gtk.Table(rows=2, columns=2)
     
     table.attach(gtk.Label(_("Enter your del.icio.us username below")), 0, 2, 0, 1)
 
     user_entry = gtk.Entry()
     t = GconfStore.get_instance().get_client().get_string(MATECONF_DELICIOUS_USER)
     if t != None:
         user_entry.set_text(t)
     table.attach(gtk.Label(_("Username: "******"":
         GconfStore.get_instance().get_client().set_string(MATECONF_DELICIOUS_USER, user_entry.get_text())
示例#2
0
 def activate(self, text=None):
     self.user = GconfStore.get_instance().get_client().get_string(GCONF_TWITTER_USER)
     self.password = GconfStore.get_instance().get_client().get_string(GCONF_TWITTER_PASSWORD)
     api = twitter.Api()
     pynotify.init("Deskbar Twitter Plugin")
     message = "Your post to Twitter might have had a problem"
     try:
         results = api.PostUpdate(self.user, self.password, self._name)
         if self._name == results.text:
             message = "Your post to Twitter was successful"
         n = pynotify.Notification("Twitter Results", message)
         n.set_icon_from_pixbuf(ICON)
         n.show()
     except URLError, e:
         if e.code == 401:
             message = "Incorrect Twitter Username and/or Password"
         if e.code == 403:
             message = "Your request Twitter was forbidden"
         if e.code == 404:
             message = "The URL for Twitter was not found"
         if e.code == 408:
             message = "The request to Twitter timed out.  Try again later."
         n = pynotify.Notification("Twitter Results", message)
         n.set_icon_from_pixbuf(ICON)
         n.show()
 def __init__(self, handler):
     """We need use the globals DELICIOUS_USER and DELICIOUS_PASS"""
     self.handler = handler
     
     self._user = GconfStore.get_instance().get_client().get_string(MATECONF_DELICIOUS_USER)
         
     GconfStore.get_instance().get_client().notify_add(MATECONF_DELICIOUS_USER, lambda x, y, z, a: self.on_username_change(z.value))
示例#4
0
    def show_config(self, parent):
        dialog = gtk.Dialog(_("del.icio.us Account"), parent,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                             gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        table = gtk.Table(rows=2, columns=2)

        table.attach(gtk.Label(_("Enter your del.icio.us username below")), 0,
                     2, 0, 1)

        user_entry = gtk.Entry()
        t = GconfStore.get_instance().get_client().get_string(
            MATECONF_DELICIOUS_USER)
        if t != None:
            user_entry.set_text(t)
        table.attach(gtk.Label(_("Username: "******"":
            GconfStore.get_instance().get_client().set_string(
                MATECONF_DELICIOUS_USER, user_entry.get_text())
示例#5
0
def _on_handler_preferences(dialog):
    def toggled_cb(sender, show_all_radio, show_primary_radio):
        GconfStore.get_instance().get_client().set_bool(
            MATECONF_SHOW_ONLY_PRIMARY_KEY, show_primary_radio.get_active())

    def sync_ui(new_show_only_primary, show_all_radio, show_primary_radio):
        show_all_radio.set_active(not new_show_only_primary)
        show_primary_radio.set_active(new_show_only_primary)

    builder = gtk.Builder()
    builder.add_from_file(
        os.path.join(deskbar.SHARED_DATA_DIR, "mozilla-search.ui"))
    dialog = builder.get_object("prefs-dialog")
    show_all_radio = builder.get_object("show_all_radio")
    show_primary_radio = builder.get_object("show_primary_radio")

    show_primary_radio.set_active(SHOW_ONLY_PRIMARY)
    show_all_radio.set_active(not SHOW_ONLY_PRIMARY)

    show_all_radio.connect("toggled", toggled_cb, show_all_radio,
                           show_primary_radio)
    show_primary_radio.connect("toggled", toggled_cb, show_all_radio,
                               show_primary_radio)

    notify_id = GconfStore.get_instance().get_client().notify_add(
        MATECONF_SHOW_ONLY_PRIMARY_KEY, lambda x, y, z, a: sync_ui(
            z.value.get_bool(), show_all_radio, show_primary_radio))
    dialog.set_icon_name("deskbar-applet")
    dialog.show_all()
    dialog.run()
    dialog.destroy()
    GconfStore.get_instance().get_client().notify_remove(notify_id)
示例#6
0
文件: mozilla.py 项目: johnsonc/swarm
def _on_handler_preferences(dialog):
    def toggled_cb(sender, show_all_radio, show_primary_radio):
        GconfStore.get_instance().get_client().set_bool(GCONF_SHOW_ONLY_PRIMARY_KEY, show_primary_radio.get_active())
        
    def sync_ui(new_show_only_primary, show_all_radio, show_primary_radio):
        show_all_radio.set_active(not new_show_only_primary)
        show_primary_radio.set_active(new_show_only_primary)
    
    builder = gtk.Builder()
    builder.add_from_file(os.path.join(deskbar.SHARED_DATA_DIR, "mozilla-search.ui"))
    dialog = builder.get_object("prefs-dialog")
    show_all_radio = builder.get_object("show_all_radio")
    show_primary_radio = builder.get_object("show_primary_radio")
    
    show_primary_radio.set_active(SHOW_ONLY_PRIMARY)
    show_all_radio.set_active(not SHOW_ONLY_PRIMARY)
    
    show_all_radio.connect ("toggled", toggled_cb, show_all_radio, show_primary_radio)
    show_primary_radio.connect ("toggled", toggled_cb, show_all_radio, show_primary_radio)
    
    notify_id = GconfStore.get_instance().get_client().notify_add(GCONF_SHOW_ONLY_PRIMARY_KEY, lambda x, y, z, a: sync_ui(z.value.get_bool(), show_all_radio, show_primary_radio))
    dialog.set_icon_name("deskbar-applet")
    dialog.show_all()
    dialog.run()
    dialog.destroy()
    GconfStore.get_instance().get_client().notify_remove(notify_id)
def get_preferred_browser():
    http_handler = GconfStore.get_instance().get_client().get_string("/desktop/mate/url-handlers/http/command")
    if http_handler == None:
        return None
        
    http_handler = http_handler.strip().lower()
    if not GconfStore.get_instance().get_client().get_bool("/desktop/mate/url-handlers/http/enabled"):
        return None
    
    return http_handler.split(" ")[0]
示例#8
0
    def __init__(self, handler):
        """We need use the globals DELICIOUS_USER and DELICIOUS_PASS"""
        self.handler = handler

        self._user = GconfStore.get_instance().get_client().get_string(
            MATECONF_DELICIOUS_USER)

        GconfStore.get_instance().get_client().notify_add(
            MATECONF_DELICIOUS_USER,
            lambda x, y, z, a: self.on_username_change(z.value))
示例#9
0
def get_preferred_browser():
    http_handler = GconfStore.get_instance().get_client().get_string(
        "/desktop/mate/url-handlers/http/command")
    if http_handler == None:
        return None

    http_handler = http_handler.strip().lower()
    if not GconfStore.get_instance().get_client().get_bool(
            "/desktop/mate/url-handlers/http/enabled"):
        return None

    return http_handler.split(" ")[0]
示例#10
0
    def query(self, query):
        try:
            self.obj = sbus.get_object(SERVICE, OBJ_PATH)
            self.interface = dbus.Interface(self.obj, INTERFACE)
        except:
            print sys.exc_info()
            print 'Unable to connect to Gajim - probably it isn\'t running'
            return []
                        
        t = GconfStore.get_instance().get_client().get_bool(GCONF_GAJIM_SHOWOFFLINE)
        if t != None:
            self.show_offline = t
        else:
            self.show_offline = False
            GconfStore.get_instance().get_client().set_bool(GCONF_GAJIM_SHOWOFFLINE, False)

        message = ''
        if self.lastrequest != None and datetime.datetime.now() - self.lastrequest < datetime.timedelta(seconds=20):
            self.method = self.get_cache
            message = 'asking Cache for roster'
        else:
            self.method = self.list_contacts
            message = 'asking Gajim for roster'
        try:
            print message
            res = self.method(dbus.String(''))
            results = []
            for buddy in res:
                name = buddy['name']
                jid = buddy['jid']
                status = buddy['show']
                if self.show_offline or (status != 'offline'):
                    if query in name.lower() or query in jid.lower():
                        if '@' in jid.lower():
                            transport = jid.split('@')[1].split('.')[0]
                        else:
                            transport = jid.split('.')[0]
                        if transport in TRANSPORTS:
                            icon = self.transport_icons[transport][status]
                        else:
                            icon = self.icons[status]
                        if buddy['name'] != '':
                            results += [GajimMatch(name=name, jid=jid, icon=icon, interface=self.interface)]
                        else:
                            results += [GajimMatch(name=jid.split('@')[0], jid=jid, icon=icon, interface=self.interface)]
            self._emit_query_ready(query, results)
        except:
            print sys.exc_info()
            return []
示例#11
0
 def __init__(self, parent):
     dialog = gtk.Dialog.__init__(self, _("Wikipedia Suggest settings"), parent,
                     gtk.DIALOG_DESTROY_WITH_PARENT,
                     (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                      gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
     vbox = gtk.VBox(spacing=6)
     self.vbox.pack_start(vbox)
     
     label = gtk.Label( _("Choose the language you want to use or enter the code of your language manually"))
     label.set_line_wrap(True)
     vbox.pack_start(label)
     
     hbox = gtk.HBox(spacing=6)
     vbox.pack_start(hbox)
     
     langstore = gtk.ListStore (str, str)
     for l in LANGUAGES:
         langstore.append(l)
     combobox = gtk.ComboBox(langstore)
     combobox.connect("changed", self._on_combobox_changed)
     cell = gtk.CellRendererText()
     combobox.pack_start(cell)
     combobox.add_attribute(cell, 'text', 0)
     combobox.show()
     hbox.pack_start(combobox)
     
     self.entry = gtk.Entry()
     self.entry.set_width_chars(2)
     hbox.pack_start(self.entry, False, False, 0)
     vbox.show_all()
     
     self._mateconf = GconfStore.get_instance().get_client()
     lang = self._mateconf.get_string(MATECONF_KEY)
     if lang != None:
         self.entry.set_text (lang)
示例#12
0
    def __init__(self, modules_dir):
        super(CoreImpl, self).__init__()

        self._loaded_modules = 0
        self._inited_modules = 0
        self._start_query_id = 0
        self._last_query = None
        self._stop_queries = True

        self._threadpool = ThreadPool(5)
        self._mateconf = GconfStore.get_instance()
        self._history = DeskbarHistory.get_instance(
            self._mateconf.get_max_history_items())
        self._mateconf.connect(
            "max-history-items-changed",
            lambda s, num: self._history.set_max_history_items(num))

        self._setup_module_loader(modules_dir)
        self._setup_module_list()

        self._disabled_module_list = DisabledModuleList()
        self._module_loader.connect("module-not-initialized",
                                    self._disabled_module_list.add)

        self._module_installer = ModuleInstaller(self._module_loader)

        self._mateconf.connect("default-browser-changed",
                               self._on_default_browser_changed)
        #prevent double notifications
        self.browser = None
示例#13
0
    def __init__(self, parent):
        gtk.Dialog.__init__(self,
                            title=_("Configure Yahoo!"),
                            parent=parent,
                            flags=gtk.DIALOG_MODAL
                            | gtk.DIALOG_DESTROY_WITH_PARENT,
                            buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK))

        self.vbox2 = gtk.VBox(spacing=6)
        self.vbox2.show()
        self.vbox.pack_start(self.vbox2)

        self.label = gtk.Label()
        self.label.set_markup(
            _("<b>Choose the language the results should be in:</b>"))
        self.label.show()
        self.vbox2.pack_start(self.label, False)

        self.liststore = gtk.ListStore(str, str)
        for lang in LANGUAGES:
            self.liststore.append(lang)

        self.combobox = gtk.ComboBox(self.liststore)
        self.combobox.connect("changed", self._on_combobox_changed)
        cell = gtk.CellRendererText()
        self.combobox.pack_start(cell)
        self.combobox.add_attribute(cell, 'text', 0)
        self.combobox.show()
        self.vbox2.pack_start(self.combobox, False, False, 0)

        lang = GconfStore.get_instance().get_client().get_string(
            MATECONF_YAHOO_LANG)
        if lang != None:
            self._select_lang(lang)
示例#14
0
 def __init__(self, parent):
     gtk.Dialog.__init__(self, title=_("Configure Yahoo!"),
                         parent=parent,
                         flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                         buttons = (gtk.STOCK_OK, gtk.RESPONSE_OK))
     
     self.vbox2 = gtk.VBox(spacing=6)
     self.vbox2.show()
     self.vbox.pack_start(self.vbox2)
     
     self.label = gtk.Label()
     self.label.set_markup(_("<b>Choose the language the results should be in:</b>"))
     self.label.show()
     self.vbox2.pack_start(self.label, False)
     
     self.liststore = gtk.ListStore(str, str)
     for lang in LANGUAGES:
         self.liststore.append( lang )
             
     self.combobox = gtk.ComboBox(self.liststore)
     self.combobox.connect("changed", self._on_combobox_changed)
     cell = gtk.CellRendererText()
     self.combobox.pack_start(cell)
     self.combobox.add_attribute(cell, 'text', 0)
     self.combobox.show()
     self.vbox2.pack_start(self.combobox, False, False, 0)
     
     lang = GconfStore.get_instance().get_client().get_string(MATECONF_YAHOO_LANG)
     if lang != None:
         self._select_lang(lang)
 def __init__(self):
     deskbar.interfaces.Module.__init__(self)
     self.server = None
     self._lang = None
     self._mateconf = GconfStore.get_instance().get_client()
     self._mateconf.notify_add(MATECONF_GOOGLE_LANG, self._on_language_changed)
     self._set_lang()
示例#16
0
 def __init__(self, modules_dir):
     super(CoreImpl, self).__init__()
     
     self._loaded_modules = 0
     self._inited_modules = 0
     self._start_query_id = 0
     self._last_query = None
     self._stop_queries = True
     
     self._threadpool = ThreadPool(5)
     self._mateconf = GconfStore.get_instance()
     self._history = DeskbarHistory.get_instance(self._mateconf.get_max_history_items())
     self._mateconf.connect("max-history-items-changed", lambda s, num: self._history.set_max_history_items(num))
     
     self._setup_module_loader(modules_dir)
     self._setup_module_list()
     
     self._disabled_module_list = DisabledModuleList()
     self._module_loader.connect ("module-not-initialized", self._disabled_module_list.add)
     
     self._module_installer = ModuleInstaller(self._module_loader)
     
     self._mateconf.connect("default-browser-changed", self._on_default_browser_changed)
     #prevent double notifications
     self.browser = None
示例#17
0
 def __init__(self, parent):
     dialog = gtk.Dialog.__init__(self, _("Wikipedia Suggest settings"), parent,
                     gtk.DIALOG_DESTROY_WITH_PARENT,
                     (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                      gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
     vbox = gtk.VBox(spacing=6)
     self.vbox.pack_start(vbox)
     
     label = gtk.Label( _("Choose the language you want to use or enter the code of your language manually"))
     label.set_line_wrap(True)
     vbox.pack_start(label)
     
     hbox = gtk.HBox(spacing=6)
     vbox.pack_start(hbox)
     
     langstore = gtk.ListStore (str, str)
     for l in LANGUAGES:
         langstore.append(l)
     combobox = gtk.ComboBox(langstore)
     combobox.connect("changed", self._on_combobox_changed)
     cell = gtk.CellRendererText()
     combobox.pack_start(cell)
     combobox.add_attribute(cell, 'text', 0)
     combobox.show()
     hbox.pack_start(combobox)
     
     self.entry = gtk.Entry()
     self.entry.set_width_chars(2)
     hbox.pack_start(self.entry, False, False, 0)
     vbox.show_all()
     
     self._gconf = GconfStore.get_instance().get_client()
     lang = self._gconf.get_string(GCONF_KEY)
     if lang != None:
         self.entry.set_text (lang)
示例#18
0
    def __init__(self, controller, model, widget, applet):
        AbstractCuemiacView.__init__(self, controller, model)
        CuemiacAlignedWindow.__init__(self, widget, applet)
        self._controller.register_view(self)
        self.applet = applet

        GconfStore.get_instance().connect(
            "entry-width-changed", lambda s, w: self._change_entry_width(w))

        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_MENU)
        self.applet.set_applet_flags(mateapplet.EXPAND_MINOR)
        self.applet.set_flags(gtk.CAN_FOCUS)
        self.applet.connect("change-orient", self._on_change_orient)

        self._screen_height = self.get_screen().get_height()
        self._screen_width = self.get_screen().get_width()
        self._max_window_height = int(0.8 * self._screen_height)
        self._max_window_width = int(0.6 * self._screen_width)

        self.connect("delete-event", self._controller.on_quit)
        self.connect("destroy-event", self._controller.on_quit)
        self.connect("focus-out-event", self._controller.on_quit)
        self.connect("key-press-event", self.__on_window_key_press_event)

        self.set_title("Deskbar Applet")
        self.set_default_size(self._model.get_window_width(), -1)

        self.set_role("deskbar-search-window")

        entry_width = self._model.get_entry_width()
        # Account for previous default entry width of 20
        if entry_width == 20:
            entry_width = 40
            self._model.set_entry_width(entry_width)
        self._change_entry_width(entry_width)

        # VBox
        self.add(self.vbox_main)

        # Results
        self.results_box = gtk.HBox()
        self.results_box.pack_start(self.scrolled_results)
        self.results_box.pack_start(self.actions_box)

        self.__set_layout_by_orientation(self.applet.get_orient())
        self.resize(*self.size_request())
    def __init__(self, controller, model, widget, applet):
        AbstractCuemiacView.__init__(self, controller, model)
        CuemiacAlignedWindow.__init__(self, widget, applet)
        self._controller.register_view(self)
        self.applet = applet
        
        GconfStore.get_instance().connect("entry-width-changed",
                                          lambda s, w: self._change_entry_width(w))
        
        self.set_type_hint (gtk.gdk.WINDOW_TYPE_HINT_MENU)
        self.applet.set_applet_flags(mateapplet.EXPAND_MINOR)
        self.applet.set_flags(gtk.CAN_FOCUS)
        self.applet.connect("change-orient", self._on_change_orient)
        
        self._screen_height = self.get_screen().get_height ()
        self._screen_width = self.get_screen().get_width ()
        self._max_window_height = int (0.8 * self._screen_height)
        self._max_window_width = int (0.6 * self._screen_width)
        
        self.connect("delete-event", self._controller.on_quit)
        self.connect("destroy-event", self._controller.on_quit)
        self.connect("focus-out-event", self._controller.on_quit)
        self.connect("key-press-event", self.__on_window_key_press_event)
       
        self.set_title("Deskbar Applet")
        self.set_default_size( self._model.get_window_width(), -1 )

        self.set_role("deskbar-search-window")
        
        entry_width = self._model.get_entry_width()
        # Account for previous default entry width of 20
        if entry_width == 20:
            entry_width = 40
            self._model.set_entry_width(entry_width)
        self._change_entry_width(entry_width)
        
        # VBox
        self.add(self.vbox_main)
        
        # Results
        self.results_box = gtk.HBox()
        self.results_box.pack_start(self.scrolled_results)
        self.results_box.pack_start(self.actions_box)
        
        self.__set_layout_by_orientation(self.applet.get_orient())
        self.resize( *self.size_request() )
示例#20
0
 def has_requirements():
     #We need user and password
     if not GconfStore.get_instance().get_client().get_string(GCONF_TWITTER_USER) or not GconfStore.get_instance().get_client().get_string(GCONF_TWITTER_PASSWORD):
         TwitterHandler.INSTRUCTIONS = _("You need to configure your Twitter account.")
         return True
     else:
         TwitterHandler.INSTRUCTIONS = _("You can modify your Twitter account.")
         return True
示例#21
0
 def __init__(self):
     deskbar.interfaces.Module.__init__(self)
     self.server = None
     self._lang = None
     self._mateconf = GconfStore.get_instance().get_client()
     self._mateconf.notify_add(MATECONF_GOOGLE_LANG,
                               self._on_language_changed)
     self._set_lang()
示例#22
0
 def __init__(self):
     deskbar.interfaces.Module.__init__(self)
     self.server = None
     self._lang = None
     self._format_regex = re.compile("format:(\w+)")
     self._mateconf = GconfStore.get_instance().get_client()
     self._mateconf.notify_add(MATECONF_YAHOO_LANG, self._on_language_changed)
     self._set_lang()
    def _setup_view (self, core, window_type):
        # Select the view based on user choice. CuemiacWindowView is
        # the new style UI,
        # CuemiacAlignedView is the older UI as seen in the
        # Deskbar gnome-2-18 branch.
        if window_type == deskbar.WINDOW_UI_NAME:
            self.create_window_ui()
        else:
            # We need to use an AlignedWindow, which needs a Widget (self.image
            # in this case) and the applet (self.applet)
            self.create_button_ui()

        self._view.set_sensitive(False)
        
        # we want to update active when the window is closed
        self._view.get_toplevel().connect("notify::visible", self.__on_toplevel_visible_notify)
        
        GconfStore.get_instance().connect("ui-name-changed", self._on_ui_name_changed)
示例#24
0
文件: Utils.py 项目: johnsonc/swarm
def get_proxy():
    # TODO: Very dirty, should use CoreImpl class
    deskbarapplet = GconfStore.get_instance()
    if deskbarapplet.get_use_http_proxy():
        proxy_string = "http://%s:%d/" % (deskbarapplet.get_proxy_host(), deskbarapplet.get_proxy_port())
        proxies = {'http' : proxy_string}
        return proxies
    else:
        return None
示例#25
0
 def __init__(self):
     deskbar.interfaces.Module.__init__(self)
     self.server = None
     self._lang = None
     self._format_regex = re.compile("format:(\w+)")
     self._mateconf = GconfStore.get_instance().get_client()
     self._mateconf.notify_add(MATECONF_YAHOO_LANG,
                               self._on_language_changed)
     self._set_lang()
示例#26
0
def get_proxy():
    # TODO: Very dirty, should use CoreImpl class
    deskbarapplet = GconfStore.get_instance()
    if deskbarapplet.get_use_http_proxy():
        proxy_string = "http://%s:%d/" % (deskbarapplet.get_proxy_host(),
                                          deskbarapplet.get_proxy_port())
        proxies = {'http': proxy_string}
        return proxies
    else:
        return None
示例#27
0
 def activate(self, text=None):
     exe = GconfStore.get_instance().get_client().get_string("/desktop/mate/url-handlers/mailto/command")
     exe = exe.replace(" %s", "") 
     if "thunderbird" in exe:
         cmd = ["--compose", "attachment=%s" % self._uri]
     else:
         # RFC 2368 mailto URI
         cmd = ["mailto:?attach=%s" % self._file]
     
     spawn_async([exe] + cmd)
示例#28
0
 def activate(self, text=None):
     exe = GconfStore.get_instance().get_client().get_string("/desktop/gnome/url-handlers/mailto/command")
     exe = exe.replace(" %s", "") 
     if "thunderbird" in exe:
         cmd = ["--compose", "attachment=%s" % self._uri]
     else:
         # RFC 2368 mailto URI
         cmd = ["mailto:?attach=%s" % self._file]
     
     spawn_async([exe] + cmd)
示例#29
0
    def _setup_view(self, core, window_type):
        # Select the view based on user choice. CuemiacWindowView is
        # the new style UI,
        # CuemiacAlignedView is the older UI as seen in the
        # Deskbar mate-2-18 branch.
        if window_type == deskbar.WINDOW_UI_NAME:
            self.create_window_ui()
        else:
            # We need to use an AlignedWindow, which needs a Widget (self.image
            # in this case) and the applet (self.applet)
            self.create_button_ui()

        self._view.set_sensitive(False)

        # we want to update active when the window is closed
        self._view.get_toplevel().connect("notify::visible",
                                          self.__on_toplevel_visible_notify)

        GconfStore.get_instance().connect("ui-name-changed",
                                          self._on_ui_name_changed)
示例#30
0
    def show_config(self, parent):
        dialog = gtk.Dialog(_('Gajim Configuration'), parent,
                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                    gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        dialog.set_geometry_hints(min_width=250, min_height=100)
        table = gtk.Table(rows=1, columns=1)
        show_offline = gtk.CheckButton('Show offline contacts')
        show_offline.set_mode(True)
        t = GconfStore.get_instance().get_client().get_bool(GCONF_GAJIM_SHOWOFFLINE)
        if t != None:
            show_offline.set_active(t)

        table.attach(show_offline, 1, 2, 1, 2)   
        table.show_all()
        dialog.vbox.add(table) 
        response = dialog.run()
        if response == gtk.RESPONSE_ACCEPT:
            GconfStore.get_instance().get_client().set_bool(GCONF_GAJIM_SHOWOFFLINE, show_offline.get_active())
        dialog.destroy()
示例#31
0
 def has_requirements():
     #We need user and password
     if not GconfStore.get_instance().get_client().get_string(MATECONF_DELICIOUS_USER):
         DeliciousHandler.INSTRUCTIONS = _("You need to configure your del.icio.us account.")
         # TODO
         #_on_config_account()
         return True
     else:
         DeliciousHandler.INSTRUCTIONS = _("You can modify your del.icio.us account.")
         # TODO
         #_on_config_account()
         return True
示例#32
0
    def show_config(self, parent):
        dialog = gtk.Dialog(_("Twitter Account"), parent,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                             gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        table = gtk.Table(rows=3, columns=2)

        table.attach(gtk.Label(_("Enter your Twitter account information")), 0, 2, 0, 1)

        user_entry = gtk.Entry()
        u = GconfStore.get_instance().get_client().get_string(GCONF_TWITTER_USER)
        if u != None:
            user_entry.set_text(u)
        table.attach(gtk.Label(_("Username: "******"Password: ")), 0, 1, 2, 3)
        table.attach(password_entry, 1, 2, 2, 3)
        table.show_all()
        dialog.vbox.add(table)

        response = dialog.run()
        dialog.destroy()

        if response == gtk.RESPONSE_ACCEPT:
            GconfStore.get_instance().get_client().set_string(GCONF_TWITTER_USER, user_entry.get_text())
            GconfStore.get_instance().get_client().set_string(GCONF_TWITTER_PASSWORD, password_entry.get_text())
示例#33
0
 def has_requirements():
     #We need user and password
     if not GconfStore.get_instance().get_client().get_string(
             MATECONF_DELICIOUS_USER):
         DeliciousHandler.INSTRUCTIONS = _(
             "You need to configure your del.icio.us account.")
         # TODO
         #_on_config_account()
         return True
     else:
         DeliciousHandler.INSTRUCTIONS = _(
             "You can modify your del.icio.us account.")
         # TODO
         #_on_config_account()
         return True
示例#34
0
 def __init__(self):
     deskbar.interfaces.Module.__init__(self)
     self._lang = None
     self._gconf = GconfStore.get_instance().get_client()
     self._gconf.notify_add(GCONF_KEY, self._on_language_changed)
     self._set_lang()
示例#35
0
 def _on_combobox_changed(self, combobox):
     lang = combobox.get_model()[combobox.get_active_iter()][1]
     GconfStore.get_instance().get_client().set_string(
         MATECONF_YAHOO_LANG, lang)
示例#36
0
 def _on_combobox_changed(self, combobox):
     lang = combobox.get_model()[combobox.get_active_iter()][1]
     GconfStore.get_instance().get_client().set_string(MATECONF_YAHOO_LANG, lang)
示例#37
0
 def __init__(self):
     self.gconf_client = GconfStore.get_instance().get_client()
示例#38
0
文件: mozilla.py 项目: johnsonc/swarm
    
    if version != None:
        # Convert to integers
        version = [int(i) for i in version.split(".")]
        # List must have 4 elements
        if len(version) < 4:
            while (len(version) < 4):
                version.append(0)
        return version
    else:
        return None

# Whether we offer all of the browser's search engines, or only the primary
# one (since by default Firefox seems to come with at least half a dozen)            
GCONF_SHOW_ONLY_PRIMARY_KEY = GconfStore.GCONF_DIR + "/mozilla/show_only_primary_search"
SHOW_ONLY_PRIMARY = GconfStore.get_instance().get_client().get_bool(GCONF_SHOW_ONLY_PRIMARY_KEY)
if SHOW_ONLY_PRIMARY == None:
    SHOW_ONLY_PRIMARY = False
def _on_gconf_show_only_primary(value):
    global SHOW_ONLY_PRIMARY
    SHOW_ONLY_PRIMARY = value
GconfStore.get_instance().get_client().notify_add(GCONF_SHOW_ONLY_PRIMARY_KEY, lambda x, y, z, a: _on_gconf_show_only_primary(z.value.get_bool()))

# TODO re-load PRIMARY_SEARCH_ENGINE everytime it changes (which should happen
# only rarely).  One (unavoidable) problem may be that firefox doesn't actually
# save the change to disk until you quit firefox.

# Google is the default search engine 
PRIMARY_SEARCH_ENGINE = "Google"
try:
    if USING_FIREFOX:
示例#39
0
 def toggled_cb(sender, show_all_radio, show_primary_radio):
     GconfStore.get_instance().get_client().set_bool(
         MATECONF_SHOW_ONLY_PRIMARY_KEY, show_primary_radio.get_active())
示例#40
0
文件: mozilla.py 项目: johnsonc/swarm
 def toggled_cb(sender, show_all_radio, show_primary_radio):
     GconfStore.get_instance().get_client().set_bool(GCONF_SHOW_ONLY_PRIMARY_KEY, show_primary_radio.get_active())
示例#41
0
    if version != None:
        # Convert to integers
        version = [int(i) for i in version.split(".")]
        # List must have 4 elements
        if len(version) < 4:
            while (len(version) < 4):
                version.append(0)
        return version
    else:
        return None


# Whether we offer all of the browser's search engines, or only the primary
# one (since by default Firefox seems to come with at least half a dozen)
MATECONF_SHOW_ONLY_PRIMARY_KEY = GconfStore.MATECONF_DIR + "/mozilla/show_only_primary_search"
SHOW_ONLY_PRIMARY = GconfStore.get_instance().get_client().get_bool(
    MATECONF_SHOW_ONLY_PRIMARY_KEY)
if SHOW_ONLY_PRIMARY == None:
    SHOW_ONLY_PRIMARY = False


def _on_mateconf_show_only_primary(value):
    global SHOW_ONLY_PRIMARY
    SHOW_ONLY_PRIMARY = value


GconfStore.get_instance().get_client().notify_add(
    MATECONF_SHOW_ONLY_PRIMARY_KEY,
    lambda x, y, z, a: _on_mateconf_show_only_primary(z.value.get_bool()))

# TODO re-load PRIMARY_SEARCH_ENGINE everytime it changes (which should happen
# only rarely).  One (unavoidable) problem may be that firefox doesn't actually