[polari/wip/raresv/blankState: 3/4] chatView: shot at inserting images



commit ed7e3b4e4946c4f7af937f18ec84dcfb5f800e06
Author: Rares Visalom <rares visalom gmail com>
Date:   Fri Dec 16 23:21:45 2016 +0200

    chatView: shot at inserting images

 src/chatView.js |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 93f4809..21fce49 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -8,6 +8,7 @@ const PangoCairo = imports.gi.PangoCairo;
 const Polari = imports.gi.Polari;
 const Tp = imports.gi.TelepathyGLib;
 const Tpl = imports.gi.TelepathyLogger;
+const GdkPixbuf = imports.gi.GdkPixbuf;
 
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
@@ -473,6 +474,11 @@ const ChatView = new Lang.Class({
             name: 'blank-state-topic',
             left_margin: MARGIN,
             size: 13000
+          },
+          {
+            name: 'blank-state-tips',
+            left_margin: MARGIN,
+            size: 10000
           }
         ];
         tags.forEach(function(tagProps) {
@@ -770,6 +776,8 @@ const ChatView = new Lang.Class({
     },
 
     _insertBlankState: function () {
+        let buffer = this._view.get_buffer();
+
         let blankStateMark = this._view.buffer.get_mark('blank-state-mark');
 
         if (!blankStateMark)
@@ -792,10 +800,32 @@ const ChatView = new Lang.Class({
 
         this._insertWithTags(iter, topic, tags);
 
-        if (this._roomManager.isFirstRun)
-            this._insertWithTags(iter, "BLANK STATEEEEE FIRST RUN\n", tags);
-        else
-            this._insertWithTags(iter, "BLANK STATEEEEE NOT FOR THE FIRST TIME\n", tags);
+        tags = [this._lookupTag('blank-state-tips')];
+        if (this._roomManager.isFirstRun) {
+            //image1
+            let pixbuf = 
GdkPixbuf.Pixbuf.new_from_resource_at_scale("/org/gnome/Polari/icons/polari-user-notify-symbolic.svg", 20, 
20, true, null);
+            this._insertWithTags(iter, " ", tags);
+            buffer.insert_pixbuf(iter, pixbuf);
+            //text1
+            this._insertWithTags(iter, "Notify other users of your message by incliding their nickname.\n", 
tags);
+
+            //image2
+            let pixbuf2 = 
GdkPixbuf.Pixbuf.new_from_resource_at_scale("/org/gnome/Polari/icons/polari-user-notify-symbolic.svg", 20, 
20, true, null);
+            this._insertWithTags(iter, " ", tags);
+            buffer.insert_pixbuf(iter, pixbuf2);
+            //text2
+            this._insertWithTags(iter, "Share text and images by pasting them into the text field.\n", tags);
+
+            //image3
+            let pixbuf3 = 
GdkPixbuf.Pixbuf.new_from_resource_at_scale("/org/gnome/Polari/icons/polari-user-notify-symbolic.svg", 20, 
20, true, null);
+            this._insertWithTags(iter, " ", tags);
+            buffer.insert_pixbuf(iter, pixbuf3);
+            //text3
+            this._insertWithTags(iter, "If this is your first time using IRC, we recommend glacing over the 
IRC netiquette.\n", tags);
+        }
+        else {
+            //this._insertWithTags(iter, "BLANK STATEEEEE NOT FOR THE FIRST TIME\n", tags);
+        }
     },
 
     _onValueChanged: function() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]