[goffice] Font Selector: avoid having C code mess with grid coordinates.



commit f61637e74f3c7c2df64daedb6456aa69e73fb49e
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 14 22:15:37 2013 -0400

    Font Selector: avoid having C code mess with grid coordinates.

 goffice/gtk/go-font-sel.c  |   15 ++++++++-------
 goffice/gtk/go-font-sel.ui |   19 +++++++++++++++++--
 2 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index b714224..0bc5ed1 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -443,7 +443,7 @@ gfs_constructor (GType type,
                 guint n_construct_properties,
                 GObjectConstructParam *construct_params)
 {
-       GtkWidget *w, *grid;
+       GtkWidget *w, *fontsel;
        GOFontSel *gfs = (GOFontSel *)
                (gfs_parent_class->constructor (type,
                                                n_construct_properties,
@@ -460,8 +460,8 @@ gfs_constructor (GType type,
 
        gfs->modifications = pango_attr_list_new ();
 
-       grid = go_gtk_builder_get_widget (gfs->gui, "toplevel-grid");
-       gtk_container_add (GTK_CONTAINER (gfs), grid);
+       fontsel = go_gtk_builder_get_widget (gfs->gui, "font-selector");
+       gtk_container_add (GTK_CONTAINER (gfs), fontsel);
        gfs->font_name_entry  = go_gtk_builder_get_widget (gfs->gui, "font-name-entry");
        gfs->font_style_entry = go_gtk_builder_get_widget (gfs->gui, "font-style-entry");
        gfs->font_size_entry  = go_gtk_builder_get_widget (gfs->gui, "font-size-entry");
@@ -481,10 +481,11 @@ gfs_constructor (GType type,
        gfs->font_preview_canvas = GOC_CANVAS (w);
        gtk_widget_set_hexpand (w, TRUE);
        gtk_widget_set_size_request (w, -1, 96);
-       gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (gfs->font_preview_canvas),
-                        0, 4, 3, 1);
-       gtk_widget_show_all (grid);
-
+       go_gtk_widget_replace
+               (go_gtk_builder_get_widget (gfs->gui, "preview-placeholder"),
+                w);
+       gtk_widget_show_all (fontsel);
+       
        gfs->font_preview_text = goc_item_new (
                goc_canvas_get_root (gfs->font_preview_canvas),
                GOC_TYPE_TEXT,
diff --git a/goffice/gtk/go-font-sel.ui b/goffice/gtk/go-font-sel.ui
index 3300aa4..85e30e7 100644
--- a/goffice/gtk/go-font-sel.ui
+++ b/goffice/gtk/go-font-sel.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkGrid" id="toplevel-grid">
+  <object class="GtkGrid" id="font-selector">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="vexpand">True</property>
@@ -165,7 +165,7 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="xalign">0</property>
-        <property name="label" translatable="yes">Preview</property>
+        <property name="label" translatable="yes">Preview:</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -175,6 +175,21 @@
       </packing>
     </child>
     <child>
+      <object class="GtkBox" id="preview-placeholder">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">4</property>
+        <property name="width">3</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+    <child>
       <placeholder/>
     </child>
     <child>


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