Merge branch 'master' into 'master'

Improvements for HiDPI

See merge request gajim/gajim!203
This commit is contained in:
Philipp Hörist 2018-01-29 18:14:19 +01:00
commit bb9b949fa1
474 changed files with 36354 additions and 294 deletions

View File

@ -630,30 +630,9 @@ class ChatControl(ChatControlBase):
jid = contact.jid
# Set banner image
img_32 = app.interface.roster.get_appropriate_state_images(jid,
size='32', icon_name=show)
img_16 = app.interface.roster.get_appropriate_state_images(jid,
icon_name=show)
if show in img_32 and img_32[show].get_pixbuf():
# we have 32x32! use it!
banner_image = img_32[show]
use_size_32 = True
else:
banner_image = img_16[show]
use_size_32 = False
icon = gtkgui_helpers.get_iconset_name_for(show)
banner_status_img = self.xml.get_object('banner_status_image')
if banner_image.get_storage_type() == Gtk.ImageType.ANIMATION:
banner_status_img.set_from_animation(banner_image.get_animation())
else:
pix = banner_image.get_pixbuf()
if pix is not None:
if use_size_32:
banner_status_img.set_from_pixbuf(pix)
else: # we need to scale 16x16 to 32x32
scaled_pix = pix.scale_simple(32, 32,
GdkPixbuf.InterpType.BILINEAR)
banner_status_img.set_from_pixbuf(scaled_pix)
banner_status_img.set_from_icon_name(icon, Gtk.IconSize.DND)
def draw_banner_text(self):
"""
@ -1040,9 +1019,11 @@ class ChatControl(ChatControlBase):
jid = self.contact.jid
if app.config.get('show_avatar_in_tabs'):
avatar_pixbuf = app.contacts.get_avatar(self.account, jid, size=16)
if avatar_pixbuf is not None:
return avatar_pixbuf
scale = self.parent_win.window.get_scale_factor()
surface = app.contacts.get_avatar(
self.account, jid, AvatarSize.TAB, scale)
if surface is not None:
return surface
if count_unread:
num_unread = len(app.events.get_events(self.account, jid,
@ -1273,18 +1254,19 @@ class ChatControl(ChatControlBase):
if not app.config.get('show_avatar_in_chat'):
return
scale = self.parent_win.window.get_scale_factor()
if self.TYPE_ID == message_control.TYPE_CHAT:
pixbuf = app.contacts.get_avatar(
self.account, self.contact.jid, AvatarSize.CHAT)
surface = app.contacts.get_avatar(
self.account, self.contact.jid, AvatarSize.CHAT, scale)
else:
pixbuf = app.interface.get_avatar(
self.gc_contact.avatar_sha, AvatarSize.CHAT)
surface = app.interface.get_avatar(
self.gc_contact.avatar_sha, AvatarSize.CHAT, scale)
image = self.xml.get_object('avatar_image')
if pixbuf is None:
if surface is None:
image.set_from_icon_name('avatar-default', Gtk.IconSize.DIALOG)
else:
image.set_from_pixbuf(pixbuf)
image.set_from_surface(surface)
def _nec_update_avatar(self, obj):
if obj.account != self.account:

View File

@ -474,17 +474,16 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
return state
def set_encryption_menu_icon(self):
for child in self.encryption_menu.get_children():
if isinstance(child, Gtk.Image):
image = child
break
image = self.encryption_menu.get_image()
if image is None:
image = Gtk.Image()
self.encryption_menu.set_image(image)
if not self.encryption:
icon = gtkgui_helpers.get_icon_pixmap(
'channel-insecure-symbolic', color=[Color.BLACK])
image.set_from_icon_name('channel-insecure-symbolic',
Gtk.IconSize.MENU)
else:
icon = gtkgui_helpers.get_icon_pixmap('channel-secure-symbolic')
image.set_from_pixbuf(icon)
image.set_from_icon_name('channel-secure-symbolic',
Gtk.IconSize.MENU)
def set_speller(self):
if not app.HAVE_SPELL or not app.config.get('use_speller'):

View File

@ -29,6 +29,7 @@ class OptionType(IntEnum):
DIALOG = 4
class AvatarSize(IntEnum):
TAB = 16
ROSTER = 32
CHAT = 48
NOTIFICATION = 48

View File

@ -197,8 +197,8 @@ class GC_Contact(CommonContact):
def get_shown_name(self):
return self.name
def get_avatar(self, size=None):
return common.app.interface.get_avatar(self.avatar_sha, size)
def get_avatar(self, *args, **kwargs):
return common.app.interface.get_avatar(self.avatar_sha, *args, **kwargs)
def as_contact(self):
"""
@ -310,8 +310,8 @@ class LegacyContactsAPI:
def get_contact(self, account, jid, resource=None):
return self._accounts[account].contacts.get_contact(jid, resource=resource)
def get_avatar(self, account, jid, size=None):
return self._accounts[account].contacts.get_avatar(jid, size)
def get_avatar(self, account, *args, **kwargs):
return self._accounts[account].contacts.get_avatar(*args, **kwargs)
def get_avatar_sha(self, account, jid):
return self._accounts[account].contacts.get_avatar_sha(jid)
@ -509,14 +509,15 @@ class Contacts():
return c
return self._contacts[jid][0]
def get_avatar(self, jid, size=None):
def get_avatar(self, jid, size=None, scale=None):
if jid not in self._contacts:
return None
for resource in self._contacts[jid]:
if resource.avatar_sha is None:
continue
avatar = common.app.interface.get_avatar(resource.avatar_sha, size)
avatar = common.app.interface.get_avatar(
resource.avatar_sha, size, scale)
if avatar is None:
self.set_avatar(jid, None)
return avatar

View File

@ -801,11 +801,7 @@ audio-mic-volume-low</property>
<property name="tooltip_text" translatable="yes">Choose an encryption</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">channel-secure-symbolic</property>
</object>
<placeholder/>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>

View File

@ -1,7 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkListStore" id="guests_store">
<columns>
<!-- column-name icon -->
<column type="gchararray"/>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name jid -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -47,15 +57,38 @@ Select the contacts you want to invite</property>
<property name="height_request">300</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">guests_store</property>
<property name="headers_visible">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">4</property>
<property name="position">1</property>

View File

@ -280,11 +280,7 @@
<property name="tooltip_text" translatable="yes">Choose an encryption</property>
<property name="relief">none</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">channel-secure-symbolic</property>
</object>
<placeholder/>
</child>
<style>
<class name="chatcontrol-actionbar-button"/>

View File

@ -3,6 +3,80 @@
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkListStore" id="status_liststore">
<columns>
<!-- column-name statustext -->
<column type="gchararray"/>
<!-- column-name icon-name -->
<column type="gchararray"/>
<!-- column-name show -->
<column type="gchararray"/>
<!-- column-name sensible -->
<column type="gboolean"/>
</columns>
<data>
<row>
<col id="0">online</col>
<col id="1">online</col>
<col id="2">online</col>
<col id="3">True</col>
</row>
<row>
<col id="0">chat</col>
<col id="1">chat</col>
<col id="2">chat</col>
<col id="3">True</col>
</row>
<row>
<col id="0">away</col>
<col id="1">away</col>
<col id="2">away</col>
<col id="3">True</col>
</row>
<row>
<col id="0">xa</col>
<col id="1">xa</col>
<col id="2">xa</col>
<col id="3">True</col>
</row>
<row>
<col id="0">dnd</col>
<col id="1">dnd</col>
<col id="2">dnd</col>
<col id="3">True</col>
</row>
<row>
<col id="0">invisible</col>
<col id="1">invisible</col>
<col id="2">invisible</col>
<col id="3">True</col>
</row>
<row>
<col id="0">SEPARATOR</col>
<col id="1">None</col>
<col id="2">None</col>
<col id="3">True</col>
</row>
<row>
<col id="0" translatable="yes">Change Status Message…</col>
<col id="1">gajim-kbd_input</col>
<col id="2">status</col>
<col id="3">False</col>
</row>
<row>
<col id="0">SEPARATOR</col>
<col id="1">None</col>
<col id="2">None</col>
<col id="3">True</col>
</row>
<row>
<col id="0">offline</col>
<col id="1">offline</col>
<col id="2">offline</col>
<col id="3">True</col>
</row>
</data>
</object>
<object class="GtkApplicationWindow" id="roster_window">
<property name="name">RosterWindow</property>
<property name="width_request">85</property>
@ -89,7 +163,25 @@
<object class="GtkComboBox" id="status_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">status_liststore</property>
<signal name="changed" handler="on_status_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="sensitive">3</attribute>
<attribute name="icon-name">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText">
<property name="xpad">5</property>
<property name="ellipsize">end</property>
</object>
<attributes>
<attribute name="sensitive">3</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">False</property>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Some files were not shown because too many files have changed in this diff Show More