[polari/wip/fmuellner/combined-gsoc: 17/103] GtkGrid
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/combined-gsoc: 17/103] GtkGrid
- Date: Fri, 22 Jul 2016 13:35:23 +0000 (UTC)
commit 705c72ccc0714e41e58578b414560bb3d16fb2d4
Author: Kunaal Jain <kunaalus gmail com>
Date: Sat Jun 18 12:37:35 2016 +0530
GtkGrid
data/resources/result-list-row.ui | 78 +++++++++++++++++++++++++++++--------
src/mainWindow.js | 4 +-
src/resultList.js | 11 +-----
3 files changed, 65 insertions(+), 28 deletions(-)
---
diff --git a/data/resources/result-list-row.ui b/data/resources/result-list-row.ui
index 348bfed..f06a417 100644
--- a/data/resources/result-list-row.ui
+++ b/data/resources/result-list-row.ui
@@ -1,23 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="Gjs_ResultRow" parent="GtkListBoxRow">
- <property name="visible">True</property>
- <child>
- <object class="GtkEventBox" id="eventBox">
+ <template class="Gjs_ResultRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="roomLabel">
- <property name="visible">True</property>
- <property name="ellipsize">end</property>
- <property name="use-markup">true</property>
- </object>
- </child>
- </object>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">1</property>
+ <property name="hexpand">1</property>
+ <property name="baseline_position">top</property>
+ <child>
+ <object class="GtkLabel" id="source_name">
+ <property name="visible">1</property>
+ <property name="valign">baseline</property>
+ <property name="label" translatable="0">Username</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="short_time_label">
+ <property name="visible">1</property>
+ <property name="valign">baseline</property>
+ <property name="label" translatable="yes">38m</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="fill">0</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="content_label">
+ <property name="visible">1</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="0">Message</property>
+ <property name="wrap">1</property>
+ <property name="ellipsize">end</property>
+ <property name="max-width-chars">30</property>
+ <property name="use-markup">true</property>
+ <property name="lines">2</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
</child>
- </object>
- </child>
- </template>
+ </template>
</interface>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 2ad87fa..e29a0e3 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -288,7 +288,9 @@ const MainWindow = new Lang.Class({
this._results.remove(row);
} else {
let row = new ResultList.ResultRow();
- row._roomLabel.label = message;
+ row._content_label.label = message;
+ row._source_name.label = channel;
+ row._short_time_label.label = this._formatTimestamp(time);
row.uid = events[i].id;
widgetMap[uid] = row;
}
diff --git a/src/resultList.js b/src/resultList.js
index f9a007c..3110162 100644
--- a/src/resultList.js
+++ b/src/resultList.js
@@ -10,25 +10,16 @@ const AccountsMonitor = imports.accountsMonitor;
const ChatroomManager = imports.chatroomManager;
const Lang = imports.lang;
-function _onPopoverVisibleChanged(popover) {
- let context = popover.relative_to.get_style_context();
- if (popover.visible)
- context.add_class('has-open-popup');
- else
- context.remove_class('has-open-popup');
-}
-
const ResultRow = new Lang.Class({
Name: 'ResultRow',
Extends: Gtk.ListBoxRow,
Template: 'resource:///org/gnome/Polari/ui/result-list-row.ui',
- InternalChildren: ['eventBox', 'roomLabel'],
+ InternalChildren: ['box1', 'source_name', 'short_time_label', 'content_label'],
_init: function(message, uid) {
this.parent();
this._uid = uid;
- this._popover = null;
// this._icon.gicon = room.icon;
// this._icon.visible = room.icon != null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]