Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Biliński <mateusz.bilinski@gmail.com>2008-07-31 19:30:20 +0400
committerMateusz Biliński <mateusz.bilinski@gmail.com>2008-07-31 19:30:20 +0400
commit96cfc420600c67e0466ed143c09c46ba7c1358f2 (patch)
tree0bbc2684a3d0a74e799c08fd2143f27e68bbae2c /plugins
parent8aa9cad2e098bb55e805bbb59ab129e16857eb07 (diff)
Added files with Banner Tweaks plugin (initial version).
Few changes to PluginManager. Added new GUI extension point related to draw_banner in ChatControlBase.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/banner_tweaks/__init__.py2
-rw-r--r--plugins/banner_tweaks/config_dialog.glade73
-rw-r--r--plugins/banner_tweaks/plugin.py135
3 files changed, 210 insertions, 0 deletions
diff --git a/plugins/banner_tweaks/__init__.py b/plugins/banner_tweaks/__init__.py
new file mode 100644
index 000000000..f8266d228
--- /dev/null
+++ b/plugins/banner_tweaks/__init__.py
@@ -0,0 +1,2 @@
+
+from plugin import BannerTweaksPlugin \ No newline at end of file
diff --git a/plugins/banner_tweaks/config_dialog.glade b/plugins/banner_tweaks/config_dialog.glade
new file mode 100644
index 000000000..fd603b1c5
--- /dev/null
+++ b/plugins/banner_tweaks/config_dialog.glade
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Tue Jul 29 23:56:15 2008 -->
+<glade-interface>
+ <widget class="GtkWindow" id="window1">
+ <child>
+ <widget class="GtkVBox" id="banner_tweaks_config_vbox">
+ <property name="visible">True</property>
+ <property name="border_width">9</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton" id="show_banner_image_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, status icon will be displayed in chat window banner.</property>
+ <property name="label" translatable="yes">Display status icon</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_banner_image_checkbutton_toggled"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="show_banner_online_msg_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, status message of contact will be displayed in chat window banner.</property>
+ <property name="label" translatable="yes">Display status message of contact</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_banner_online_msg_checkbutton_toggled"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="show_banner_resource_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, resource name of contact will be displayed in chat window banner.</property>
+ <property name="label" translatable="yes">Display resource name of contact</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_banner_resource_checkbutton_toggled"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="banner_small_fonts_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip" translatable="yes">If checked, smaller font will be used to display resource name and contact name in chat window banner.</property>
+ <property name="label" translatable="yes">Use small fonts for contact name and resource name</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_banner_small_fonts_checkbutton_toggled"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
diff --git a/plugins/banner_tweaks/plugin.py b/plugins/banner_tweaks/plugin.py
new file mode 100644
index 000000000..cecbbb38b
--- /dev/null
+++ b/plugins/banner_tweaks/plugin.py
@@ -0,0 +1,135 @@
+# -*- coding: utf-8 -*-
+
+## This file is part of Gajim.
+##
+## Gajim is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation; version 3 only.
+##
+## Gajim is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+##
+
+'''
+Adjustable chat window banner.
+
+Includes tweaks to make it compact.
+
+Based on patch by pb in ticket #4133:
+http://trac.gajim.org/attachment/ticket/4133/gajim-chatbanneroptions-svn10008.patch
+
+:author: Mateusz Biliński <mateusz@bilinski.it>
+:since: 30 July 2008
+:copyright: Copyright (2008) Mateusz Biliński <mateusz@bilinski.it>
+:license: GPL
+'''
+
+import sys
+
+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 BannerTweaksPlugin(GajimPlugin):
+ name = u'Banner Tweaks'
+ short_name = u'banner_tweaks'
+ version = u'0.1'
+ description = u'''Allows user to tweak chat window banner appearance (eg. make it compact).
+
+Based on patch by pb in ticket #4133:
+http://trac.gajim.org/attachment/ticket/4133'''
+ authors = [u'Mateusz Biliński <mateusz@bilinski.it>']
+ homepage = u'http://blog.bilinski.it'
+
+ @log_calls('BannerTweaksPlugin')
+ def init(self):
+ self.config_dialog = BannerTweaksPluginConfigDialog(self)
+
+ self.gui_extension_points = {
+ 'chat_control_base_draw_banner' : (self.chat_control_base_draw_banner_called,
+ self.chat_control_base_draw_banner_deactivation)
+ }
+
+ self.config_default_values = {'show_banner_image': (True, _('If True, Gajim will display a status icon in the banner of chat windows.')),
+ 'show_banner_online_msg': (True, _('If True, Gajim will display the status message of the contact in the banner of chat windows.')),
+ 'show_banner_resource': (False, _('If True, Gajim will display the resource name of the contact in the banner of chat windows.')),
+ 'banner_small_fonts': (False, _('If True, Gajim will use small fonts for contact name and resource name in the banner of chat windows.')),
+ 'old_chat_avatar_height' : (52, _('chat_avatar_height value before plugin was activated')),
+ }
+
+ def activate(self):
+ self.config['old_chat_avatar_height'] = gajim.config.get('chat_avatar_height')
+ #gajim.config.set('chat_avatar_height', 28)
+
+ def deactivate(self):
+ gajim.config.set('chat_avatar_height', self.config['old_chat_avatar_height'])
+
+ def chat_control_base_draw_banner_called(self, chat_control):
+ if not self.config['show_banner_online_msg']:
+ chat_control.banner_status_label.hide()
+ chat_control.banner_status_label.set_no_show_all(True)
+ status_text = ''
+ chat_control.banner_status_label.set_markup(status_text)
+
+ if not self.config['show_banner_image']:
+ banner_status_img = chat_control.xml.get_widget('banner_status_image')
+ banner_status_img.clear()
+
+ def chat_control_base_draw_banner_deactivation(self, chat_control):
+ pass
+ #chat_control.draw_banner()
+
+ #@log_calls('BannerTweaksPlugin')
+ #def connect_with_chat_control(self, chat_control):
+ #d = {}
+ #banner_status_img = chat_control.xml.get_widget('banner_status_image')
+ #h_id = banner_status_img.connect('state-changed', self.on_banner_status_img_state_changed, chat_control)
+ #d['banner_img_h_id'] = h_id
+
+ #chat_control.banner_tweaks_plugin_data = d
+
+ #@log_calls('BannerTweaksPlugin')
+ #def disconnect_from_chat_control(self, chat_control):
+ #pass
+
+class BannerTweaksPluginConfigDialog(GajimPluginConfigDialog):
+ def init(self):
+ self.GLADE_FILE_PATH = self.plugin.local_file_path('config_dialog.glade')
+ self.xml = gtk.glade.XML(self.GLADE_FILE_PATH, root='banner_tweaks_config_vbox', domain=i18n.APP)
+ self.config_vbox = self.xml.get_widget('banner_tweaks_config_vbox')
+ self.child.pack_start(self.config_vbox)
+
+ self.show_banner_image_checkbutton = self.xml.get_widget('show_banner_image_checkbutton')
+ self.show_banner_online_msg_checkbutton = self.xml.get_widget('show_banner_online_msg_checkbutton')
+ self.show_banner_resource_checkbutton = self.xml.get_widget('show_banner_resource_checkbutton')
+ self.banner_small_fonts_checkbutton = self.xml.get_widget('banner_small_fonts_checkbutton')
+
+ self.xml.signal_autoconnect(self)
+
+ def on_run(self):
+ self.show_banner_image_checkbutton.set_active(self.plugin.config['show_banner_image'])
+ self.show_banner_online_msg_checkbutton.set_active(self.plugin.config['show_banner_online_msg'])
+ self.show_banner_resource_checkbutton.set_active(self.plugin.config['show_banner_resource'])
+ self.banner_small_fonts_checkbutton.set_active(self.plugin.config['banner_small_fonts'])
+
+ def on_show_banner_image_checkbutton_toggled(self, button):
+ self.plugin.config['show_banner_image'] = button.get_active()
+
+ def on_show_banner_online_msg_checkbutton_toggled(self, button):
+ self.plugin.config['show_banner_online_msg'] = button.get_active()
+
+ def on_show_banner_resource_checkbutton_toggled(self, button):
+ self.plugin.config['show_banner_resource'] = button.get_active()
+
+ def on_banner_small_fonts_checkbutton_toggled(self, button):
+ self.plugin.config['banner_small_fonts'] = button.get_active()
+ \ No newline at end of file