aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog7
-rw-r--r--widgets/misc/e-filter-bar.c11
-rw-r--r--widgets/table/ChangeLog10
-rw-r--r--widgets/table/e-tree.c71
-rw-r--r--widgets/table/e-tree.h2
5 files changed, 98 insertions, 3 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 46d95c292c..4b91f93784 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,10 @@
+2008-04-30 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #528288
+
+ * e-filter-bar.c: (get_property): Do not return any query
+ with empty text from search bar.
+
2008-04-25 Danny Baumann <dannybaumann@web.de>
** Fix for bug #529893
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index be77dbdb39..20d85d8f63 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -592,8 +592,11 @@ get_property (GObject *object, guint property_id, GValue *value, GParamSpec *psp
ESearchBar *esb = E_SEARCH_BAR (object);
switch (property_id) {
- case PROP_QUERY:
- if (efb->current_query) {
+ case PROP_QUERY: {
+ char *text = e_search_bar_get_text (E_SEARCH_BAR (efb));
+
+ /* empty search text means searching turned off */
+ if (efb->current_query && text && *text) {
GString *out = g_string_new ("");
filter_rule_build_code (efb->current_query, out);
@@ -602,7 +605,9 @@ get_property (GObject *object, guint property_id, GValue *value, GParamSpec *psp
} else {
g_value_set_string (value, NULL);
}
- break;
+
+ g_free (text);
+ break; }
case PROP_STATE: {
/* FIXME: we should have ESearchBar save its own state to the xmlDocPtr */
xmlChar *xmlbuf;
diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog
index f872c0dc92..ae3ab90667 100644
--- a/widgets/table/ChangeLog
+++ b/widgets/table/ChangeLog
@@ -1,3 +1,13 @@
+2008-04-30 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #528288
+
+ * e-tree.h: (e_tree_set_info_message):
+ * e-tree.c: (struct ETreePriv), (et_dispose), (e_tree_init),
+ (tree_size_allocate), (e_tree_set_info_message):
+ Allow setting info message into the tree. It doesn't check
+ whether the tree is empty or not, so take care of that.
+
2008-04-25 Danny Baumann <dannybaumann@web.de>
** Fix for bug #529893
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 7617f25f05..631824a86b 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -36,7 +36,9 @@
#include "e-util/e-util.h"
#include "e-util/e-util-marshal.h"
#include "misc/e-canvas.h"
+#include "misc/e-canvas-utils.h"
#include "misc/e-canvas-background.h"
+#include "text/e-text.h"
#include "e-table-column-specification.h"
#include "e-table-header-item.h"
@@ -139,6 +141,9 @@ struct ETreePriv {
int table_cell_change_id;
int table_rows_delete_id;
+ GnomeCanvasItem *info_text;
+ guint info_text_resize_id;
+
GnomeCanvas *header_canvas, *table_canvas;
GnomeCanvasItem *header_item, *root;
@@ -421,6 +426,11 @@ et_dispose (GObject *object)
g_object_weak_unref (G_OBJECT(et->priv->last_drop_context), context_destroyed, et);
et->priv->last_drop_context = NULL;
+ if (et->priv->info_text)
+ gtk_object_destroy (GTK_OBJECT (et->priv->info_text));
+ et->priv->info_text = NULL;
+ et->priv->info_text_resize_id = 0;
+
gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas));
g_free(et->priv);
@@ -597,6 +607,9 @@ e_tree_init (ETree *e_tree)
#endif
e_tree->priv->spec = NULL;
+ e_tree->priv->info_text = NULL;
+ e_tree->priv->info_text_resize_id = 0;
+
e_tree->priv->header_canvas = NULL;
e_tree->priv->table_canvas = NULL;
@@ -3363,3 +3376,61 @@ e_tree_class_init (ETreeClass *class)
gal_a11y_e_tree_init ();
}
+static void
+tree_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *tree)
+{
+ double width;
+
+ g_return_if_fail (tree != NULL);
+ g_return_if_fail (tree->priv != NULL);
+ g_return_if_fail (tree->priv->info_text != NULL);
+
+ gnome_canvas_get_scroll_region (GNOME_CANVAS (tree->priv->table_canvas), NULL, NULL, &width, NULL);
+
+ width -= 60.0;
+
+ g_object_set (tree->priv->info_text, "width", width, "clip_width", width, NULL);
+}
+
+/**
+ * e_tree_set_info_message:
+ * @tree: #ETree instance
+ * @info_message: Message to set. Can be NULL.
+ *
+ * Creates an info message in table area, or removes old.
+ **/
+void
+e_tree_set_info_message (ETree *tree, const char *info_message)
+{
+ g_return_if_fail (tree != NULL);
+ g_return_if_fail (tree->priv != NULL);
+
+ if (!tree->priv->info_text && (!info_message || !*info_message))
+ return;
+
+ if (!info_message || !*info_message) {
+ g_signal_handler_disconnect (tree, tree->priv->info_text_resize_id);
+ gtk_object_destroy (GTK_OBJECT (tree->priv->info_text));
+ tree->priv->info_text = NULL;
+ return;
+ }
+
+ if (!tree->priv->info_text) {
+ tree->priv->info_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (gnome_canvas_root (tree->priv->table_canvas)),
+ e_text_get_type (),
+ "anchor", GTK_ANCHOR_NW,
+ "line_wrap", TRUE,
+ "clip", TRUE,
+ "justification", GTK_JUSTIFY_LEFT,
+ "text", info_message,
+ "draw_background", FALSE,
+ "width", (double) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
+ "clip_width", (double) GTK_WIDGET (tree->priv->table_canvas)->allocation.width - 60.0,
+ NULL);
+
+ e_canvas_item_move_absolute (tree->priv->info_text, 30, 30);
+
+ tree->priv->info_text_resize_id = g_signal_connect (tree, "size_allocate", G_CALLBACK (tree_size_allocate), tree);
+ } else
+ gnome_canvas_item_set (tree->priv->info_text, "text", info_message, NULL);
+}
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
index 2b3de1b042..03c67a0563 100644
--- a/widgets/table/e-tree.h
+++ b/widgets/table/e-tree.h
@@ -309,6 +309,8 @@ ETableItem * e_tree_get_item(ETree * et);
GnomeCanvasItem * e_tree_get_header_item(ETree * et);
+void e_tree_set_info_message (ETree *tree, const char *info_message);
+
G_END_DECLS
#endif /* _E_TREE_H_ */