publish, retrieve buttons now in glade. and we just hide them if we do not need them

This commit is contained in:
Nikos Kouremenos 2005-07-06 13:05:07 +00:00
parent f9f05f7442
commit 8729b19c8e
2 changed files with 163 additions and 24 deletions

View File

@ -7865,7 +7865,7 @@ Custom</property>
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Set Avatar</property>
<property name="label" translatable="yes">Set _Avatar</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -7936,7 +7936,149 @@ Custom</property>
<widget class="GtkHButtonBox" id="information_hbuttonbox">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">10</property>
<property name="spacing">12</property>
<child>
<widget class="GtkButton" id="publish_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_publish_button_clicked" last_modification_time="Wed, 06 Jul 2005 13:01:41 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment84">
<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="hbox2984">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image879">
<property name="visible">True</property>
<property name="stock">gtk-go-up</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="label348">
<property name="visible">True</property>
<property name="label" translatable="yes">_Publish</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="retrieve_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_retrieve_button_clicked" last_modification_time="Wed, 06 Jul 2005 12:53:55 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment85">
<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="hbox2985">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image880">
<property name="visible">True</property>
<property name="stock">gtk-go-down</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="label349">
<property name="visible">True</property>
<property name="label" translatable="yes">_Retrieve</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="close_button">
@ -11055,7 +11197,7 @@ JID: whatever@jabber.org</property>
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Set Image...</property>
<property name="label" translatable="yes">_Set Image...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>

View File

@ -41,6 +41,12 @@ class VcardWindow:
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'vcard_information_window', APP)
self.window = self.xml.get_widget('vcard_information_window')
self.xml.get_widget('photo_vbuttonbox').set_no_show_all(True)
self.publish_button = self.xml.get_widget('publish_button')
self.retrieve_button = self.xml.get_widget('retrieve_button')
self.publish_button.set_no_show_all(True)
self.retrieve_button.set_no_show_all(True)
self.plugin = plugin
self.user = user #don't use it if vcard is true
self.account = account
@ -50,9 +56,12 @@ class VcardWindow:
if vcard:
self.jid = user
self.change_to_vcard() # remove Jabber Tab so it has vcard-only info
# remove Jabber tab & show publish/retrieve/set_avatar buttons
self.change_to_vcard()
else:
self.jid = user.jid
self.publish_button.hide()
self.retrieve_button.hide()
self.fill_jabber_page()
self.xml.signal_autoconnect(self)
@ -150,9 +159,10 @@ class VcardWindow:
if file:
filesize = os.path.getsize(file) # in bytes
if filesize > 8192:
dialogs.ErrorDialog(_('The filesize of image "%s" is too large') % file,
_('The file must not be more than 8 kilobytes.')).get_response()
if filesize > 8192: # 8 kb
dialogs.ErrorDialog(_('The filesize of image "%s" is too large')\
% file,
_('The file must not be more than 8 kilobytes.')).get_response()
return
fd = open(file)
data = fd.read()
@ -381,23 +391,10 @@ class VcardWindow:
self.xml.get_widget('information_notebook').remove_page(0)
self.xml.get_widget('nickname_label').set_text('Personal details')
information_hbuttonbox = self.xml.get_widget('information_hbuttonbox')
#publish button
button = gtk.Button(stock = gtk.STOCK_GOTO_TOP)
button.get_children()[0].get_children()[0].get_children()[1].set_text(
_('_Publish'))
button.connect('clicked', self.on_publish_button_clicked)
button.show_all()
information_hbuttonbox.pack_start(button)
#retrieve button
button = gtk.Button(stock = gtk.STOCK_GOTO_BOTTOM)
button.get_children()[0].get_children()[0].get_children()[1].set_text(
_('_Retrieve'))
button.connect('clicked', self.on_retrieve_button_clicked)
button.show_all()
information_hbuttonbox.pack_start(button)
#close button at the end
button = self.xml.get_widget('close_button')
information_hbuttonbox.reorder_child(button, 2)
self.publish_button.show()
self.retrieve_button.show()
#photo_vbuttonbox visible
self.xml.get_widget('photo_vbuttonbox').show()