popup notifications can be handled by preferences now

This commit is contained in:
Nikos Kouremenos 2005-04-16 14:03:35 +00:00
parent 616d8de422
commit 11b86d58f9
3 changed files with 249 additions and 37 deletions

View File

@ -367,10 +367,24 @@ class Preferences_window:
else:
window.show_all()
def on_auto_popup_checkbutton_toggled(self, widget):
def on_notify_on_new_message_radiobutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'notify_on_new_message', \
[self.auto_popup_away_checkbutton])
def on_popup_new_message_radiobutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autopopup', \
[self.auto_popup_away_checkbutton])
def on_only_in_roster_radiobutton_toggled(self, widget):
if widget.get_active():
self.auto_popup_away_checkbutton.set_sensitive(False)
def on_notify_on_online_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'notify_on_online')
def on_notify_on_offline_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'notify_on_offline')
def on_auto_popup_away_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autopopupaway')
@ -626,7 +640,14 @@ class Preferences_window:
self.window = self.xml.get_widget('preferences_window')
self.plugin = plugin
self.iconset_combobox = self.xml.get_widget('iconset_combobox')
self.auto_popup_checkbutton = self.xml.get_widget('auto_popup_checkbutton')
self.notify_on_new_message_radiobutton = self.xml.get_widget \
('notify_on_new_message_radiobutton')
self.popup_new_message_radiobutton = self.xml.get_widget \
('popup_new_message_radiobutton')
self.notify_on_online_checkbutton = self.xml.get_widget \
('notify_on_online_checkbutton')
self.notify_on_offline_checkbutton = self.xml.get_widget \
('notify_on_offline_checkbutton')
self.auto_popup_away_checkbutton = self.xml.get_widget \
('auto_popup_away_checkbutton')
self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton')
@ -756,14 +777,25 @@ class Preferences_window:
self.xml.get_widget('use_emoticons_checkbutton').set_active(st)
self.xml.get_widget('add_remove_emoticons_button').set_sensitive(st)
#notify on new message
st = self.plugin.config['notify_on_new_message']
self.notify_on_new_message_radiobutton.set_active(st)
#autopopup
st = self.plugin.config['autopopup']
self.auto_popup_checkbutton.set_active(st)
self.notify_on_online_checkbutton.set_active(st)
#notify on online statuses
st = self.plugin.config['notify_on_online']
self.notify_on_online_checkbutton.set_active(st)
#notify on offline statuses
st = self.plugin.config['notify_on_offline']
self.notify_on_offline_checkbutton.set_active(st)
#autopopupaway
st = self.plugin.config['autopopupaway']
self.auto_popup_away_checkbutton.set_active(st)
self.auto_popup_away_checkbutton.set_sensitive(self.plugin.config['autopopup'])
#Ignore messages from unknown contacts
self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\

View File

@ -4287,14 +4287,14 @@
<property name="spacing">5</property>
<child>
<widget class="GtkFrame" id="frame25">
<widget class="GtkFrame" id="frame29">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment54">
<widget class="GtkAlignment" id="alignment58">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
@ -4306,24 +4306,128 @@
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox64">
<widget class="GtkVBox" id="vbox67">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="auto_popup_checkbutton">
<widget class="GtkFrame" id="frame25">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will automatically show the new received message in a new chat window or tab in an existing chat window. If not checked, Gajim will notify you for new message via popups in the bottom right of the screen</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Automatically _popup new message</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_auto_popup_checkbutton_toggled" last_modification_time="Wed, 06 Apr 2005 12:46:37 GMT"/>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child>
<widget class="GtkAlignment" id="alignment54">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2949">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkRadioButton" id="notify_on_new_message_radiobutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Gajim will notify you for new message via a popup in the bottom right of the screen</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Notify me about it</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_notify_on_new_message_radiobutton_toggled" last_modification_time="Sat, 16 Apr 2005 11:10:09 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="popup_new_message_radiobutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Gajim will automatically show the new received message in a new chat window or tab in an existing chat window</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Pop it up</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">notify_on_new_message_radiobutton</property>
<signal name="toggled" handler="on_popup_new_message_radiobutton_toggled" last_modification_time="Sat, 16 Apr 2005 10:32:05 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="only_in_roster_radiobutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Gajim will only change the icon of the contact that sent the new message</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show only in _roster</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">notify_on_new_message_radiobutton</property>
<signal name="toggled" handler="on_only_in_roster_radiobutton_toggled" last_modification_time="Sat, 16 Apr 2005 11:24:29 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label233">
<property name="visible">True</property>
<property name="label" translatable="yes">When new chat nessage is received</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -4332,11 +4436,91 @@
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2950">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">5</property>
<child>
<widget class="GtkLabel" id="label241">
<property name="visible">True</property>
<property name="label" translatable="yes">Notify me about contacts going: </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="notify_on_online_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Gajim will notify you via a popup window in the bottom right of the screen about contacts that just went online</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Online</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_notify_on_online_checkbutton_toggled" last_modification_time="Sat, 16 Apr 2005 13:44:52 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="notify_on_offline_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Gajim will notify you via a popup window in the bottom right of the screen about contacts that just went offline</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Of_fline</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_notify_on_offline_checkbutton_toggled" last_modification_time="Sat, 16 Apr 2005 13:44:48 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="auto_popup_away_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Allow automatically popup new message when _away/DND</property>
<property name="label" translatable="yes">Allow popup/notifications even when I'm _away/busy</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -4357,9 +4541,9 @@
</child>
<child>
<widget class="GtkLabel" id="label233">
<widget class="GtkLabel" id="label240">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;When new chat nessage is received&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Notifications&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -4390,7 +4574,7 @@
<widget class="GtkCheckButton" id="ignore_events_from_unknown_contacts_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Ignore events from contacts not in your roster</property>
<property name="label" translatable="yes">_Ignore events from contacts not in the roster</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -4717,7 +4901,7 @@
<widget class="GtkCheckButton" id="auto_away_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Auto _away after</property>
<property name="label" translatable="yes">Auto _away after:</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -4740,7 +4924,7 @@
<widget class="GtkCheckButton" id="auto_xa_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Auto e_Xtended Away after</property>
<property name="label" translatable="yes">Auto e_Xtended Away after:</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -5621,7 +5805,7 @@ Custom</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkAlignment" id="alignment56">

View File

@ -413,15 +413,7 @@ class plugin:
self.play_sound('sound_contact_connected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
not self.config['autopopup']:
#FIXME:
#DOES NOT ALWAYS WORK WHY?
#I control nkour@lagaule in jabber
# have nkour@lagaul in nkour@jabber.org
#go online from psi in lagaule
#gajim doesn't give a shit
# WHY? same with offline
# new message works
self.config['notify_on_online']:
instance = Popup_window(self, 'Contact Online', jid, account)
self.roster.popup_windows.append(instance)
elif old_show > 1 and new_show < 2 and \
@ -429,7 +421,7 @@ class plugin:
self.play_sound('sound_contact_disconnected')
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid) and \
not self.config['autopopup']:
self.config['notify_on_offline']:
instance = Popup_window(self, 'Contact Offline', jid, account)
self.roster.popup_windows.append(instance)
@ -452,7 +444,7 @@ class plugin:
if not self.windows[account]['chats'].has_key(jid) and \
not self.queues[account].has_key(jid):
first = True
if not self.config['autopopup']:
if self.config['notify_on_new_message']:
instance = Popup_window(self, 'New Message', jid, account)
self.roster.popup_windows.append(instance)
self.roster.on_message(jid, array[1], array[2], account)
@ -862,7 +854,11 @@ class plugin:
'MYVCARD', 'OS_INFO', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', 'VISUAL', \
'GC_MSG', 'GC_SUBJECT', 'BAD_PASSPHRASE', 'GPG_SECRETE_KEYS', \
'ROSTER_INFO', 'MSGSENT'])
self.default_config = {'autopopup':0,\
self.default_config = {\
'notify_on_new_message': 1,\
'autopopup':0,\
'notify_on_online': 1,\
'notify_on_offline': 0,\
'autopopupaway':0,\
'ignore_unknown_contacts':0,\
'showoffline':0,\