Commit 14460070 authored by Dicson's avatar Dicson

roster_tweaks. initial

parent c820b8b3
......@@ -63,6 +63,7 @@ class ChatstatePlugin(GajimPlugin):
name = '<span foreground="%s">%s</span>' % (
color, name)
if contact.status and gajim.config.get('show_status_msgs_in_roster'):
status = contact.status.strip()
if status != '':
......
from roster_tweaks import RosterTweaksPlugin
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="window1">
<child>
<object class="GtkVBox" id="roster_tweaks_config_vbox">
<property name="visible">True</property>
<property name="border_width">9</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkCheckButton" id="hide_combo">
<property name="label" translatable="yes">Hide status combobox</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, status icon will be displayed in chat window banner.</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_hide_combo_toggled"/>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="use_ctr_m">
<property name="label" translatable="yes">Use Ctrl +M to hide/show menu</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, status message of contact will be displayed in chat window banner.</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_use_ctr_m_toggled"/>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
[info]
name: Roster Tweaks
short_name: roster_tweaks
version: 0.1
description: Allows user to tweak roster window appearance (eg. make it compact).
Based on ticket #3340:
http://trac.gajim.org/ticket/3340.
authors = Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki
# -*- coding: utf-8 -*-
import gtk
from common import i18n
from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log, log_calls
from plugins.gui import GajimPluginConfigDialog
class RosterTweaksPlugin(GajimPlugin):
@log_calls('RosterTweaksPlugin')
def init(self):
self.config_dialog = RosterTweaksPluginConfigDialog(self)
self.config_default_values = {'hide_status_combo': (False,''),
'use_ctr_m': (False,''),
'menu_visible': (True,'')}
@log_calls('RosterTweaksPlugin')
def activate(self):
gajim.interface.roster.status_combobox.set_property('visible',
not self.config['hide_status_combo'])
gajim.interface.roster.status_combobox.set_no_show_all(True)
if self.config['use_ctr_m']:
window = gajim.interface.roster.window
self.accel_group = gtk.accel_groups_from_object(window)[0]
self.accel_group.connect_group(gtk.keysyms.m, gtk.gdk.CONTROL_MASK,
gtk.ACCEL_MASK, self.on_ctrl_m)
menubar = gajim.interface.roster.xml.get_object('menubar')
menubar.set_no_show_all(True)
menubar.set_property('visible', self.config['menu_visible'])
@log_calls('RosterTweaksPlugin')
def deactivate(self):
gajim.interface.roster.status_combobox.show()
def on_ctrl_m(self, accel_group, acceleratable, keyval, modifier):
menubar = gajim.interface.roster.xml.get_object('menubar')
is_visible = menubar.get_property('visible')
menubar.set_property('visible', not is_visible)
self.config['menu_visible'] = not is_visible
return True
class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
'config_dialog.ui')
self.xml = gtk.Builder()
self.xml.set_translation_domain(i18n.APP)
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
['roster_tweaks_config_vbox'])
self.config_vbox = self.xml.get_object('roster_tweaks_config_vbox')
self.child.pack_start(self.config_vbox)
self.hide_combo = self.xml.get_object('hide_combo')
self.use_ctr_m = self.xml.get_object('use_ctr_m')
self.xml.connect_signals(self)
def on_run(self):
self.hide_combo.set_active(self.plugin.config['hide_status_combo'])
self.use_ctr_m.set_active(self.plugin.config['use_ctr_m'])
def on_hide_combo_toggled(self, button):
self.plugin.config['hide_status_combo'] = button.get_active()
gajim.interface.roster.status_combobox.set_property('visible',
not self.plugin.config['hide_status_combo'])
def on_use_ctr_m_toggled(self, button):
use_ = button.get_active()
self.plugin.config['use_ctr_m'] = use_
if use_:
self.plugin.activate()
else:
self.plugin.accel_group.disconnect_key(gtk.keysyms.m,
gtk.gdk.CONTROL_MASK)
self.plugin.config['menu_visible'] = True
gajim.interface.roster.xml.get_object('menubar').set_property(
'visible', True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment