roster contact context menu now via glade, also has a non working yet menuitem to single message (eg. type=normal and not chat); last but not we now use ImageMenuItem and not hbox + MenuItem to have images where we implement gui on code and not on glade [as we prefer]
This commit is contained in:
parent
c144d980f3
commit
11434df567
Binary file not shown.
Before Width: | Height: | Size: 869 B |
11
src/chat.py
11
src/chat.py
|
@ -233,15 +233,10 @@ class Chat:
|
|||
menu.append(gtk.MenuItem()) # seperator
|
||||
for jid in self.xmls:
|
||||
if jid != self.get_active_jid():
|
||||
#FIXME: do me via glade
|
||||
icon = gtk.image_new_from_stock(gtk.STOCK_JUMP_TO,
|
||||
item = gtk.ImageMenuItem(_('Switch to %s') % self.names[jid])
|
||||
img = gtk.image_new_from_stock(gtk.STOCK_JUMP_TO,
|
||||
gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Switch to %s') % self.names[jid])
|
||||
hbox = gtk.HBox(False, 3)
|
||||
hbox.pack_start(icon, False, False)
|
||||
hbox.pack_start(label, True, True)
|
||||
item = gtk.MenuItem()
|
||||
item.add(hbox)
|
||||
item.set_image(img)
|
||||
item.connect('activate', lambda obj,jid:self.set_active_tab(
|
||||
jid), jid)
|
||||
menu.append(item)
|
||||
|
|
|
@ -649,10 +649,10 @@ class NewMessageDialog:
|
|||
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
||||
gajim.config.get_per('accounts', self.account, 'hostname')
|
||||
if len(gajim.connections) > 1:
|
||||
title = _('New Message as ') + our_jid
|
||||
title = _('New Message as %s') % our_jid
|
||||
else:
|
||||
title = _('New Message')
|
||||
prompt_text = _('Enter the contact ID of the contact you would like\nto send a chat message to:')
|
||||
prompt_text = _('Fill in the contact ID of the contact you would like\nto send a chat message to:')
|
||||
|
||||
instance = InputDialog(title, prompt_text)
|
||||
response = instance.get_response()
|
||||
|
@ -795,3 +795,37 @@ class PopupNotificationWindow:
|
|||
chats_window.set_active_tab(self.jid)
|
||||
chats_window.window.present()
|
||||
self.adjust_height_and_move_popup_notification_windows()
|
||||
|
||||
|
||||
class SendSingleMessageDialog:
|
||||
def __init__(self, plugin, account):
|
||||
self.plugin = plugin
|
||||
self.account = account
|
||||
|
||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'popup_notification_window', APP)
|
||||
self.window = xml.get_widget('popup_notification_window')
|
||||
xml.signal_autoconnect(self)
|
||||
|
||||
our_jid = gajim.config.get_per('accounts', self.account, 'name') + '@' + \
|
||||
gajim.config.get_per('accounts', self.account, 'hostname')
|
||||
|
||||
if len(gajim.connections) > 1:
|
||||
title = _('Send Single Message as %s') % our_jid
|
||||
else:
|
||||
title = _('Send Single Message')
|
||||
self.window.set_title(title)
|
||||
|
||||
instance = InputDialog(title, prompt_text)
|
||||
response = instance.get_response()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
jid = instance.input_entry.get_text()
|
||||
|
||||
if jid.find('@') == -1: # if no @ was given
|
||||
ErrorDialog(_('Invalid contact ID'),
|
||||
_('Contact ID must be of the form "username@servername".')).get_response()
|
||||
return
|
||||
|
||||
self.plugin.roster.new_chat_from_jid(self.account, jid)
|
||||
|
||||
def on_send_button_clicked(self, widget):
|
||||
pass
|
||||
|
|
515
src/gtkgui.glade
515
src/gtkgui.glade
|
@ -15176,4 +15176,519 @@ the Jabber network.</property>
|
|||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkMenu" id="roster_contact_context_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="start_chat_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Start _Chat</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image769">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="send_single_message_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Send Single _Message</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="rename_menuitem">
|
||||
<property name="label" translatable="yes">_Rename</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image770">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="edit_groups_menuitem">
|
||||
<property name="label" translatable="yes">Edit _Groups</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator4">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="assign_openpgp_key_menuitem">
|
||||
<property name="label" translatable="yes">Assign Open_PGP Key</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_assign_openpgp_key_menuitem_activate" last_modification_time="Thu, 30 Jun 2005 22:57:59 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image771">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-authentication</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator5">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="subscription_menuitem">
|
||||
<property name="label" translatable="yes">_Subscription</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image772">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-question</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="subscription_menuitem_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="resend_authorization_to_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Re_send Authorization to</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image773">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="rerequest_authorization_from_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Rere_quest Authorization from</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image774">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-down</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
|
||||
<property name="label" translatable="yes">_Add to Roster</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image775">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="remove_from_roster_menuitem">
|
||||
<property name="label" translatable="yes">_Remove from Roster</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image776">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator6">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="information_menuitem">
|
||||
<property name="label">gtk-dialog-info</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="history_menuitem">
|
||||
<property name="label" translatable="yes">_History</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image777">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-justify-fill</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="send_single_message_window">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes"></property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox97">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table35">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label336">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">To:</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label335">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Subject:</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="count_chars_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="label" translatable="yes">0</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow40">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="message_textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="overwrite">False</property>
|
||||
<property name="accepts_tab">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_NONE</property>
|
||||
<property name="cursor_visible">True</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
<property name="pixels_inside_wrap">0</property>
|
||||
<property name="left_margin">0</property>
|
||||
<property name="right_margin">0</property>
|
||||
<property name="indent">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox26">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="cancel_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Thu, 30 Jun 2005 23:51:17 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="send_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_send_button_clicked" last_modification_time="Thu, 30 Jun 2005 23:51:32 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment79">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2977">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image778">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-ok</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label333">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Send</property>
|
||||
<property name="use_underline">True</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
|
|
@ -567,6 +567,10 @@ class RosterWindow:
|
|||
else:
|
||||
self.plugin.windows['logs'][user.jid] = history_window.\
|
||||
HistoryWindow(self.plugin, user.jid, account)
|
||||
|
||||
def on_send_single_message_menuitem_activate(self, wiget, account, contact):
|
||||
pass
|
||||
#SendSingleMessageDialog
|
||||
|
||||
def mk_menu_user(self, event, iter):
|
||||
'''Make user's popup menu'''
|
||||
|
@ -574,156 +578,73 @@ class RosterWindow:
|
|||
jid = model.get_value(iter, 3)
|
||||
path = model.get_path(iter)
|
||||
account = model.get_value(iter, 4)
|
||||
user = self.contacts[account][jid][0]
|
||||
contact = self.contacts[account][jid][0]
|
||||
|
||||
menu = gtk.Menu()
|
||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_contact_context_menu',
|
||||
APP)
|
||||
roster_contact_context_menu = xml.get_widget(
|
||||
'roster_contact_context_menu')
|
||||
childs = roster_contact_context_menu.get_children()
|
||||
|
||||
start_chat_menuitem = childs[0]
|
||||
send_single_message_menuitem = childs[1]
|
||||
rename_menuitem = childs[2]
|
||||
#skip a seperator
|
||||
edit_groups_menuitem = childs[4]
|
||||
assign_openpgp_key_menuitem = childs[5]
|
||||
#skip a seperator
|
||||
subscription_to_menuitem, subscription_from_menuitem =\
|
||||
childs[7].get_submenu().get_children()
|
||||
add_to_roster_menuitem = childs[8]
|
||||
remove_from_roster_menuitem = childs[9]
|
||||
#skip a seperator
|
||||
information_menuitem = childs[11]
|
||||
history_menuitem = childs[12]
|
||||
|
||||
start_chat_menuitem.connect('activate',
|
||||
self.on_roster_treeview_row_activated, path)
|
||||
send_single_message_menuitem.connect('activate',
|
||||
self.on_send_single_message_menuitem_activate, account, contact)
|
||||
rename_menuitem.connect('activate', self.on_rename, iter, path)
|
||||
remove_from_roster_menuitem.connect('activate', self.on_req_usub,
|
||||
contact, account)
|
||||
information_menuitem.connect('activate', self.on_info, contact,
|
||||
account)
|
||||
history_menuitem.connect('activate', self.on_history, contact,
|
||||
account)
|
||||
|
||||
chat_item = gtk.MenuItem()
|
||||
chat_icon = gtk.Image()
|
||||
chat_icon.set_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Start Chat'))
|
||||
chat_hbox = gtk.HBox(False, 3)
|
||||
chat_hbox.pack_start(chat_icon, False, False)
|
||||
chat_hbox.pack_start(label, False, False)
|
||||
chat_item.add(chat_hbox)
|
||||
menu.append(chat_item)
|
||||
chat_item.connect('activate', self.on_roster_treeview_row_activated, path)
|
||||
if 'not in the roster' not in contact.groups:
|
||||
#contact is in normal group
|
||||
edit_groups_menuitem.set_no_show_all(False)
|
||||
assign_openpgp_key_menuitem.set_no_show_all(False)
|
||||
add_to_roster_menuitem.hide()
|
||||
add_to_roster_menuitem.set_no_show_all(True)
|
||||
edit_groups_menuitem.connect('activate', self.on_edit_groups, contact,
|
||||
account)
|
||||
|
||||
rename_item = gtk.MenuItem()
|
||||
rename_icon = gtk.Image()
|
||||
rename_icon.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Rename'))
|
||||
rename_hbox = gtk.HBox(False, 3)
|
||||
rename_hbox.pack_start(rename_icon, False, False)
|
||||
rename_hbox.pack_start(label, False, False)
|
||||
rename_item.add(rename_hbox)
|
||||
menu.append(rename_item)
|
||||
rename_item.connect('activate', self.on_rename, iter, path)
|
||||
|
||||
if not 'not in the roster' in user.groups:
|
||||
edit_groups_item = gtk.MenuItem()
|
||||
edit_groups_icon = gtk.Image()
|
||||
edit_groups_icon.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Edit Groups'))
|
||||
edit_groups_hbox = gtk.HBox(False, 3)
|
||||
edit_groups_hbox.pack_start(edit_groups_icon, False, False)
|
||||
edit_groups_hbox.pack_start(label, False, False)
|
||||
edit_groups_item.add(edit_groups_hbox)
|
||||
menu.append(edit_groups_item)
|
||||
edit_groups_item.connect('activate', self.on_edit_groups, user, account)
|
||||
|
||||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
if gajim.config.get('usegpg'):
|
||||
assign_openpgp_key_menuitem.connect('activate',
|
||||
self.on_assign_pgp_key, contact, account)
|
||||
|
||||
gpg_key_item = gtk.MenuItem()
|
||||
gpg_key_icon = gtk.Image()
|
||||
gpg_key_icon.set_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Assign OpenPGP Key'))
|
||||
gpg_key_hbox = gtk.HBox(False, 3)
|
||||
gpg_key_hbox.pack_start(gpg_key_icon, False, False)
|
||||
gpg_key_hbox.pack_start(label, False, False)
|
||||
gpg_key_item.add(gpg_key_hbox)
|
||||
menu.append(gpg_key_item)
|
||||
gpg_key_item.connect('activate', self.on_assign_pgp_key, user, account)
|
||||
|
||||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
|
||||
subscription_item = gtk.MenuItem()
|
||||
subscription_icon = gtk.Image()
|
||||
subscription_icon.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Subscription'))
|
||||
subscription_hbox = gtk.HBox(False, 3)
|
||||
subscription_hbox.pack_start(subscription_icon, False, False)
|
||||
subscription_hbox.pack_start(label, False, False)
|
||||
subscription_item.add(subscription_hbox)
|
||||
menu.append(subscription_item)
|
||||
|
||||
sub_menu = gtk.Menu()
|
||||
subscription_item.set_submenu(sub_menu)
|
||||
subscription_to_menuitem.connect('activate', self.authorize, jid,
|
||||
account)
|
||||
subscription_from_menuitem.connect('activate', self.req_sub,
|
||||
jid, _('I would like to add you to my roster'), account)
|
||||
|
||||
resend_auth_item = gtk.MenuItem()
|
||||
resend_auth_icon = gtk.Image()
|
||||
resend_auth_icon.set_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Re_send Authorization to'))
|
||||
label.set_use_underline(True)
|
||||
resend_auth_hbox = gtk.HBox(False, 3)
|
||||
resend_auth_hbox.pack_start(resend_auth_icon, False, False)
|
||||
resend_auth_hbox.pack_start(label, False, False)
|
||||
resend_auth_item.add(resend_auth_hbox)
|
||||
sub_menu.append(resend_auth_item)
|
||||
resend_auth_item.connect('activate', self.authorize, jid, account)
|
||||
else: # contact is in group 'not in the roster'
|
||||
add_to_roster_menuitem.set_no_show_all(False)
|
||||
edit_groups_menuitem.hide()
|
||||
edit_groups_menuitem.set_no_show_all(True)
|
||||
assign_openpgp_key_menuitem.hide()
|
||||
assign_openpgp_key_menuitem.set_no_show_all(True)
|
||||
|
||||
rerequest_auth_item = gtk.MenuItem()
|
||||
rerequest_auth_icon = gtk.Image()
|
||||
rerequest_auth_icon.set_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Rere_quest Authorization from'))
|
||||
label.set_use_underline(True)
|
||||
rerequest_auth_hbox = gtk.HBox(False, 3)
|
||||
rerequest_auth_hbox.pack_start(rerequest_auth_icon, False, False)
|
||||
rerequest_auth_hbox.pack_start(label, False, False)
|
||||
rerequest_auth_item.add(rerequest_auth_hbox)
|
||||
sub_menu.append(rerequest_auth_item)
|
||||
rerequest_auth_item.connect('activate', self.req_sub, jid,
|
||||
_('I would like to add you to my roster'), account)
|
||||
|
||||
else:
|
||||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
add_to_roster_menuitem.connect('activate',
|
||||
self.on_add_to_roster, contact, account)
|
||||
|
||||
add_item = gtk.MenuItem()
|
||||
add_icon = gtk.Image()
|
||||
add_icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('_Add to Roster'))
|
||||
label.set_use_underline(True)
|
||||
add_hbox = gtk.HBox(False, 3)
|
||||
add_hbox.pack_start(add_icon, False, False)
|
||||
add_hbox.pack_start(label, False, False)
|
||||
add_item.add(add_hbox)
|
||||
menu.append(add_item)
|
||||
add_item.connect('activate', self.on_add_to_roster, user, account)
|
||||
|
||||
remove_item = gtk.MenuItem()
|
||||
remove_icon = gtk.Image()
|
||||
remove_icon.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('_Remove from Roster'))
|
||||
label.set_use_underline(True)
|
||||
remove_hbox = gtk.HBox(False, 3)
|
||||
remove_hbox.pack_start(remove_icon, False, False)
|
||||
remove_hbox.pack_start(label, False, False)
|
||||
remove_item.add(remove_hbox)
|
||||
menu.append(remove_item)
|
||||
remove_item.connect('activate', self.on_req_usub, user, account)
|
||||
|
||||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
|
||||
info_item = gtk.MenuItem()
|
||||
info_icon = gtk.Image()
|
||||
info_icon.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('Information'))
|
||||
info_hbox = gtk.HBox(False, 3)
|
||||
info_hbox.pack_start(info_icon, False, False)
|
||||
info_hbox.pack_start(label, False, False)
|
||||
info_item.add(info_hbox)
|
||||
menu.append(info_item)
|
||||
info_item.connect('activate', self.on_info, user, account)
|
||||
|
||||
history_item = gtk.MenuItem()
|
||||
history_icon = gtk.Image()
|
||||
history_icon.set_from_stock(gtk.STOCK_JUSTIFY_FILL, gtk.ICON_SIZE_MENU)
|
||||
label = gtk.Label(_('History'))
|
||||
history_hbox = gtk.HBox(False, 3)
|
||||
history_hbox.pack_start(history_icon, False, False)
|
||||
history_hbox.pack_start(label, False, False)
|
||||
history_item.add(history_hbox)
|
||||
menu.append(history_item)
|
||||
history_item.connect('activate', self.on_history, user, account)
|
||||
|
||||
menu.popup(None, None, None, event.button, event.time)
|
||||
menu.show_all()
|
||||
menu.reposition()
|
||||
roster_contact_context_menu.popup(None, None, None, event.button,
|
||||
event.time)
|
||||
roster_contact_context_menu.show_all()
|
||||
roster_contact_context_menu.reposition()
|
||||
|
||||
def mk_menu_g(self, event, iter):
|
||||
'''Make group's popup menu'''
|
||||
|
|
Loading…
Reference in New Issue