[gnumeric] adjust second autofilter dialog as well



commit 51aee1712b30ad04e1b8ef36cb960b72575fe342
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jul 30 21:03:20 2010 -0600

    adjust second autofilter dialog as well
    
    2010-07-30  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-autofilter.c (dialog_auto_filter): set up column label for
    	top 10 dialog; use separate keys otherwise they share their size.
    	* src/dialogs/autofilter-top10.glade: add label

 src/dialogs/ChangeLog              |    8 +-
 src/dialogs/autofilter-top10.glade |  365 +++++++++++++++++-------------------
 src/dialogs/dialog-autofilter.c    |   44 +++--
 3 files changed, 206 insertions(+), 211 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index d1995fc..8780112 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,7 +1,13 @@
 2010-07-30  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-autofilter.c (dialog_auto_filter): set up column label for 
+	top 10 dialog; use separate keys otherwise they share their size.
+	* src/dialogs/autofilter-top10.glade: add label
+
+2010-07-30  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-autofilter.c (dialog_auto_filter): set up column labels
-	* utofilter-expression.glade: add labels
+	* autofilter-expression.glade: add labels
 
 2010-07-30  Morten Welinder <terra gnome org>
 
diff --git a/src/dialogs/autofilter-top10.glade b/src/dialogs/autofilter-top10.glade
index bd0b015..e15469f 100644
--- a/src/dialogs/autofilter-top10.glade
+++ b/src/dialogs/autofilter-top10.glade
@@ -1,195 +1,178 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0"?>
 <glade-interface>
-
-<widget class="GtkDialog" id="dialog">
-  <property name="border_width">6</property>
-  <property name="title" translatable="yes">Gnumeric : AutoFilter</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_MOUSE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="has_separator">False</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">6</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area1">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="help_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-help</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">-11</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="cancel_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">-6</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="ok_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">-5</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkHBox" id="hbox1">
-	  <property name="border_width">6</property>
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">12</property>
-
-	  <child>
-	    <widget class="GtkLabel" id="label1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Show:</property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <accessibility>
-		<atkrelation target="top_vs_bottom_option_menu" type="label-for"/>
-		<atkrelation target="item_vs_percentage_option_menu" type="label-for"/>
-		<atkrelation target="item_count" type="label-for"/>
-	      </accessibility>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkAlignment" id="alignment1">
-	      <property name="visible">True</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xscale">1</property>
-	      <property name="yscale">0</property>
-
-	      <child>
-		<widget class="GtkComboBox" id="top_vs_bottom_option_menu">
-	      <property name="visible">True</property>
-	      <property name="items" translatable="yes">Top
+  <!-- interface-requires gtk+ 2.6 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <widget class="GtkDialog" id="dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Gnumeric : AutoFilter</property>
+    <property name="window_position">mouse</property>
+    <property name="type_hint">normal</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <widget class="GtkLabel" id="col-label">
+            <property name="visible">True</property>
+            <property name="ypad">2</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="border_width">6</property>
+            <property name="spacing">12</property>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Show:</property>
+                <accessibility>
+                  <atkrelation type="label-for" target="item_count"/>
+                  <atkrelation type="label-for" target="item_vs_percentage_option_menu"/>
+                  <atkrelation type="label-for" target="top_vs_bottom_option_menu"/>
+                </accessibility>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="yscale">0</property>
+                <child>
+                  <widget class="GtkComboBox" id="top_vs_bottom_option_menu">
+                    <property name="visible">True</property>
+                    <property name="items" translatable="yes">Top
 Bottom</property>
-		  <accessibility>
-		    <atkrelation target="label1" type="labelled-by"/>
-		    <atkrelation target="item_vs_percentage_option_menu" type="label-for"/>
-		    <atkrelation target="item_count" type="label-for"/>
-		  </accessibility>
-		</widget>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSpinButton" id="item_count">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="climb_rate">1</property>
-	      <property name="digits">0</property>
-	      <property name="numeric">False</property>
-	      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-	      <property name="snap_to_ticks">False</property>
-	      <property name="wrap">False</property>
-	      <property name="adjustment">10 1 500 1 0 0</property>
-	      <accessibility>
-		<atkrelation target="top_vs_bottom_option_menu" type="labelled-by"/>
-		<atkrelation target="label1" type="labelled-by"/>
-		<atkrelation target="item_vs_percentage_option_menu" type="label-for"/>
-	      </accessibility>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkAlignment" id="alignment2">
-	      <property name="visible">True</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xscale">1</property>
-	      <property name="yscale">0</property>
-
-	      <child>
-		<widget class="GtkComboBox" id="item_vs_percentage_option_menu">
-		  <property name="visible">True</property>
-	      <property name="items" translatable="yes">Items
+                    <accessibility>
+                      <atkrelation type="labelled-by" target="label1"/>
+                      <atkrelation type="label-for" target="item_count"/>
+                      <atkrelation type="label-for" target="item_vs_percentage_option_menu"/>
+                    </accessibility>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkSpinButton" id="item_count">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">10 1 500 1 0 0</property>
+                <property name="climb_rate">1</property>
+                <accessibility>
+                  <atkrelation type="labelled-by" target="label1"/>
+                  <atkrelation type="labelled-by" target="top_vs_bottom_option_menu"/>
+                  <atkrelation type="label-for" target="item_vs_percentage_option_menu"/>
+                </accessibility>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="yscale">0</property>
+                <child>
+                  <widget class="GtkComboBox" id="item_vs_percentage_option_menu">
+                    <property name="visible">True</property>
+                    <property name="items" translatable="yes">Items
 Percentage</property>
-		  <accessibility>
-		    <atkrelation target="top_vs_bottom_option_menu" type="labelled-by"/>
-		    <atkrelation target="label1" type="labelled-by"/>
-		    <atkrelation target="item_count" type="labelled-by"/>
-		  </accessibility>
-		</widget>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+                    <accessibility>
+                      <atkrelation type="labelled-by" target="item_count"/>
+                      <atkrelation type="labelled-by" target="label1"/>
+                      <atkrelation type="labelled-by" target="top_vs_bottom_option_menu"/>
+                    </accessibility>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <widget class="GtkButton" id="help_button">
+                <property name="label">gtk-help</property>
+                <property name="response_id">-11</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancel_button">
+                <property name="label">gtk-cancel</property>
+                <property name="response_id">-6</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="ok_button">
+                <property name="label">gtk-ok</property>
+                <property name="response_id">-5</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>
diff --git a/src/dialogs/dialog-autofilter.c b/src/dialogs/dialog-autofilter.c
index d1d699e..f546fef 100644
--- a/src/dialogs/dialog-autofilter.c
+++ b/src/dialogs/dialog-autofilter.c
@@ -51,6 +51,7 @@ typedef struct {
 } AutoFilterState;
 
 #define DIALOG_KEY "autofilter"
+#define DIALOG_KEY_EXPRESSION "autofilter-expression"
 #define UNICODE_ELLIPSIS "\xe2\x80\xa6"
 
 static void
@@ -236,10 +237,12 @@ dialog_auto_filter (WBCGtk *wbcg,
 	int col;
 	gchar *label;
 	GnmCell *cell;
+	int len = is_expr ? 15 : 30;
 
 	g_return_if_fail (wbcg != NULL);
 
-	if (gnumeric_dialog_raise_if_exists (wbcg, DIALOG_KEY))
+	if (gnumeric_dialog_raise_if_exists 
+	    (wbcg, is_expr ? DIALOG_KEY_EXPRESSION : DIALOG_KEY))
 		return;
 	gui = gnm_glade_xml_new (GO_CMD_CONTEXT (wbcg),
 			(is_expr ? "autofilter-expression.glade" : "autofilter-top10.glade"),
@@ -256,35 +259,37 @@ dialog_auto_filter (WBCGtk *wbcg,
 
 	g_return_if_fail (state->gui != NULL);
 
-	if (is_expr) {
-		col = filter->r.start.col + field;
-
-		cell = sheet_cell_get (filter->sheet, col, filter->r.start.row);
-
-		if (cell == NULL || gnm_cell_is_blank (cell))
-			label = g_strdup_printf (_("Column %s"), col_name (col));
-		else {
-			char *content = gnm_cell_get_rendered_text (cell);
-			if (g_utf8_strlen (content, -1) > 15) {
-				char *end = g_utf8_find_prev_char (content, content + 16 - strlen (UNICODE_ELLIPSIS));
-				strcpy (end, UNICODE_ELLIPSIS);
-			}
-			label = g_strdup_printf (_("Column %s (\"%s\")"), 
-						 col_name (col), content);
-			g_free (content);
+	col = filter->r.start.col + field;
+
+	cell = sheet_cell_get (filter->sheet, col, filter->r.start.row);
+
+	if (cell == NULL || gnm_cell_is_blank (cell))
+		label = g_strdup_printf (_("Column %s"), col_name (col));
+	else {
+		char *content = gnm_cell_get_rendered_text (cell);
+		if (g_utf8_strlen (content, -1) > len) {
+			char *end = g_utf8_find_prev_char (content, content + len + 1 - strlen (UNICODE_ELLIPSIS));
+			strcpy (end, UNICODE_ELLIPSIS);
 		}
+		label = g_strdup_printf (_("Column %s (\"%s\")"), 
+					 col_name (col), content);
+		g_free (content);
+	}
 
+	if (is_expr) {
 		gtk_label_set_text 
 			(GTK_LABEL (glade_xml_get_widget (state->gui, "col-label1")), label);
 		gtk_label_set_text 
 			(GTK_LABEL (glade_xml_get_widget (state->gui, "col-label2")), label);
-		g_free (label);
 	} else {
+		gtk_label_set_text 
+			(GTK_LABEL (glade_xml_get_widget (state->gui, "col-label")), label);
 		w = glade_xml_get_widget (state->gui, "item_vs_percentage_option_menu");
 		g_signal_connect (G_OBJECT (w),
 			"changed",
 			G_CALLBACK (cb_top10_type_changed), state);
 	}
+	g_free (label);
 
 	state->dialog = glade_xml_get_widget (state->gui, "dialog");
 	if (cond != NULL) {
@@ -346,6 +351,7 @@ dialog_auto_filter (WBCGtk *wbcg,
 	g_object_set_data_full (G_OBJECT (state->dialog),
 		"state", state, (GDestroyNotify)cb_autofilter_destroy);
 
-	gnumeric_keyed_dialog (wbcg, GTK_WINDOW (state->dialog), DIALOG_KEY);
+	gnumeric_keyed_dialog (wbcg, GTK_WINDOW (state->dialog), 
+			       is_expr ? DIALOG_KEY_EXPRESSION : DIALOG_KEY);
 	gtk_widget_show (state->dialog);
 }



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