aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-08-15 01:48:08 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-08-15 01:48:08 +0800
commit84eb55399b9ac31c9b213316cf6cfff3df3a07f1 (patch)
tree8892989792c12fcda48b560f18730bfb71a8f78b /widgets
parent250946204244dce6c91d99ce4f573ae3de2dcb7a (diff)
downloadgsoc2013-evolution-84eb55399b9ac31c9b213316cf6cfff3df3a07f1.tar.gz
gsoc2013-evolution-84eb55399b9ac31c9b213316cf6cfff3df3a07f1.tar.zst
gsoc2013-evolution-84eb55399b9ac31c9b213316cf6cfff3df3a07f1.zip
Correctness fixes for when the entry and submenu must be interchanged.
2001-08-14 Federico Mena Quintero <federico@ximian.com> * e-search-bar.c (activate_by_subitems): Correctness fixes for when the entry and submenu must be interchanged. svn path=/trunk/; revision=12019
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog5
-rw-r--r--widgets/misc/e-search-bar.c69
2 files changed, 50 insertions, 24 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index ce4994f43f..00fe03d944 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,5 +1,10 @@
2001-08-14 Federico Mena Quintero <federico@ximian.com>
+ * e-search-bar.c (activate_by_subitems): Correctness fixes for
+ when the entry and submenu must be interchanged.
+
+2001-08-14 Federico Mena Quintero <federico@ximian.com>
+
*Please* add accessor functions instead of just object arguments!
* e-search-bar.c (e_search_bar_set_option_choice): New function.
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index ad5e07d523..5dd7ac1938 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -125,41 +125,69 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
if (subitems == NULL) {
/* This item uses the entry. */
+ /* Remove the menu */
+ if (esb->suboption && esb->suboption_choice != -1) {
+ g_assert (esb->suboption->parent == esb->entry_box);
+ g_assert (!esb->entry || esb->entry->parent == NULL);
+ gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->suboption);
+ }
+
+ /* Create and add the entry */
+
if (esb->entry == NULL) {
esb->entry = gtk_entry_new();
gtk_object_ref (GTK_OBJECT (esb->entry));
gtk_signal_connect (GTK_OBJECT (esb->entry), "activate",
GTK_SIGNAL_FUNC (entry_activated_cb), esb);
+ gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
gtk_widget_show(esb->entry);
- esb->suboption_choice = 0;
+ esb->suboption_choice = -1;
}
-
- if (esb->suboption_choice >= 0) {
- if (esb->suboption != NULL) {
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->suboption);
- }
-
+ if (esb->suboption_choice == -1) {
+ g_assert (esb->entry->parent == esb->entry_box);
+ g_assert (!esb->suboption || esb->suboption->parent == NULL);
+ } else {
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
+ esb->suboption_choice = -1;
}
-
+
gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
-
- esb->suboption_choice = -1;
-
} else {
-
+ /* This item uses a submenu */
GtkWidget *menu;
GtkWidget *menu_item;
gint i;
+ /* Remove the entry */
+ if (esb->entry && esb->suboption_choice == -1) {
+ g_assert (esb->entry->parent == esb->entry_box);
+ g_assert (!esb->suboption || esb->suboption->parent == NULL);
+ gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->entry);
+ }
+
+ /* Create and add the menu */
+
if (esb->suboption == NULL) {
esb->suboption = gtk_option_menu_new ();
gtk_object_ref (GTK_OBJECT (esb->suboption));
+ gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
gtk_widget_show (esb->suboption);
+
+ esb->suboption_choice = subitems[0].id;
}
+ if (esb->suboption_choice != -1) {
+ g_assert (esb->suboption->parent == esb->entry_box);
+ g_assert (!esb->entry || esb->entry->parent == NULL);
+ } else {
+ gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
+ esb->suboption_choice = subitems[0].id;
+ }
+
+ /* Create the items */
+
esb->suboption_menu = menu = gtk_menu_new ();
for (i = 0; subitems[i].id != -1; ++i) {
if (subitems[i].text) {
@@ -176,8 +204,10 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
gtk_widget_set_sensitive (menu_item, FALSE);
}
- gtk_object_set_data (GTK_OBJECT (menu_item), "EsbItemId", GINT_TO_POINTER (item_id));
- gtk_object_set_data (GTK_OBJECT (menu_item), "EsbSubitemId", GINT_TO_POINTER (subitems[i].id));
+ gtk_object_set_data (GTK_OBJECT (menu_item), "EsbItemId",
+ GINT_TO_POINTER (item_id));
+ gtk_object_set_data (GTK_OBJECT (menu_item), "EsbSubitemId",
+ GINT_TO_POINTER (subitems[i].id));
gtk_signal_connect (GTK_OBJECT (menu_item),
"activate",
@@ -190,19 +220,10 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
gtk_option_menu_remove_menu (GTK_OPTION_MENU (esb->suboption));
gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->suboption), menu);
-
- if (esb->entry != NULL) {
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->entry);
- }
-
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
-
- esb->suboption_choice = subitems[0].id;
}
- if (esb->activate_button) {
+ if (esb->activate_button)
gtk_widget_set_sensitive (esb->activate_button, subitems == NULL);
- }
}
static void
01-082-3/+5 * - Update to 2.10.5Sunpoet Po-Chuan Hsieh2014-12-242-3/+3 * - Update to 2.10.4Sunpoet Po-Chuan Hsieh2014-12-212-3/+4 * - Update to 2.10.2Sunpoet Po-Chuan Hsieh2014-12-132-3/+3 * - Update to 2.10.1Sunpoet Po-Chuan Hsieh2014-12-072-3/+3 * - Update to 2.10.0Sunpoet Po-Chuan Hsieh2014-12-052-3/+3 * - Update to 2.9.0Sunpoet Po-Chuan Hsieh2014-12-042-3/+3 * - Update to 2.8.2Sunpoet Po-Chuan Hsieh2014-11-252-4/+4 * - Update to 2.6.1Sunpoet Po-Chuan Hsieh2014-05-082-3/+3 * - Update to 2.6.0Sunpoet Po-Chuan Hsieh2014-03-262-4/+4 * - Update to 2.5.1Sunpoet Po-Chuan Hsieh2014-02-272-4/+4 * - Update to 2.5.0Sunpoet Po-Chuan Hsieh2014-02-252-3/+3 * - Update to 2.4.0Sunpoet Po-Chuan Hsieh2014-02-102-3/+3 * - Update to 2.3.0Sunpoet Po-Chuan Hsieh2014-01-192-3/+3 * - Update to 2.2.5Sunpoet Po-Chuan Hsieh2013-12-192-3/+3 * - Update to 2.2.4Sunpoet Po-Chuan Hsieh2013-11-182-3/+3 * - Update to 2.2.3Sunpoet Po-Chuan Hsieh2013-11-062-3/+3 * - Update to 2.2.2Sunpoet Po-Chuan Hsieh2013-10-262-4/+3 * - Update to 2.2.1Sunpoet Po-Chuan Hsieh2013-10-252-3/+3 * - Update to 2.1.1Sunpoet Po-Chuan Hsieh2013-10-202-3/+3 * - Update to 2.1.0Sunpoet Po-Chuan Hsieh2013-10-192-4/+4 * - Update to 2.0.5Sunpoet Po-Chuan Hsieh2013-10-132-3/+3 * - Update to 2.0.4Sunpoet Po-Chuan Hsieh2013-10-112-3/+3 * - Update to 2.0.3Sunpoet Po-Chuan Hsieh2013-10-082-3/+3 * - Update to 2.0.2Sunpoet Po-Chuan Hsieh2013-10-082-3/+3 * - Update to 2.0.1Sunpoet Po-Chuan Hsieh2013-10-072-8/+8 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...Baptiste Daroussin2013-09-211-0/+1 * - Update to 1.8.3Sunpoet Po-Chuan Hsieh2013-09-182-4/+4 * - Update to 1.8.2Sunpoet Po-Chuan Hsieh2013-08-062-3/+3 * - Update to 1.8.1Sunpoet Po-Chuan Hsieh2013-06-222-3/+3 * - Add LICENSESunpoet Po-Chuan Hsieh2013-06-091-0/+2 * - Update to 1.8.0Sunpoet Po-Chuan Hsieh2013-04-212-4/+4 * - Update to 1.7.0Sunpoet Po-Chuan Hsieh2013-04-172-5/+5 * - Update to 1.6.2Sunpoet Po-Chuan Hsieh2013-01-312-3/+4 * - Update to 1.6.0Sunpoet Po-Chuan Hsieh2012-12-242-4/+4 * - Update to 1.5.4Sunpoet Po-Chuan Hsieh2012-12-042-8/+6 * - Update to 1.4.0Sunpoet Po-Chuan Hsieh2012-09-302-4/+4 * - Update to 1.0.3Sunpoet Po-Chuan Hsieh2012-05-152-3/+3 * - Update to 1.0.2Sunpoet Po-Chuan Hsieh2012-05-022-3/+3 * - Update to 1.0.1Sunpoet Po-Chuan Hsieh2012-03-122-3/+3 * - Update to 1.0.0Sunpoet Po-Chuan Hsieh2012-01-262-3/+3 * - Update to 0.10.0Sunpoet Po-Chuan Hsieh2012-01-043-4/+4 * - Update to 0.9.4Sunpoet Po-Chuan Hsieh2011-12-263-4/+5 * - Update to 0.9.3Sunpoet Po-Chuan Hsieh2011-12-242-3/+3 * - Update to 0.9.1Sunpoet Po-Chuan Hsieh2011-12-212-4/+5 * - One WWW line in pkg-descr will do just finePhilip M. Gollucci2011-12-201-1/+0 * - Fix CATEGORIES: it should be rubygems, not rubySunpoet Po-Chuan Hsieh2011-11-171-1/+1 * - Add RG as secondary WWWSunpoet Po-Chuan Hsieh2011-10-291-0/+1 * - Update to 0.8.8Sunpoet Po-Chuan Hsieh2011-10-242-3/+3