[set_location] Add dependency bar

This commit is contained in:
Daniel Brötzmann
2018-10-15 19:23:18 +02:00
parent 39ef5002c3
commit 3b92aaac28
2 changed files with 14 additions and 16 deletions

View File

@@ -18,24 +18,15 @@
<object class="GtkInfoBar" id="dependency_warning">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="message_type">warning</property>
<property name="show_close_button">True</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">You need to install gir1.2-gtkchamplain and gir1.2-gtkclutter-1.0 for the map to work.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
<placeholder/>
</child>
</object>
<packing>
@@ -48,7 +39,16 @@
<object class="GtkBox">
<property name="can_focus">False</property>
<child>
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">You need to install gir1.2-gtkchamplain and gir1.2-gtkclutter-1.0 for the map to work.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>

View File

@@ -35,7 +35,7 @@ try:
GtkClutter.init([]) # Must be initialized before importing those:
from gi.repository import Champlain, GtkChamplain
except:
log.exception('Champlain library not available')
log.exception('To view the map, you have to install all dependencies')
CHAMPLAIN_AVAILABLE = False
@@ -141,13 +141,11 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
map_placeholder = self.xml.get_object('map_placeholder')
dependency_bar = self.xml.get_object('dependency_warning')
dependency_bar.connect("close", lambda b: b.hide())
dependency_bar.connect("response", lambda b,i: b.hide())
if CHAMPLAIN_AVAILABLE and not self.is_active:
map_placeholder.set_no_show_all(True)
map_placeholder.hide()
dependency_bar.set_revealed(False)
dependency_bar.hide()
map_box = self.xml.get_object('map_box')
map_box.set_size_request(400, -1)