[smuxi: 164/179] Merge branch 'stable'
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi: 164/179] Merge branch 'stable'
- Date: Sat, 4 Nov 2017 05:51:03 +0000 (UTC)
commit 3fefb2e4e30bf7365f5d97c190fc364591d08807
Merge: 253fc27 4f217cf
Author: Mirco Bauer <meebey meebey net>
Date: Sat Jun 24 13:57:04 2017 +0800
Merge branch 'stable'
Conflicts:
src/Frontend-GNOME/Views/MessageTextView.cs
Makefile.am | 1 +
src/Frontend-GNOME/Views/MessageTextView.cs | 70 ++++++++++++++++++--------
2 files changed, 49 insertions(+), 22 deletions(-)
---
diff --cc src/Frontend-GNOME/Views/MessageTextView.cs
index 8caa8fb,d765acb..ff8d98f
--- a/src/Frontend-GNOME/Views/MessageTextView.cs
+++ b/src/Frontend-GNOME/Views/MessageTextView.cs
@@@ -1,7 -1,7 +1,7 @@@
/*
* Smuxi - Smart MUltipleXed Irc
*
-- * Copyright (c) 2009-2015 Mirco Bauer <meebey meebey net>
++ * Copyright (c) 2009-2015, 2017 Mirco Bauer <meebey meebey net>
*
* Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
*
@@@ -362,6 -344,52 +344,50 @@@ namespace Smuxi.Frontend.Gnom
);
}
+ void AddEmoji(Gtk.TextBuffer buffer, ref Gtk.TextIter iter,
+ ImageMessagePartModel imgPart, string shortName,
+ Gtk.TextMark emojiMark , string imagePath)
+ {
+ int width, height;
- int widthPango, heightPango;
+ int descent;
+ using (var layout = CreatePangoLayout(null)) {
+ layout.GetPixelSize(out width, out height);
- layout.GetSize(out widthPango, out heightPango);
+ descent = layout.Context.GetMetrics(layout.FontDescription, null).Descent;
+ }
+
+ Gdk.Pixbuf emojiPixBuf;
+ try {
+ emojiPixBuf = new Gdk.Pixbuf(imagePath, -1, height);
+ } catch (Exception ex) {
+ #if LOG4NET
+ _Logger.ErrorFormat(
+ "AddEmoji(): error loading " +
+ "image file: '{0}' " +
+ "emoji: '{1}' into Gdk.Pixbuf(), " +
+ "Exception: {2}",
+ imagePath, shortName, ex
+ );
+ #endif
+
+ // delete the broken image file, maybe after the
+ // next download this will be a valid image
+ File.Delete(imagePath);
+
+ // show alternative text as fallback instead
+ buffer.DeleteMark(emojiMark);
+ AddAlternativeText(buffer, ref iter, imgPart);
+ return;
+ }
+
+ buffer.InsertPixbuf(ref iter, emojiPixBuf);
+ var beforeIter = buffer.GetIterAtMark(emojiMark);
+ var emojiTag = new EmojiTag(emojiMark, imagePath) {
+ Rise = - descent
+ };
+ _MessageTextTagTable.Add(emojiTag);
+ buffer.ApplyTag(emojiTag, beforeIter, iter);
+ }
+
public void AddMessage(MessageModel msg)
{
AddMessage(msg, true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]