[PATCH v2 1/1] cli: Guard deprecated g_type_init calls

2013-06-07 Thread Tomi Ollila
g_type_init was deprecated in GLib 2.35.1.  In order to compile
cleanly, guard these with a suitable #if.

(commit msg from https://bugs.freedesktop.org/attachment.cgi?id=73774 )
---

v2 of id:1370614090-1715-1-git-send-email-tomi.ollila at iki.fi

database.cc was not caught by my na?ve grep g_type_init **/*.c
(have to learn git grep !)

also added back one newline removed in v1

 lib/database.cc | 2 ++
 notmuch.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 52ed618..5cc0765 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -649,7 +649,9 @@ notmuch_database_open (const char *path,
 }

 /* Initialize the GLib type system and threads */
+#if !GLIB_CHECK_VERSION(2, 35, 1)
 g_type_init ();
+#endif

 /* Initialize gmime */
 if (! initialized) {
diff --git a/notmuch.c b/notmuch.c
index 99ddd6d..45a73ce 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -291,7 +291,9 @@ main (int argc, char *argv[])
 local = talloc_new (NULL);

 g_mime_init (0);
+#if !GLIB_CHECK_VERSION(2, 35, 1)
 g_type_init ();
+#endif

 /* Globally default to the current output format version. */
 notmuch_format_version = NOTMUCH_FORMAT_CUR;
-- 
1.8.0



[PATCH 1/1] cli: Guard deprecated g_type_init calls

2013-06-07 Thread Tomi Ollila
g_type_init was deprecated in GLib 2.35.1.  In order to compile
cleanly, guard these with a suitable #if.

(commit msg from https://bugs.freedesktop.org/attachment.cgi?id=73774 )
---
 notmuch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/notmuch.c b/notmuch.c
index 99ddd6d..f9902ed 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -291,8 +291,9 @@ main (int argc, char *argv[])
 local = talloc_new (NULL);

 g_mime_init (0);
+#if !GLIB_CHECK_VERSION(2, 35, 1)
 g_type_init ();
-
+#endif
 /* Globally default to the current output format version. */
 notmuch_format_version = NOTMUCH_FORMAT_CUR;

-- 
1.8.0



[PATCH v2 2/2] emacs: hello: allow deleting individual searches in the history

2013-06-07 Thread Servilio Afre Puentes

This commit adds an extra button at the end of the search entries that
allows deleting that individual search from the history. A short
confirmation (?y? or ?n?) is made before taking action.
---
 emacs/notmuch-hello.el | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1ad1bea..147c08c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -286,6 +286,15 @@ afterwards.")
 (message "Saved '%s' as '%s'." search name)
 (notmuch-hello-update)))

+(defun notmuch-hello-delete-search-from-history (widget)
+  (interactive)
+  (let ((search (widget-value
+(symbol-value
+ (widget-get widget :notmuch-saved-search-widget)
+(setq notmuch-search-history (delete search
+notmuch-search-history))
+(notmuch-hello-update)))
+
 (defun notmuch-hello-longest-label (searches-alist)
   (or (loop for elem in searches-alist
maximize (length (car elem)))
@@ -624,7 +633,12 @@ Complete list of currently available key bindings:
;; `[save]' button. 6
;; for the `[save]'
;; button.
-   1 6))
+   1 6
+   ;; 1 for the space
+   ;; before the `[del]'
+   ;; button. 5 for the
+   ;; `[del]' button.
+   1 5))
  :action (lambda (widget  ignore)
(notmuch-hello-search (widget-value 
widget)))
  search))
@@ -633,7 +647,14 @@ Complete list of currently available key bindings:
 :notify (lambda (widget  ignore)
   (notmuch-hello-add-saved-search widget))
 :notmuch-saved-search-widget widget-symbol
-"save"))
+"save")
+ (widget-insert " ")
+ (widget-create 'push-button
+:notify (lambda (widget  ignore)
+  (when (y-or-n-p "Are you sure you want 
to delete this search? ")
+
(notmuch-hello-delete-search-from-history widget)))
+:notmuch-saved-search-widget widget-symbol
+"del"))
(widget-insert "\n"))
   (indent-rigidly start (point) notmuch-hello-indent))
 nil))
-- 
1.8.3



[PATCH v2 1/2] emacs: hello: ask confirmation for clearing recent searches

2013-06-07 Thread Servilio Afre Puentes

The button to clear the recent searches in notmuch-hello is easy to
press accidentally while moving around the, clearing potentially
useful searches with no way of recovering them.
---
 emacs/notmuch-hello.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index c1c6f4b..1ad1bea 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -599,8 +599,9 @@ Complete list of currently available key bindings:
 (widget-insert "Recent searches: ")
 (widget-create 'push-button
   :notify (lambda ( ignore)
-(setq notmuch-search-history nil)
-(notmuch-hello-update))
+(when (y-or-n-p "Are you sure you want to clear 
the searches? ")
+  (setq notmuch-search-history nil)
+  (notmuch-hello-update)))
   "clear")
 (widget-insert "\n\n")
 (let ((start (point)))
-- 
1.8.3



[PATCH v2 0/2] Enhancements to notmuch-hello search history

2013-06-07 Thread Servilio Afre Puentes
Hi,

Two patches that enhance the notmuch-hello search history UI. Though
minor changes, I find them very helpful.

This second iteration includes the modifications suggested by Jani and
Tomi.

Servilio Afre Puentes (2):
  emacs: hello: ask confirmation for clearing recent searches
  emacs: hello: allow deleting individual searches in the history

 emacs/notmuch-hello.el | 30 ++
 1 file changed, 26 insertions(+), 4 deletions(-)

-- 
1.8.3