[Gnucash-changes] r14341 - gnucash/branches/deprecated-cleanup - Convert more deprecated GtkOptionMenus and GtkCombos to GtkComboBoxs.

David Hampton hampton at cvs.gnucash.org
Tue Jun 6 00:37:16 EDT 2006


Author: hampton
Date: 2006-06-06 00:37:15 -0400 (Tue, 06 Jun 2006)
New Revision: 14341
Trac: http://svn.gnucash.org/trac/changeset/14341

Modified:
   gnucash/branches/deprecated-cleanup/ChangeLog
   gnucash/branches/deprecated-cleanup/src/business/business-gnome/business-gnome-utils.c
   gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-billterms.c
   gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-payment.c
   gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/billterms.glade
   gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/payment.glade
   gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/dialog-tax-table.c
   gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/tax-tables.glade
   gnucash/branches/deprecated-cleanup/src/report/report-gnome/dialog-style-sheet.c
   gnucash/branches/deprecated-cleanup/src/report/report-gnome/report.glade
Log:
Convert more deprecated GtkOptionMenus and GtkCombos to GtkComboBoxs.


Modified: gnucash/branches/deprecated-cleanup/ChangeLog
===================================================================
--- gnucash/branches/deprecated-cleanup/ChangeLog	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/ChangeLog	2006-06-06 04:37:15 UTC (rev 14341)
@@ -1,3 +1,16 @@
+2006-06-05  David Hampton  <hampton at employees.org>
+
+	* src/report/report-gnome/dialog-style-sheet.c:
+	* src/report/report-gnome/report.glade:
+	* src/business/business-gnome/dialog-payment.c:
+	* src/business/business-gnome/dialog-billterms.c:
+	* src/business/business-gnome/glade/billterms.glade:
+	* src/business/business-gnome/glade/payment.glade:
+	* src/business/business-gnome/business-gnome-utils.c:
+	* src/business/dialog-tax-table/dialog-tax-table.c:
+	* src/business/dialog-tax-table/tax-tables.glade: Convert more
+	deprecated GtkOptionMenus and GtkCombos to GtkComboBoxs.
+
 2006-06-04  David Hampton  <hampton at employees.org>
 
 	* src/business/business-gnome/search-owner.c:

Modified: gnucash/branches/deprecated-cleanup/src/business/business-gnome/business-gnome-utils.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/business-gnome/business-gnome-utils.c	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/business-gnome/business-gnome-utils.c	2006-06-06 04:37:15 UTC (rev 14341)
@@ -32,6 +32,7 @@
 #include "gnc-ui-util.h"
 #include "qof.h"
 #include "gnc-component-manager.h"
+#include "gnc-gtk-utils.h"
 
 #include "gncCustomer.h"
 #include "gncJob.h"
@@ -304,20 +305,27 @@
 gnc_fill_account_select_combo (GtkWidget *combo, GNCBook *book,
 			       GList *acct_types)
 {
-  GList *list, *node, *names = NULL;
+  GtkListStore *store;
+  GtkEntry *entry;
+  GList *list, *node;
   char *text;
-  gboolean found = FALSE;
 
-  g_return_if_fail (combo);
+  g_return_if_fail (combo && GTK_IS_COMBO_BOX_ENTRY(combo));
   g_return_if_fail (book);
   g_return_if_fail (acct_types);
 
   /* Figure out if anything is set in the combo */
-  text = gtk_editable_get_chars (GTK_EDITABLE ((GTK_COMBO (combo))->entry), 0, -1);
+  text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
 
   list = xaccGroupGetSubAccounts (gnc_book_get_group (book));
 
-  /* Create a list of names.  Figure out if we've got the 'saved' one */
+  /* Clear the existing list */
+  entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo)));
+  gtk_entry_set_text(entry, "");
+  store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)));
+  gtk_list_store_clear(store);
+
+ /* Add the account names to the combo box */
   for (node = list; node; node = node->next) {
     Account *account = node->data;
     char *name;
@@ -328,28 +336,15 @@
       continue;
 
     name = xaccAccountGetFullName (account);
-    if (name != NULL) {
-      names = g_list_append (names, name);
-      if (!safe_strcmp (name, text))
-	found = TRUE;
-    }
+    gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
+    g_free(name);
   }
+  gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
 
   g_list_free (list);
 
-  /* set the popdown strings and the default to last selected choice
-   * (or the first entry if none was previously selected */
+  gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(combo), text);
 
-  if (names) {
-    gtk_combo_set_popdown_strings (GTK_COMBO (combo), names);
-    gtk_entry_set_text (GTK_ENTRY ((GTK_COMBO (combo))->entry),
-			found ? text : names->data);
-  }
-
-  for (node = names; node; node = node->next)
-    g_free (node->data);
-  g_list_free (names);
-
   if (text)
     g_free (text);
 }

Modified: gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-billterms.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-billterms.c	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-billterms.c	2006-06-06 04:37:15 UTC (rev 14341)
@@ -48,6 +48,7 @@
 void billterms_edit_term_cb (GtkButton *button, BillTermsWindow *btw);
 void billterms_window_close (GtkWidget *widget, gpointer data);
 void billterms_window_destroy_cb (GtkWidget *widget, gpointer data);
+void billterms_type_combobox_changed (GtkComboBox *cb, gpointer data);
 
 typedef struct _billterm_notebook {
   GtkTooltips *		tooltips;
@@ -344,53 +345,16 @@
   show_notebook (&nbt->notebook);
 }
 
-static void
-on_days1_activate (GtkWidget *w, gpointer data)
+void
+billterms_type_combobox_changed (GtkComboBox *cb, gpointer data)
 {
   NewBillTerm *nbt = data;
+  gint value;
 
-  maybe_set_type (nbt, GNC_TERM_TYPE_DAYS);
+  value = gtk_combo_box_get_active(cb);
+  maybe_set_type (nbt, value + 1);
 }
 
-static void
-on_proximo1_activate (GtkWidget *w, gpointer data)
-{
-  NewBillTerm *nbt = data;
-
-  maybe_set_type (nbt, GNC_TERM_TYPE_PROXIMO);
-}
-
-static void
-make_menu (GtkWidget *omenu, NewBillTerm *nbt)
-{
-  GladeXML *xml;
-  GtkWidget *popup;
-
-  /* Open and read the Popup XML */
-  xml = gnc_glade_xml_new ("billterms.glade", "Term Type Popup");
-  popup = glade_xml_get_widget (xml, "Term Type Popup");
-
-  /* Glade insists on making this a tearoff menu. */
-  if (gnc_gconf_menus_have_tearoff()) {
-    GtkMenuShell *ms = GTK_MENU_SHELL (popup);
-    GtkWidget *tearoff;
-
-    tearoff = g_list_nth_data (ms->children, 0);
-    ms->children = g_list_remove (ms->children, tearoff);
-    gtk_widget_destroy (tearoff);
-  }
-
-  /* attach the signal handlers */
-  glade_xml_signal_connect_data (xml, "on_days1_activate",
-				 G_CALLBACK (on_days1_activate), nbt);
-  glade_xml_signal_connect_data (xml, "on_proximo1_activate",
-				 G_CALLBACK (on_proximo1_activate), nbt);
-
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), popup);
-  gtk_option_menu_set_history (GTK_OPTION_MENU (omenu),
-			       nbt->notebook.type - 1);
-}
-
 static GncBillTerm *
 new_billterm_dialog (BillTermsWindow *btw, GncBillTerm *term,
 		     const char *name)
@@ -398,7 +362,7 @@
   GncBillTerm *created_term = NULL;
   NewBillTerm *nbt;
   GladeXML *xml;
-  GtkWidget *box;
+  GtkWidget *box, *combo_box;
   gint response;
   gboolean done;
   const gchar *dialog_name;
@@ -434,7 +398,8 @@
     nbt->notebook.type = GNC_TERM_TYPE_DAYS;
 
   /* Create the menu */
-  make_menu (glade_xml_get_widget (xml, "type_menu"), nbt);
+  combo_box = glade_xml_get_widget (xml, "type_combobox");
+  gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), nbt->notebook.type - 1);
 
   /* Show the right notebook page */
   show_notebook (&nbt->notebook);

Modified: gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-payment.c	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/business-gnome/dialog-payment.c	2006-06-06 04:37:15 UTC (rev 14341)
@@ -34,6 +34,7 @@
 #include "qof.h"
 #include "gnc-date-edit.h"
 #include "gnc-amount-edit.h"
+#include "gnc-gtk-utils.h"
 #include "gnc-tree-view-account.h"
 #include "Transaction.h"
 #include "Account.h"
@@ -246,7 +247,7 @@
   }
 
   /* Verify the "post" account */
-  text = gtk_entry_get_text (GTK_ENTRY ((GTK_COMBO (pw->post_combo))->entry));
+  text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
   if (!text || safe_strcmp (text, "") == 0) {
     text = _("You must enter an account name for posting.");
     gnc_error_dialog (pw->dialog, text);
@@ -383,6 +384,7 @@
   pw->num_entry = glade_xml_get_widget (xml, "num_entry");
   pw->memo_entry = glade_xml_get_widget (xml, "memo_entry");
   pw->post_combo = glade_xml_get_widget (xml, "post_combo");
+  gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pw->post_combo));
 
   label = glade_xml_get_widget (xml, "owner_label");
   box = glade_xml_get_widget (xml, "owner_box");
@@ -451,7 +453,7 @@
     const gchar *text;
     const char *acct_type;
 
-    text = gtk_entry_get_text(GTK_ENTRY((GTK_COMBO(pw->post_combo))->entry));
+    text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
     if (!text || safe_strcmp (text, "") == 0) {
   
       /* XXX: I know there's only one type here */

Modified: gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/billterms.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/billterms.glade	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/billterms.glade	2006-06-06 04:37:15 UTC (rev 14341)
@@ -545,37 +545,6 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkOptionMenu" id="type_menu">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Choose the type of Billing Term</property>
-	      <property name="can_focus">True</property>
-	      <property name="history">0</property>
-
-	      <child internal-child="menu">
-		<widget class="GtkMenu" id="convertwidget3">
-		  <property name="visible">True</property>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="convertwidget4">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Type Menu</property>
-		      <property name="use_underline">True</property>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">5</property>
-	      <property name="bottom_attach">6</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkHBox" id="notebook_box">
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
@@ -769,7 +738,6 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
-		  <property name="mnemonic_widget">type_menu</property>
 		</widget>
 	      </child>
 	    </widget>
@@ -782,6 +750,24 @@
 	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkComboBox" id="type_combobox">
+	      <property name="visible">True</property>
+	      <property name="items" translatable="yes">Days
+Proximo</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="changed" handler="billterms_type_combobox_changed" last_modification_time="Tue, 06 Jun 2006 01:17:37 GMT"/>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">5</property>
+	      <property name="bottom_attach">6</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
@@ -1049,30 +1035,6 @@
   </child>
 </widget>
 
-<widget class="GtkMenu" id="Term Type Popup">
-  <property name="visible">True</property>
-
-  <child>
-    <widget class="GtkMenuItem" id="days1">
-      <property name="visible">True</property>
-      <property name="tooltip" translatable="yes">Number of days from now</property>
-      <property name="label" translatable="yes">Days</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_days1_activate"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkMenuItem" id="proximo1">
-      <property name="visible">True</property>
-      <property name="tooltip" translatable="yes">Absolute Day-of-the-month</property>
-      <property name="label" translatable="yes">Proximo</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_proximo1_activate"/>
-    </widget>
-  </child>
-</widget>
-
 <widget class="GtkWindow" id="Term Notebook">
   <property name="title" translatable="yes">window1</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>

Modified: gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/payment.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/payment.glade	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/business-gnome/glade/payment.glade	2006-06-06 04:37:15 UTC (rev 14341)
@@ -95,7 +95,7 @@
 		      <child>
 			<widget class="GtkLabel" id="owner_label">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="no">(owner)</property>
+			  <property name="label">(owner)</property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_RIGHT</property>
@@ -116,7 +116,7 @@
 		      <child>
 			<widget class="GtkLabel" id="invoice_label">
 			  <property name="visible">True</property>
-			  <property name="label" translatable="no">(invoice)</property>
+			  <property name="label">(invoice)</property>
 			  <property name="use_underline">False</property>
 			  <property name="use_markup">False</property>
 			  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -309,7 +309,7 @@
 			  <property name="max_length">0</property>
 			  <property name="text" translatable="yes"></property>
 			  <property name="has_frame">True</property>
-			  <property name="invisible_char" translatable="yes">*</property>
+			  <property name="invisible_char">*</property>
 			  <property name="activates_default">False</property>
 			</widget>
 			<packing>
@@ -328,7 +328,7 @@
 			  <property name="max_length">0</property>
 			  <property name="text" translatable="yes"></property>
 			  <property name="has_frame">True</property>
-			  <property name="invisible_char" translatable="yes">*</property>
+			  <property name="invisible_char">*</property>
 			  <property name="activates_default">False</property>
 			</widget>
 			<packing>
@@ -381,57 +381,11 @@
 	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 	      <child>
-		<widget class="GtkCombo" id="post_combo">
-		  <property name="border_width">3</property>
+		<widget class="GtkComboBoxEntry" id="post_combo">
 		  <property name="visible">True</property>
-		  <property name="value_in_list">True</property>
-		  <property name="allow_empty">False</property>
-		  <property name="case_sensitive">False</property>
-		  <property name="enable_arrow_keys">True</property>
-		  <property name="enable_arrows_always">False</property>
-
-		  <child internal-child="entry">
-		    <widget class="GtkEntry" id="combo-entry1">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="editable">True</property>
-		      <property name="visibility">True</property>
-		      <property name="max_length">0</property>
-		      <property name="text" translatable="yes"></property>
-		      <property name="has_frame">True</property>
-		      <property name="invisible_char" translatable="yes">*</property>
-		      <property name="activates_default">False</property>
-		    </widget>
-		  </child>
-
-		  <child internal-child="list">
-		    <widget class="GtkList" id="convertwidget1">
-		      <property name="visible">True</property>
-		      <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
-		      <child>
-			<widget class="GtkListItem" id="convertwidget2">
-			  <property name="visible">True</property>
-
-			  <child>
-			    <widget class="GtkLabel" id="convertwidget3">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes"></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</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
+		  <property name="items">Dummy Entry</property>
+		  <property name="has_frame">True</property>
+		  <property name="focus_on_click">True</property>
 		</widget>
 	      </child>
 

Modified: gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/dialog-tax-table.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/dialog-tax-table.c	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/dialog-tax-table.c	2006-06-06 04:37:15 UTC (rev 14341)
@@ -32,6 +32,7 @@
 #include "gnc-component-manager.h"
 #include "gnc-ui.h"
 #include "gnc-gui-query.h"
+#include "gnc-gtk-utils.h"
 #include "gnc-ui-util.h"
 #include "qof.h"
 #include "gnc-amount-edit.h"
@@ -178,45 +179,17 @@
 }
 
 static void
-optionmenu_changed (GtkWidget *widget, NewTaxTable *ntt)
+combo_changed (GtkWidget *widget, NewTaxTable *ntt)
 {
-  g_return_if_fail (ntt);
-  ntt->type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(widget), "option"));
-}
+  gint index;
 
-static GtkWidget *
-add_menu_item (GtkWidget *menu, NewTaxTable *ntt, char *label, gint type)
-	       
-{
-  GtkWidget *item;
+  g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+  g_return_if_fail(ntt);
 
-  item = gtk_menu_item_new_with_label (label);
-  g_object_set_data (G_OBJECT (item), "option", GINT_TO_POINTER (type));
-  g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (optionmenu_changed), ntt);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
-  return item;
+  index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+  ntt->type = index + 1;
 }
 
-static GtkWidget *
-make_menu (GtkWidget *omenu, NewTaxTable *ntt)
-{
-  GtkWidget *menu, *value, *percent;
-  int current = ntt->type - 1;
-
-  menu = gtk_menu_new ();
-  value = add_menu_item (menu, ntt, _("Value $"), GNC_AMT_TYPE_VALUE);
-  /* xgettext:no-c-format */
-  percent = add_menu_item (menu, ntt, _("Percent %"), GNC_AMT_TYPE_PERCENT);
-
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
-
-  g_signal_emit_by_name (G_OBJECT ((current == GNC_AMT_TYPE_VALUE-1 ?
-					value : percent)), "activate", ntt);
-  gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
-  return menu;
-}
-
 static GncTaxTable *
 new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
 		      GncTaxTableEntry *entry, const char *name)
@@ -224,9 +197,9 @@
   GncTaxTable *created_table = NULL;
   NewTaxTable *ntt;
   GladeXML *xml;
-  GtkWidget *box, *widget;
+  GtkWidget *box, *widget, *combo;
   gboolean done;
-  gint response;
+  gint response, index;
 
   if (!ttw) return NULL;
   if (new_table && entry) return NULL;
@@ -249,7 +222,10 @@
     gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
 
   /* Create the menu */
-  make_menu (glade_xml_get_widget (xml, "type_menu"), ntt);
+  combo = glade_xml_get_widget (xml, "type_combobox");
+  index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
+  gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
+  g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
 
   /* Attach our own widgets */
   box = glade_xml_get_widget (xml, "amount_box");

Modified: gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/tax-tables.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/tax-tables.glade	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/business/dialog-tax-table/tax-tables.glade	2006-06-06 04:37:15 UTC (rev 14341)
@@ -598,7 +598,7 @@
 		  <property name="yalign">0.5</property>
 		  <property name="xpad">0</property>
 		  <property name="ypad">0</property>
-		  <property name="mnemonic_widget">type_menu</property>
+		  <property name="mnemonic_widget">type_combobox</property>
 		</widget>
 	      </child>
 	    </widget>
@@ -633,43 +633,6 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkOptionMenu" id="type_menu">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="history">0</property>
-
-	      <child internal-child="menu">
-		<widget class="GtkMenu" id="convertwidget5">
-		  <property name="visible">True</property>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="convertwidget6">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Value ($)</property>
-		      <property name="use_underline">True</property>
-		    </widget>
-		  </child>
-
-		  <child>
-		    <widget class="GtkMenuItem" id="convertwidget7">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">Percent (%)</property>
-		      <property name="use_underline">True</property>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">4</property>
-	      <property name="bottom_attach">5</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkHBox" id="amount_box">
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
@@ -726,6 +689,23 @@
 	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkComboBox" id="type_combobox">
+	      <property name="visible">True</property>
+	      <property name="items" translatable="yes">Value $
+Percent %</property>
+	      <property name="focus_on_click">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">4</property>
+	      <property name="bottom_attach">5</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>

Modified: gnucash/branches/deprecated-cleanup/src/report/report-gnome/dialog-style-sheet.c
===================================================================
--- gnucash/branches/deprecated-cleanup/src/report/report-gnome/dialog-style-sheet.c	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/report/report-gnome/dialog-style-sheet.c	2006-06-06 04:37:15 UTC (rev 14341)
@@ -170,45 +170,45 @@
   SCM              templates = scm_c_eval_string("(gnc:get-html-templates)");
   SCM              t_name = scm_c_eval_string("gnc:html-style-sheet-template-name");
   SCM              new_ss = SCM_BOOL_F;
-  GtkWidget        * template_entry;
+  GtkWidget        * template_combo;
+  GtkTreeModel     * template_model;
   GtkWidget        * name_entry;
-  GtkWidget        * template_combo;
-  GList            * strings=NULL;
   gint             dialog_retval;
-  const char       * template_str = NULL;
+  char             * template_str = NULL;
   const char       * name_str = NULL;
 
   /* get the new name for the style sheet */
   GladeXML *xml = gnc_glade_xml_new ("report.glade",
                                      "New Style Sheet Dialog");
   GtkWidget * dlg = glade_xml_get_widget (xml, "New Style Sheet Dialog");
-  template_entry = glade_xml_get_widget (xml, "template_entry");
-  template_combo = glade_xml_get_widget (xml, "template_combo");
+  template_combo = glade_xml_get_widget (xml, "template_combobox");
   name_entry     = glade_xml_get_widget (xml, "name_entry");
 
+  /* Erase the initial dummy entry. */
+  template_model = gtk_combo_box_get_model(GTK_COMBO_BOX(template_combo));
+  gtk_list_store_clear(GTK_LIST_STORE(template_model));
+
   /* put in the list of style sheet type names */
   for(; !SCM_NULLP(templates); templates=SCM_CDR(templates)) {
     SCM t = SCM_CAR(templates);
-    strings = g_list_append(strings, SCM_STRING_CHARS(scm_call_1(t_name, t)));
+    gtk_combo_box_append_text(GTK_COMBO_BOX(template_combo),
+			      SCM_STRING_CHARS(scm_call_1(t_name, t)));
   }
+  gtk_combo_box_set_active(GTK_COMBO_BOX(template_combo), 0);
   
-  gtk_combo_set_popdown_strings(GTK_COMBO(template_combo), strings);
-  
-  /* The strings on the list are const.  Just free the list. */
-  g_list_free(strings);
-
   /* get the name */
   gtk_window_set_transient_for (GTK_WINDOW(dlg), GTK_WINDOW(ssd->toplevel));
   dialog_retval = gtk_dialog_run(GTK_DIALOG(dlg));
 
   if(dialog_retval == GTK_RESPONSE_OK) {
-    template_str = gtk_entry_get_text(GTK_ENTRY(template_entry));
+    template_str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(template_combo));
     name_str     = gtk_entry_get_text(GTK_ENTRY(name_entry));
     if(template_str && name_str) {
       new_ss = scm_call_2(make_ss, 
 			  scm_makfrom0str(template_str),
 			  scm_makfrom0str(name_str));
     }
+    g_free(template_str);
   }
 
   gtk_widget_destroy(dlg);

Modified: gnucash/branches/deprecated-cleanup/src/report/report-gnome/report.glade
===================================================================
--- gnucash/branches/deprecated-cleanup/src/report/report-gnome/report.glade	2006-06-06 03:56:08 UTC (rev 14340)
+++ gnucash/branches/deprecated-cleanup/src/report/report-gnome/report.glade	2006-06-06 04:37:15 UTC (rev 14341)
@@ -131,7 +131,7 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
-	      <property name="mnemonic_widget">template_entry</property>
+	      <property name="mnemonic_widget">template_combobox</property>
 	    </widget>
 	    <packing>
 	      <property name="left_attach">0</property>
@@ -166,63 +166,18 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkCombo" id="template_combo">
+	    <widget class="GtkComboBox" id="template_combobox">
 	      <property name="visible">True</property>
-	      <property name="value_in_list">False</property>
-	      <property name="allow_empty">True</property>
-	      <property name="case_sensitive">False</property>
-	      <property name="enable_arrow_keys">True</property>
-	      <property name="enable_arrows_always">False</property>
-
-	      <child internal-child="entry">
-		<widget class="GtkEntry" id="template_entry">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="editable">True</property>
-		  <property name="visibility">True</property>
-		  <property name="max_length">0</property>
-		  <property name="text" translatable="yes"></property>
-		  <property name="has_frame">True</property>
-		  <property name="invisible_char">*</property>
-		  <property name="activates_default">False</property>
-		</widget>
-	      </child>
-
-	      <child internal-child="list">
-		<widget class="GtkList" id="convertwidget1">
-		  <property name="visible">True</property>
-		  <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
-		  <child>
-		    <widget class="GtkListItem" id="convertwidget2">
-		      <property name="visible">True</property>
-
-		      <child>
-			<widget class="GtkLabel" id="convertwidget3">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes"></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</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
+	      <property name="items">Dummy Entry</property>
+	      <property name="focus_on_click">True</property>
 	    </widget>
 	    <packing>
 	      <property name="left_attach">1</property>
 	      <property name="right_attach">2</property>
 	      <property name="top_attach">1</property>
 	      <property name="bottom_attach">2</property>
-	      <property name="y_options"></property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 	</widget>



More information about the gnucash-changes mailing list