[gnome-characters/wip/properties: 2/2] character: Show character properties



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

    character: Show character properties

 data/character.ui |  110 +++++++++++++++++++++++++++++++++++++++++++++--------
 src/character.js  |   11 ++++-
 2 files changed, 103 insertions(+), 18 deletions(-)
---
diff --git a/data/character.ui b/data/character.ui
index 6e54cdc..b413eb8 100644
--- a/data/character.ui
+++ b/data/character.ui
@@ -6,18 +6,16 @@
     <child>
       <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"/>
@@ -29,11 +27,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>
@@ -41,13 +120,12 @@
          </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>
+           <property name="hexpand">True</property>
          </object>
          <packing>
            <property name="left_attach">0</property>
diff --git a/src/character.js b/src/character.js
index d593ec8..ebd740a 100644
--- a/src/character.js
+++ b/src/character.js
@@ -71,7 +71,11 @@ const CharacterDialog = new Lang.Class({
         this.get_content_area().add(this._stack);
 
         this._characterLabel = builder.get_object('character-label');
-        this._detailLabel = builder.get_object('detail-label');
+        this._detailGrid = builder.get_object('detail-grid');
+        this._codepointLabel = builder.get_object('codepoint-label');
+        this._categoryLabel = builder.get_object('category-label');
+        this._scriptLabel = builder.get_object('script-label');
+        this._blockLabel = builder.get_object('block-label');
 
         let copyButton = builder.get_object('copy-button');
         copyButton.connect('clicked', Lang.bind(this, this._copyCharacter));
@@ -139,7 +143,10 @@ const CharacterDialog = new Lang.Class({
 
         let codePoint = this._character.charCodeAt(0);
         let codePointHex = codePoint.toString(16).toUpperCase();
-        this._detailLabel.label = _("Unicode U+%04s").format(codePointHex);
+        this._codepointLabel.label = _("U+%04s").format(codePointHex);
+        this._categoryLabel.label = Gc.character_category(uc);
+        this._scriptLabel.label = Gc.character_script(uc);
+        this._blockLabel.label = Gc.character_block(uc);
 
         let children = this._relatedList.get_children();
         for (let index in children)


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