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

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Fomin <fominde@gmail.com>2010-11-15 16:44:07 +0300
committerDenis Fomin <fominde@gmail.com>2010-11-15 16:44:07 +0300
commitba2c7ffc330100d5e7822c775c086acddb39429b (patch)
treef74bb88a29d3938c92f71d47f998c046341dd3e3 /roster_tweaks
parent53493b3b7324962e5f0d2302b0571ad497dfae07 (diff)
roster_tweaks.Added ability to quickly change the activity and mood.
Diffstat (limited to 'roster_tweaks')
-rw-r--r--roster_tweaks/config_dialog.ui60
-rw-r--r--roster_tweaks/manifest.ini2
-rw-r--r--roster_tweaks/roster_tweaks.py77
3 files changed, 135 insertions, 4 deletions
diff --git a/roster_tweaks/config_dialog.ui b/roster_tweaks/config_dialog.ui
index 1d4673f..af1c8b5 100644
--- a/roster_tweaks/config_dialog.ui
+++ b/roster_tweaks/config_dialog.ui
@@ -56,4 +56,64 @@
</object>
</child>
</object>
+ <object class="GtkWindow" id="window2">
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="status_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ <signal name="key_press_event" handler="status_changed"/>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="activity_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <signal name="clicked" handler="on_activity_button_clicked"/>
+ <child>
+ <object class="GtkImage" id="activity_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-stop</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="mood_button">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <signal name="clicked" handler="on_mood_button_clicked"/>
+ <child>
+ <object class="GtkImage" id="mood_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-stop</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
</interface>
diff --git a/roster_tweaks/manifest.ini b/roster_tweaks/manifest.ini
index 2a20e34..53ac20e 100644
--- a/roster_tweaks/manifest.ini
+++ b/roster_tweaks/manifest.ini
@@ -1,7 +1,7 @@
[info]
name: Roster Tweaks
short_name: roster_tweaks
-version: 0.3
+version: 0.4
description: Allows user to tweak roster window appearance (eg. make it compact).
Based on ticket #3340:
http://trac.gajim.org/ticket/3340.
diff --git a/roster_tweaks/roster_tweaks.py b/roster_tweaks/roster_tweaks.py
index 78592c7..05c0dca 100644
--- a/roster_tweaks/roster_tweaks.py
+++ b/roster_tweaks/roster_tweaks.py
@@ -10,6 +10,9 @@ from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log, log_calls
from plugins.gui import GajimPluginConfigDialog
+from dialogs import ChangeActivityDialog, ChangeMoodDialog
+from common import pep
+import gtkgui_helpers
class RosterTweaksPlugin(GajimPlugin):
@@ -24,19 +27,31 @@ class RosterTweaksPlugin(GajimPlugin):
@log_calls('RosterTweaksPlugin')
def activate(self):
+ self.pep_dict = {}
gajim.interface.roster.status_combobox.set_property('visible',
not self.config['hide_status_combo'])
gajim.interface.roster.status_combobox.set_no_show_all(True)
self.enable_ctrl_m()
vbox = gajim.interface.roster.xml.get_object('roster_vbox2')
- self.status_widget = gtk.Entry(max=0)
+ self.GTK_BUILDER_FILE_PATH = self.local_file_path(
+ 'config_dialog.ui')
+ self.xml = gtk.Builder()
+ self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['hbox1'])
+ self.status_widget = self.xml.get_object('status_entry')
self.status_widget.set_property('visible', self.config['quick_status'])
self.status_widget.set_property('no-show-all', True)
- self.status_widget.connect('key-press-event', self.status_changed)
self.font_desc = self.status_widget.get_pango_context(
).get_font_description()
- vbox.pack_start(self.status_widget, False)
+ self.activity_button = self.xml.get_object('activity_button')
+ self.activity_button.set_property('no-show-all', True)
+ self.activity_button.set_property('visible', self.config['quick_status'])
+ self.mood_button = self.xml.get_object('mood_button')
+ self.mood_button.set_property('no-show-all', True)
+ self.mood_button.set_property('visible', self.config['quick_status'])
+ hbox = self.xml.get_object('hbox1')
+ vbox.pack_start(hbox, False)
+ self.xml.connect_signals(self)
def enable_ctrl_m(self):
if self.config['use_ctr_m']:
@@ -80,6 +95,59 @@ class RosterTweaksPlugin(GajimPlugin):
self.font_desc.set_weight(pango.WEIGHT_NORMAL)
gobject.timeout_add(1000, widget.modify_font, self.font_desc)
+ def on_activity_button_clicked(self, widget):
+ def on_response(activity, subactivity, text):
+ self.pep_dict['activity'] = activity or ''
+ self.pep_dict['subactivity'] = subactivity or ''
+ self.pep_dict['activity_text'] = text
+ self.draw_activity()
+ accounts = gajim.connections.keys()
+ for account in accounts:
+ gajim.interface.roster.send_pep(account, self.pep_dict)
+ ChangeActivityDialog(on_response, self.pep_dict.get('activity', None),
+ self.pep_dict.get('subactivity',None),
+ self.pep_dict.get('activity_text', None))
+
+ def on_mood_button_clicked(self, widget):
+ def on_response(mood, text):
+ self.pep_dict['mood'] = mood or ''
+ self.pep_dict['mood_text'] = text
+ self.draw_mood()
+ accounts = gajim.connections.keys()
+ for account in accounts:
+ gajim.interface.roster.send_pep(account, self.pep_dict)
+ ChangeMoodDialog(on_response, self.pep_dict.get('mood', None),
+ self.pep_dict.get('mood_text', None))
+
+ def draw_activity(self):
+ """
+ Set activity button
+ """
+ img = self.xml.get_object('activity_image')
+ if 'activity' in self.pep_dict and self.pep_dict['activity'] in \
+ pep.ACTIVITIES:
+ if 'subactivity' in self.pep_dict and self.pep_dict['subactivity'] \
+ in pep.ACTIVITIES[self.pep_dict['activity']]:
+ img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
+ self.pep_dict['activity'], self.pep_dict['subactivity']).\
+ get_pixbuf())
+ else:
+ img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
+ self.pep_dict['activity']).get_pixbuf())
+ else:
+ img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
+
+ def draw_mood(self):
+ """
+ Set mood button
+ """
+ img = self.xml.get_object('mood_image')
+ if 'mood' in self.pep_dict and self.pep_dict['mood'] in pep.MOODS:
+ img.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
+ self.pep_dict['mood']).get_pixbuf())
+ else:
+ img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
+
class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
@@ -88,6 +156,7 @@ class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
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)
@@ -110,6 +179,8 @@ class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def on_quick_status_toggled(self, button):
self.plugin.config['quick_status'] = button.get_active()
self.plugin.status_widget.set_property('visible', button.get_active())
+ self.plugin.mood_button.set_property('visible', button.get_active())
+ self.plugin.activity_button.set_property('visible', button.get_active())
def on_use_ctr_m_toggled(self, button):
is_ctr_m_enabled = button.get_active()