try to use a HigDialog and not a glade dialog for InitationReceivedDialog class

This commit is contained in:
Nikos Kouremenos 2005-08-19 14:24:42 +00:00
parent bf92d33a5f
commit d3af231d5f
2 changed files with 25 additions and 219 deletions

View File

@ -1179,28 +1179,36 @@ class XMLConsoleWindow:
del self.plugin.windows[self.account]['xml_console'] del self.plugin.windows[self.account]['xml_console']
widget.destroy() widget.destroy()
class InvitationDialog: class InvitationReceivedDialog(HigDialog):
def __init__(self, plugin, account, room_jid, contact_jid, password = None, comment = None): def __init__(self, plugin, account, room_jid, contact_jid, password = None, comment = None):
self.plugin = plugin self.plugin = plugin
self.account = account self.account = account
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'invitation_dialog', APP)
self.window = self.xml.get_widget('invitation_dialog')
self.invitation_label = self.xml.get_widget('invitation_label')
#FIXME: add pango markup items = [('inv-deny', _('_Deny'), 0, 0, None),
#DO_NOT_TRANSLATE_4_08 ('inv-accept', ('_Accept'), 0, 0, None)]
string = _('You have been invited to the %s room by %s') % (room_jid, contact_jid)
# use regular stock icons.
aliases = [('inv-deny', gtk.STOCK_CANCEL),
('inv-accept', gtk.STOCK_APPLY),]
gtk.stock_add(items)
factory = gtk.IconFactory()
factory.add_default()
style= window.get_style()
for new_stock, alias in aliases:
icon_set = style.lookup_icon_set(alias)
factory.add(new_stock, icon_set)
# Create the relabeled buttons
btn_deny = gtk.Button(stock = 'inv-deny')
btn_accept = gtk.Button(stock = 'inv-accept')
#FIXME: add pano markup
pritext = _('You have been invited to the %s room by %s') % (room_jid, contact_jid)
if comment is not None: if comment is not None:
#DO_NOT_TRANSLATE_4_08
string += '\n' + _('Comment: %s') % comment string += '\n' + _('Comment: %s') % comment
self.invitation_label.set_text(string) HigDialog.__init__(self, None, pritext, sectext,
gtk.STOCK_DIALOG_WARNING, [ [btn_deny, gtk.RESPONSE_NO],
[ btn_accept, gtk.RESPONSE_YES ] ])
self.window.show_all()
self.xml.signal_autoconnect(self)
def on_accept_button_clicked(self, widget):
pass # FIXME: join room
def on_decline_button_clicked(self, widget):
self.window.destroy()

View File

@ -17770,206 +17770,4 @@ Maybe I'll refactor later</property>
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="invitation_dialog">
<property name="title">Invitation Received</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_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox11">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area10">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="decline_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_decline_button_clicked" last_modification_time="Sun, 14 Aug 2005 23:10:25 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment91">
<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="hbox2993">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1132">
<property name="visible">True</property>
<property name="stock">gtk-cancel</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="label359">
<property name="visible">True</property>
<property name="label">_Decline</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>
<child>
<widget class="GtkButton" id="accept_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-10</property>
<signal name="clicked" handler="on_accept_button_clicked" last_modification_time="Sun, 14 Aug 2005 23:10:35 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment92">
<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="hbox2994">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1133">
<property name="visible">True</property>
<property name="stock">gtk-apply</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="label360">
<property name="visible">True</property>
<property name="label">_Accept</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">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="invitation_label">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</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">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>