add a statusbar to profile window. Fixes #1840
This commit is contained in:
parent
351e666f97
commit
f780a0fe94
|
@ -4,7 +4,6 @@
|
|||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="profile_window">
|
||||
<property name="border_width">12</property>
|
||||
<property name="title">Personal Information</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
|
@ -29,6 +28,7 @@
|
|||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="information_notebook">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
|
@ -1829,6 +1829,7 @@
|
|||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
@ -2017,6 +2018,18 @@
|
|||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkStatusbar" id="statusbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="has_resize_grip">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -61,12 +61,16 @@ class ProfileWindow:
|
|||
self.xml = gtkgui_helpers.get_glade('profile_window.glade')
|
||||
self.window = self.xml.get_widget('profile_window')
|
||||
self.progressbar = self.xml.get_widget('progressbar')
|
||||
self.statusbar = self.xml.get_widget('statusbar')
|
||||
self.context_id = self.statusbar.get_context_id('profile')
|
||||
|
||||
self.account = account
|
||||
self.jid = gajim.get_jid_from_account(account)
|
||||
|
||||
self.avatar_mime_type = None
|
||||
self.avatar_encoded = None
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Retrieving profile...'))
|
||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
||||
self.update_progressbar)
|
||||
|
||||
|
@ -211,6 +215,12 @@ class ProfileWindow:
|
|||
else:
|
||||
self.set_value(i + '_entry', vcard[i])
|
||||
if self.update_progressbar_timeout_id is not None:
|
||||
if self.message_id:
|
||||
self.statusbar.remove(self.context_id, self.message_id)
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Information received'))
|
||||
gobject.timeout_add(3000, self.statusbar.remove, self.context_id,
|
||||
self.message_id)
|
||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
||||
# redraw progressbar after avatar is set so that windows is already
|
||||
# resized. Else progressbar is not correctly redrawn
|
||||
|
@ -289,16 +299,30 @@ class ProfileWindow:
|
|||
nick = gajim.config.get_per('accounts', self.account, 'name')
|
||||
gajim.nicks[self.account] = nick
|
||||
gajim.connections[self.account].send_vcard(vcard)
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Sending profile...'))
|
||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
||||
self.update_progressbar)
|
||||
|
||||
def vcard_published(self):
|
||||
if self.message_id:
|
||||
self.statusbar.remove(self.context_id, self.message_id)
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Information published'))
|
||||
gobject.timeout_add(3000, self.statusbar.remove, self.context_id,
|
||||
self.message_id)
|
||||
if self.update_progressbar_timeout_id is not None:
|
||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
||||
self.progressbar.set_fraction(0)
|
||||
self.update_progressbar_timeout_id = None
|
||||
|
||||
def vcard_not_published(self):
|
||||
if self.message_id:
|
||||
self.statusbar.remove(self.context_id, self.message_id)
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Information NOT published'))
|
||||
gobject.timeout_add(3000, self.statusbar.remove. self.context_id,
|
||||
self.message_id)
|
||||
if self.update_progressbar_timeout_id is not None:
|
||||
gobject.source_remove(self.update_progressbar_timeout_id)
|
||||
self.progressbar.set_fraction(0)
|
||||
|
@ -331,5 +355,7 @@ class ProfileWindow:
|
|||
else:
|
||||
dialogs.ErrorDialog(_('You are not connected to the server'),
|
||||
_('Without a connection, you can not get your contact information.'))
|
||||
self.message_id = self.statusbar.push(self.context_id,
|
||||
_('Retrieving profile...'))
|
||||
self.update_progressbar_timeout_id = gobject.timeout_add(100,
|
||||
self.update_progressbar)
|
||||
|
|
Loading…
Reference in New Issue