[roster_tweaks] Remove plugin

This commit is contained in:
Daniel Brötzmann
2020-04-29 21:38:52 +02:00
parent 2b9dd86dba
commit 08ed95446c
5 changed files with 0 additions and 383 deletions

View File

@@ -1 +0,0 @@
from .roster_tweaks import RosterTweaksPlugin

View File

@@ -1,147 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="roster_tweaks_config_vbox">
<property name="visible">True</property>
<property name="can_focus">False</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="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_hide_combo_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</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="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_use_ctr_m_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="quick_status">
<property name="label" translatable="yes">Show quick-change status field</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_quick_status_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="contact_status_subs">
<property name="label" translatable="yes">Always show contacts status substrings</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_contact_status_subs_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="window2">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkEntry" id="status_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="key-press-event" handler="status_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<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" swapped="no"/>
<child>
<object class="GtkImage" id="activity_image">
<property name="visible">True</property>
<property name="can_focus">False</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" swapped="no"/>
<child>
<object class="GtkImage" id="mood_image">
<property name="visible">True</property>
<property name="can_focus">False</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>

View File

@@ -1,10 +0,0 @@
[info]
name: Roster Tweaks
short_name: roster_tweaks
version: 1.3.0
description: Allows the user to tweak contact list appearance (e.g. make it compact).
Added ability to quickly change the status message to all connected accounts.
authors = Denis Fomin <fominde@gmail.com>
homepage = https://dev.gajim.org/gajim/gajim-plugins/wikis/RosterTweaksPlugin
min_gajim_version: 1.2.91
max_gajim_version: 1.3.90

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -1,225 +0,0 @@
from gi.repository import Pango
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from gajim.common import app, ged, helpers
from gajim.plugins import GajimPlugin
from gajim.plugins.gui import GajimPluginConfigDialog
from gajim.dialogs import ChangeActivityDialog, ChangeMoodDialog
from gajim import gtkgui_helpers
from gajim.plugins.plugins_i18n import _
class RosterTweaksPlugin(GajimPlugin):
def init(self):
self.description = _(
'Allows user to tweak roster window appearance '
'(eg. make it compact).')
self.config_default_values = {'hide_status_combo': (False, ''),
'use_ctr_m': (False, ''),
'menu_visible': (True, ''),
'quick_status': (False, ''),
'contact_status_subs': (False, ''), }
self.events_handlers = {'our-show': (ged.GUI2, self.our_show),
'pep-received': (ged.GUI2, self.pep_received)}
self.gui_extension_points = {
'roster_draw_contact': (self.roster_draw_contact,
self.disconnect_roster_draw_contact), }
self.roster = app.interface.roster
self.config_dialog = RosterTweaksPluginConfigDialog(self)
def roster_draw_contact(self, roster, jid, account, contact):
self.connected = True
if not self.active:
return
if not self.config['contact_status_subs']:
return
child_iters = roster._get_contact_iter(
jid, account, contact, roster.model)
if not child_iters:
return
name = roster.model[child_iters[0]][1]
if '\n<span ' not in name:
roster.model[child_iters[0]][1] = name + '\n'
def disconnect_roster_draw_contact(self, *args):
if self.connected:
self.roster.setup_and_draw_roster()
self.connected = False
def pep_received(self, obj):
if obj.jid != app.get_jid_from_account(obj.conn.name):
return
pep_dict = app.connections[obj.conn.name].pep
if obj.pep_type == 'mood':
img = self.xml.get_object('mood_image')
if 'mood' in pep_dict:
pixbuf = gtkgui_helpers.get_pep_as_pixbuf(pep_dict['mood'])
img.set_from_pixbuf(pixbuf)
else:
img.set_from_stock('gtk-stop', Gtk.IconSize.MENU)
if obj.pep_type == 'activity':
img = self.xml.get_object('activity_image')
if 'activity' in pep_dict:
pb = gtkgui_helpers.get_pep_as_pixbuf(pep_dict['activity'])
img.set_from_pixbuf(pb)
else:
img.set_from_stock('gtk-stop', Gtk.IconSize.MENU)
def our_show(self, *args):
if self.active:
if helpers.get_global_show() != app.SHOW_LIST[0]:
self.status_widget.set_text(helpers.get_global_status())
else:
self.status_widget.set_text('')
def activate(self):
self.pep_dict = {}
self.roster.status_combobox.set_property('visible', not self.config[
'hide_status_combo'])
self.roster.status_combobox.set_no_show_all(True)
self.enable_ctrl_m()
vbox = self.roster.xml.get_object('roster_vbox2')
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.font_desc = self.status_widget.get_pango_context(
).get_font_description()
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, True, 0)
self.xml.connect_signals(self)
self.roster.setup_and_draw_roster()
def enable_ctrl_m(self):
if self.config['use_ctr_m']:
window = self.roster.window
self.accel_group = Gtk.accel_groups_from_object(window)[0]
self.accel_group.connect(Gdk.KEY_m,
Gdk.ModifierType.CONTROL_MASK,
Gtk.AccelFlags.MASK,
self.on_ctrl_m)
self.config['menu_visible'] = not self.config['menu_visible']
self.on_ctrl_m()
def deactivate(self):
self.roster.status_combobox.show()
self.status_widget.destroy()
self.activity_button.destroy()
self.mood_button.destroy()
self.roster.window.set_show_menubar(True)
def on_ctrl_m(self, *args):
self.roster.window.set_show_menubar(self.config['menu_visible'])
self.config['menu_visible'] = not self.config['menu_visible']
return True
def status_changed(self, widget, event):
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter):
accounts = app.connections.keys()
message = widget.get_text()
for account in accounts:
if not app.account_is_connected(account):
continue
current_show = app.SHOW_LIST[
app.connections[account].connected]
self.roster.send_status(account, current_show, message)
self.font_desc.set_weight(Pango.Weight.BOLD)
widget.modify_font(self.font_desc)
self.font_desc.set_weight(Pango.Weight.NORMAL)
GLib.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.send_pep()
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.send_pep()
ChangeMoodDialog(on_response,
self.pep_dict.get('mood', None),
self.pep_dict.get('mood_text', None))
def send_pep(self):
accounts = app.connections.keys()
for account in accounts:
if app.account_is_connected(account):
self.roster.send_pep(account, self.pep_dict)
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('gajim_plugins')
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.get_child().pack_start(self.config_vbox, True, True, 0)
self.hide_combo = self.xml.get_object('hide_combo')
self.use_ctr_m = self.xml.get_object('use_ctr_m')
status_widget = self.xml.get_object('contact_status_subs')
status_widget.set_active(self.plugin.config['contact_status_subs'])
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'])
status_widget = self.xml.get_object('quick_status')
status_widget.set_active(self.plugin.config['quick_status'])
def on_hide_combo_toggled(self, button):
self.plugin.config['hide_status_combo'] = button.get_active()
self.plugin.roster.status_combobox.set_property(
'visible', not self.plugin.config['hide_status_combo'])
def on_quick_status_toggled(self, button):
self.plugin.config['quick_status'] = button.get_active()
if not self.plugin.active:
return
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())
self.plugin.status_widget.set_text(helpers.get_global_status())
def on_use_ctr_m_toggled(self, button):
is_ctr_m_enabled = button.get_active()
self.plugin.config['use_ctr_m'] = is_ctr_m_enabled
if is_ctr_m_enabled:
self.plugin.enable_ctrl_m()
else:
self.plugin.accel_group.disconnect_key(
Gdk.KEY_m, Gdk.ModifierType.CONTROL_MASK)
self.plugin.config['menu_visible'] = True
self.plugin.roster.window.set_show_menubar(True)
def on_contact_status_subs_toggled(self, button):
self.plugin.config['contact_status_subs'] = button.get_active()
if self.plugin.active:
self.plugin.roster.setup_and_draw_roster()