aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-05 13:50:37 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-05 13:50:37 +0800
commit067467c916abfb32a94f0d38823329219807f017 (patch)
tree5556297972b10432491718f8177242c25ebbbeb1
parentbd2f1603e5eb577e9b57ecf02701e5bfbfebb9b0 (diff)
downloadgsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar.gz
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar.bz2
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar.lz
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar.xz
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.tar.zst
gsoc2013-evolution-067467c916abfb32a94f0d38823329219807f017.zip
[Added an "Activate" button to the search bar.]
* e-search-bar.c (submit_button_clicked_cb): Callback for the "clicked" signal on the activate button. (add_submit): New function to add a "Activate" button on the right of the entry. (e_search_bar_construct): Call it. (add_spacer): Removed. (e_search_bar_construct): Don't call it. (find_id): Remove debugging message. (put_in_spacer_widget): New utility function to create a GtkEventBox with a border width of one and put a widget into it. svn path=/trunk/; revision=11690
-rw-r--r--widgets/misc/ChangeLog15
-rw-r--r--widgets/misc/e-search-bar.c67
-rw-r--r--widgets/misc/e-search-bar.h1
3 files changed, 66 insertions, 17 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 1dd673ad6d..e3017edf31 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,18 @@
+2001-08-05 Ettore Perazzoli <ettore@ximian.com>
+
+ [Added an "Activate" button to the search bar.]
+
+ * e-search-bar.c (submit_button_clicked_cb): Callback for the
+ "clicked" signal on the activate button.
+ (add_submit): New function to add a "Activate" button on the right
+ of the entry.
+ (e_search_bar_construct): Call it.
+ (add_spacer): Removed.
+ (e_search_bar_construct): Don't call it.
+ (find_id): Remove debugging message.
+ (put_in_spacer_widget): New utility function to create a
+ GtkEventBox with a border width of one and put a widget into it.
+
2001-08-04 Ettore Perazzoli <ettore@ximian.com>
* e-title-bar.c: Make the close icon as large as the pin icon so
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index e530e29591..67fba951fe 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -26,7 +26,6 @@
#include <config.h>
-#include <stdio.h> /* printf */
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkmenuitem.h>
@@ -110,10 +109,36 @@ entry_activated_cb (GtkWidget *widget,
emit_query_changed (esb);
}
+static void
+activate_button_clicked_cb (GtkWidget *widget,
+ ESearchBar *esb)
+{
+ emit_query_changed (esb);
+}
+
/* Widgetry creation. */
-static void add_dropdown(ESearchBar *esb, ESearchBarItem *items)
+/* This function exists to fix the irreparable GtkOptionMenu stupidity. In
+ fact, this lame-ass widget adds a 1-pixel-wide empty border around the
+ button for no reason. So we have add a 1-pixel-wide border around the the
+ buttons we have in the search bar to make things look right. This is done
+ through an event box. */
+static GtkWidget *
+put_in_spacer_widget (GtkWidget *widget)
+{
+ GtkWidget *holder;
+
+ holder = gtk_event_box_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (holder), 1);
+ gtk_container_add (GTK_CONTAINER (holder), widget);
+
+ return holder;
+}
+
+static void
+add_dropdown (ESearchBar *esb,
+ ESearchBarItem *items)
{
GtkWidget *menu = esb->dropdown_menu;
GtkWidget *item;
@@ -156,15 +181,11 @@ set_dropdown (ESearchBar *esb,
gtk_widget_show (dropdown);
if (esb->dropdown_holder == NULL) {
+ /* See the comment in `put_in_spacer_widget()' to understand
+ why we have to do this. */
- /* So, GtkOptionMenu is stupid; it adds a 1-pixel-wide empty border
- around the button for no reason. So we add a 1-pixel-wide border
- around the button as well, by using an event box. */
-
- esb->dropdown_holder = gtk_event_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (esb->dropdown_holder), 1);
+ esb->dropdown_holder = put_in_spacer_widget (dropdown);
esb->dropdown = dropdown;
- gtk_container_add (GTK_CONTAINER (esb->dropdown_holder), esb->dropdown);
gtk_widget_show (esb->dropdown_holder);
gtk_box_pack_start(GTK_BOX(esb), esb->dropdown_holder, FALSE, FALSE, 0);
@@ -243,15 +264,28 @@ add_entry (ESearchBar *esb)
}
static void
-add_spacer (ESearchBar *esb)
+add_activate_button (ESearchBar *esb)
{
- GtkWidget *spacer;
+ GtkWidget *label;
+ GtkWidget *holder;
+
+ label = gtk_label_new (_("Activate"));
+ gtk_widget_show (label);
+
+ /* See the comment in `put_in_spacer_widget()' to understand
+ why we have to do this. */
+
+ esb->activate_button = gtk_button_new ();
+ gtk_widget_show (esb->activate_button);
+ gtk_container_add (GTK_CONTAINER (esb->activate_button), label);
+
+ holder = put_in_spacer_widget (esb->activate_button);
+ gtk_widget_show (holder);
- spacer = gtk_drawing_area_new();
- gtk_widget_show(spacer);
- gtk_box_pack_start(GTK_BOX(esb), spacer, FALSE, FALSE, 0);
+ gtk_signal_connect (GTK_OBJECT (esb->activate_button), "clicked",
+ GTK_SIGNAL_FUNC (activate_button_clicked_cb), esb);
- gtk_widget_set_usize(spacer, 19, 1);
+ gtk_box_pack_start (GTK_BOX (esb), holder, FALSE, FALSE, 0);
}
static int
@@ -264,7 +298,6 @@ find_id(GtkWidget *menu, int idin, const char *type, GtkWidget **widget)
*widget = NULL;
while (l) {
id = GPOINTER_TO_INT(gtk_object_get_data(l->data, type));
- printf("comparing id %d to query %d\n", id, idin);
if (id == idin) {
row = i;
if (widget)
@@ -405,7 +438,7 @@ e_search_bar_construct (ESearchBar *search_bar,
add_entry (search_bar);
- add_spacer (search_bar);
+ add_activate_button (search_bar);
}
void
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index 9cdb83d029..3ca381f92e 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -65,6 +65,7 @@ struct _ESearchBar
GtkWidget *dropdown_holder; /* holds the dropdown */
GtkWidget *option_menu;
GtkWidget *dropdown_menu;
+ GtkWidget *activate_button;
int option_choice;
};