[gnumeric] CellFormatDialog: more ui, less C.



commit 0cc9cc7ec8915410c00edfca8c271f180a0c1aef
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 26 20:26:10 2014 -0500

    CellFormatDialog: more ui, less C.

 src/dialogs/cell-format.ui       |  211 ++++++++++++++++++++++++++------------
 src/dialogs/dialog-cell-format.c |   26 +-----
 2 files changed, 145 insertions(+), 92 deletions(-)
---
diff --git a/src/dialogs/cell-format.ui b/src/dialogs/cell-format.ui
index 4fc99b0..4db2e5f 100644
--- a/src/dialogs/cell-format.ui
+++ b/src/dialogs/cell-format.ui
@@ -1,11 +1,131 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.8"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">20</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">top_border</property>
+  </object>
+  <object class="GtkImage" id="image10">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">outline_border</property>
+  </object>
+  <object class="GtkImage" id="image11">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">no_border</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">rev_diag_border</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">diag_border</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">left_border</property>
+  </object>
+  <object class="GtkImage" id="image5">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">right_border</property>
+  </object>
+  <object class="GtkImage" id="image6">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">bottom_border</property>
+  </object>
+  <object class="GtkImage" id="image7">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">inside_vert_border</property>
+  </object>
+  <object class="GtkImage" id="image8">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">inside_horiz_border</property>
+  </object>
+  <object class="GtkImage" id="image9">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">inside_border</property>
+  </object>
+  <object class="GtkListStore" id="model1">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Any Value     (no validation)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Whole numbers</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Numbers</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">In a list</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Date</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Time</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Text length</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Custom</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="model2">
+    <columns>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">min &lt;= val &lt;= max         (between)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;= min || max &lt;= val (not between)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val == bound                  (equal to)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;&gt; bound                  (not equal to)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val  &gt;  bound                  (greater than)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val  &lt;  bound                  (less than)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &gt;= bound                  (greater than or equal)</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">val &lt;= bound                  (less than or equal)</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkDialog" id="CellFormat">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -305,7 +425,6 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="invisible_char">•</property>
-                    <property name="invisible_char_set">True</property>
                     <property name="primary_icon_activatable">False</property>
                     <property name="secondary_icon_activatable">False</property>
                     <property name="adjustment">adjustment1</property>
@@ -570,6 +689,8 @@
                         <property name="tooltip_text" translatable="yes">Reverse Diagonal</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image2</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -588,6 +709,8 @@
                         <property name="tooltip_text" translatable="yes">Top</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image1</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -606,6 +729,8 @@
                         <property name="tooltip_text" translatable="yes">Diagonal</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image3</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">4</property>
@@ -624,6 +749,8 @@
                         <property name="tooltip_text" translatable="yes">Left</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image4</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -642,6 +769,8 @@
                         <property name="tooltip_text" translatable="yes">Right</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image5</property>
+                        <property name="use_underline">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">4</property>
@@ -660,6 +789,8 @@
                         <property name="tooltip_text" translatable="yes">Bottom</property>
                         <property name="halign">center</property>
                         <property name="valign">center</property>
+                        <property name="image">image6</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -679,6 +810,8 @@
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <property name="border_width">6</property>
+                        <property name="image">image11</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -698,6 +831,8 @@
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <property name="border_width">6</property>
+                        <property name="image">image10</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -717,6 +852,8 @@
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <property name="border_width">6</property>
+                        <property name="image">image7</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">2</property>
@@ -736,6 +873,8 @@
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <property name="border_width">6</property>
+                        <property name="image">image9</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">3</property>
@@ -755,6 +894,8 @@
                         <property name="halign">center</property>
                         <property name="valign">center</property>
                         <property name="border_width">6</property>
+                        <property name="image">image8</property>
+                        <property name="always_show_image">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">4</property>
@@ -2015,7 +2156,6 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="invisible_char">•</property>
-                    <property name="invisible_char_set">True</property>
                     <property name="primary_icon_activatable">False</property>
                     <property name="secondary_icon_activatable">False</property>
                   </object>
@@ -2211,7 +2351,6 @@
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="invisible_char">•</property>
-                    <property name="invisible_char_set">True</property>
                     <property name="primary_icon_activatable">False</property>
                     <property name="secondary_icon_activatable">False</property>
                   </object>
@@ -2254,68 +2393,4 @@
       <action-widget response="0">okbutton</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkListStore" id="model1">
-    <columns>
-      <!-- column-name gchararray -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Any Value     (no validation)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Whole numbers</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Numbers</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">In a list</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Date</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Time</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Text length</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Custom</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="model2">
-    <columns>
-      <!-- column-name gchararray -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">min &lt;= val &lt;= max         (between)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;= min || max &lt;= val (not between)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val == bound                  (equal to)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;&gt; bound                  (not equal to)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val  &gt;  bound                  (greater than)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val  &lt;  bound                  (less than)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &gt;= bound                  (greater than or equal)</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">val &lt;= bound                  (less than or equal)</col>
-      </row>
-    </data>
-  </object>
 </interface>
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index f475611..60e1f1d 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -424,28 +424,6 @@ setup_color_pickers (FormatState *state,
        }
 }
 
-/*
- * Utility routine to load an image and insert it into a
- * button of the same name.
- */
-static GtkWidget *
-init_button_image (GtkBuilder *gui, char const *name)
-{
-       GtkWidget *tmp = go_gtk_builder_get_widget (gui, name);
-       if (tmp != NULL) {
-               GdkScreen *screen = gtk_widget_get_screen (tmp);
-               GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (
-                       gtk_icon_theme_get_for_screen (screen),
-                       name, 16, 0, NULL);
-               GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
-               g_object_unref (pixbuf);
-               gtk_widget_show (image);
-               gtk_container_add (GTK_CONTAINER (tmp), image);
-       }
-
-       return tmp;
-}
-
 /*****************************************************************************/
 
 static void
@@ -2384,7 +2362,7 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno, gint pages)
 
        /* Setup the border images */
        for (i = 0; (name = border_buttons[i]) != NULL; ++i) {
-               tmp = init_button_image (state->gui, name);
+               GtkWidget *tmp = go_gtk_builder_get_widget (state->gui, name);
                if (tmp != NULL) {
                        init_border_button (state, i, tmp,
                                            state->borders[i]);
@@ -2427,7 +2405,7 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno, gint pages)
 
        /* Setup the images in the border presets */
        for (i = 0; (name = border_preset_buttons[i]) != NULL; ++i) {
-               tmp = init_button_image (state->gui, name);
+               GtkWidget *tmp = go_gtk_builder_get_widget (state->gui, name);
                if (tmp != NULL) {
                        state->border.preset[i] = GTK_BUTTON (tmp);
                        g_signal_connect (G_OBJECT (tmp),


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