[gnome-characters/wip/properties: 3/14] character: Show character properties



commit e9546d2c335650a12e8a359c444941364ccb7e46
Author: Daiki Ueno <ueno gnu org>
Date:   Mon Feb 9 17:48:50 2015 +0900

    character: Show character properties

 data/character.ui |  109 ++++++++++++++++++++++++++++++++++++++++++++++-------
 src/character.js  |    9 +++-
 2 files changed, 102 insertions(+), 16 deletions(-)
---
diff --git a/data/character.ui b/data/character.ui
index 784f206..b3e61e0 100644
--- a/data/character.ui
+++ b/data/character.ui
@@ -4,6 +4,8 @@
   <template class="Gjs_CharacterDialog" parent="GtkDialog">
     <child internal-child="vbox">
       <object class="GtkBox" id="vbox1">
+       <property name="halign">fill</property>
+       <property name="valign">fill</property>
        <child>
          <object class="GtkStack" id="main-stack">
            <property name="visible">True</property>
@@ -11,17 +13,17 @@
              <object class="GtkGrid" id="character-grid">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
-               <property name="halign">center</property>
-               <property name="valign">center</property>
+               <property name="halign">fill</property>
+               <property name="valign">fill</property>
                <property name="border_width">5</property>
                <property name="orientation">vertical</property>
-               <property name="row_spacing">50</property>
+               <property name="row_spacing">20</property>
                <child>
                  <object class="GtkLabel" id="character-label">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="ellipsize">end</property>
-                   <property name="halign">center</property>
+                   <property name="halign">fill</property>
                    <property name="valign">center</property>
                    <style>
                      <class name="character-label"/>
@@ -33,11 +35,92 @@
                  </packing>
                </child>
                <child>
-                 <object class="GtkButton" id="copy-button">
-                   <property name="label" translatable="yes">Copy Character</property>
+                 <object class="GtkGrid" id="detail-grid">
                    <property name="visible">True</property>
-                   <property name="can_focus">True</property>
-                   <property name="receives_default">False</property>
+                   <property name="can_focus">False</property>
+                   <property name="halign">fill</property>
+                   <property name="valign">fill</property>
+                   <property name="column-spacing">20</property>
+                   <property name="margin-left">20</property>
+                   <style>
+                     <class name="detail"/>
+                   </style>
+                   <child>
+                     <object class="GtkLabel" id="codepoint-title-label">
+                       <property name="label" translatable="yes">Codepoint: </property>
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">0</property>
+                       <property name="top_attach">0</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="codepoint-label">
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">1</property>
+                       <property name="top_attach">0</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="category-title-label">
+                       <property name="label" translatable="yes">Category: </property>
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">0</property>
+                       <property name="top_attach">1</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="category-label">
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">1</property>
+                       <property name="top_attach">1</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="script-title-label">
+                       <property name="label" translatable="yes">Script: </property>
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">0</property>
+                       <property name="top_attach">2</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="script-label">
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">1</property>
+                       <property name="top_attach">2</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="block-title-label">
+                       <property name="label" translatable="yes">Block: </property>
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">0</property>
+                       <property name="top_attach">3</property>
+                     </packing>
+                   </child>
+                   <child>
+                     <object class="GtkLabel" id="block-label">
+                       <property name="halign">start</property>
+                     </object>
+                     <packing>
+                       <property name="left_attach">1</property>
+                       <property name="top_attach">3</property>
+                     </packing>
+                   </child>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
@@ -45,13 +128,11 @@
                  </packing>
                </child>
                <child>
-                 <object class="GtkLabel" id="detail-label">
+                 <object class="GtkButton" id="copy-button">
+                   <property name="label" translatable="yes">Copy Character</property>
                    <property name="visible">True</property>
-                   <property name="can_focus">False</property>
-                   <property name="halign">center</property>
-                   <style>
-                     <class name="detail-label"/>
-                   </style>
+                   <property name="can_focus">True</property>
+                   <property name="receives_default">False</property>
                  </object>
                  <packing>
                    <property name="left_attach">0</property>
diff --git a/src/character.js b/src/character.js
index 66f440b..e901acf 100644
--- a/src/character.js
+++ b/src/character.js
@@ -31,7 +31,9 @@ const CharacterDialog = new Lang.Class({
     Name: 'CharacterDialog',
     Extends: Gtk.Dialog,
     Template: 'resource:///org/gnome/Characters/character.ui',
-    InternalChildren: ['main-stack', 'character-label', 'detail-label',
+    InternalChildren: ['main-stack', 'character-label', 'detail-grid',
+                       'codepoint-label', 'category-label', 'script-label',
+                       'block-label',
                        'copy-button', 'related-listbox'],
     Properties: {
         'font': GObject.ParamSpec.string(
@@ -132,7 +134,10 @@ const CharacterDialog = new Lang.Class({
 
         let codePoint = this._character.charCodeAt(0);
         let codePointHex = codePoint.toString(16).toUpperCase();
-        this._detail_label.label = _("Unicode U+%04s").format(codePointHex);
+        this._codepoint_label.label = _("U+%04s").format(codePointHex);
+        this._category_label.label = Gc.character_category(uc);
+        this._script_label.label = Gc.character_script(uc);
+        this._block_label.label = Gc.character_block(uc);
 
         let children = this._related_listbox.get_children();
         for (let index in children)


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