2005-09-12 [paul] 1.9.14cvs21
authorPaul Mangan <paul@claws-mail.org>
Mon, 12 Sep 2005 09:44:30 +0000 (09:44 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 12 Sep 2005 09:44:30 +0000 (09:44 +0000)
* AUTHORS
* src/gtk/logwindow.c
add 'Clear Log' to popup menu
Patch by Anders Hammar <anders.hammar@telia.com>

AUTHORS
ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/gtk/logwindow.c

diff --git a/AUTHORS b/AUTHORS
index bb449ff0ed388b8d6569767bc4e1697a4b685538..58597882b8a393282eeaafc60a8bc4de769e638f 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -230,3 +230,4 @@ contributors (beside the above; based on Changelog)
        M. Benkmann
        Yang Guilong
        Daniel Gustafson
+       Anders Hammar
index 61ef7caaa700d00506104aebcc1b8b77b649975d..65313ad48c6b6ab6801224ec4b1a18c187d415a2 100644 (file)
@@ -1,3 +1,10 @@
+2005-09-12 [paul]      1.9.14cvs21
+
+       * AUTHORS
+       * src/gtk/logwindow.c
+               add 'Clear Log' to popup menu
+               Patch by Anders Hammar <anders.hammar@telia.com>
+
 2005-09-12 [paul]      1.9.14cvs20
 
        * src/compose.c
index a4377d9eb9b1aea808df3c9755cd937a0639eb14..3c602fff5551e6aaee5c7345e67931c872797d20 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/pgpcore/select-keys.c;  ) > 1.9.14cvs18.patchset
 ( cvs diff -u -r 1.3.2.24 -r 1.3.2.25 src/prefs_themes.c;  cvs diff -u -r 1.5.2.10 -r 1.5.2.11 src/gtk/description_window.c;  cvs diff -u -r 1.30.2.4 -r 1.30.2.5 tools/README;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/claws.i18n.status.pl;  ) > 1.9.14cvs19.patchset
 ( cvs diff -u -r 1.382.2.165 -r 1.382.2.166 src/compose.c;  cvs diff -u -r 1.213.2.55 -r 1.213.2.56 src/folder.c;  cvs diff -u -r 1.5.2.10 -r 1.5.2.11 src/prefs_spelling.c;  cvs diff -u -r 1.1.4.11 -r 1.1.4.12 src/common/xml.c;  ) > 1.9.14cvs20.patchset
+( cvs diff -u -r 1.100.2.25 -r 1.100.2.26 AUTHORS;  cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/gtk/logwindow.c;  ) > 1.9.14cvs21.patchset
index 09fe171e1d5e6b4c3584f9068c3e5ffb236eacf3..790f57ffd775e40ee1b9f4a92f73dbccb608eea3 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=14
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=20
+EXTRA_VERSION=21
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 45f62817ee3930c2792b04d9488af7994882cca8..c3474bbbd0c6b3a7f6d064bfe6046c45c1dafb43 100644 (file)
@@ -30,6 +30,8 @@
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtktextview.h>
 #include <gtk/gtkstyle.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkseparatormenuitem.h>
 
 #include "logwindow.h"
 #include "utils.h"
 #include "log.h"
 #include "hooks.h"
 
-static void hide_cb                    (GtkWidget      *widget,
-                                        LogWindow      *logwin);
-static gboolean key_pressed            (GtkWidget      *widget,
-                                        GdkEventKey    *event,
-                                        LogWindow      *logwin);
-static gboolean log_window_append      (gpointer        source,
-                                        gpointer        data);
-static void log_window_clip            (GtkWidget      *text,
-                                        guint           glip_length);
-
+static void hide_cb                            (GtkWidget      *widget,
+                                                LogWindow      *logwin);
+static gboolean key_pressed                    (GtkWidget      *widget,
+                                                GdkEventKey    *event,
+                                                LogWindow      *logwin);
+static gboolean log_window_append              (gpointer        source,
+                                                gpointer        data);
+static void log_window_clip                    (GtkWidget      *text,
+                                                guint           glip_length);
+static void log_window_clear                   (GtkWidget      *widget,
+                                                LogWindow      *logwin);
+static void log_window_popup_menu_extend       (GtkTextView    *textview,
+                                                GtkMenu        *menu,
+                                                LogWindow      *logwin);
+                                        
 LogWindow *log_window_create(void)
 {
        LogWindow *logwin;
@@ -85,6 +92,8 @@ LogWindow *log_window_create(void)
        buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
        gtk_text_buffer_get_start_iter(buffer, &iter);
        gtk_text_buffer_create_mark(buffer, "end", &iter, FALSE);
+       g_signal_connect(G_OBJECT(text), "populate-popup",
+                        G_CALLBACK(log_window_popup_menu_extend), logwin);
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
        gtk_widget_show(text);
 
@@ -226,6 +235,9 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
 {
        if (event && event->keyval == GDK_Escape)
                gtk_widget_hide(logwin->window);
+       else if (event && event->keyval == GDK_Delete) 
+               log_window_clear(NULL, logwin);
+
        return FALSE;
 }
 
@@ -251,3 +263,34 @@ static void log_window_clip(GtkWidget *textw, guint clip_length)
                gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
        }
 }
+
+static void log_window_clear(GtkWidget *widget, LogWindow *logwin)
+{
+       GtkTextView *textview = GTK_TEXT_VIEW(logwin->text);
+       GtkTextBuffer *textbuf = gtk_text_view_get_buffer(textview);
+       GtkTextIter start_iter, end_iter;
+       
+       gtk_text_buffer_get_start_iter(textbuf, &start_iter);
+       gtk_text_buffer_get_end_iter(textbuf, &end_iter);
+       gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
+}
+
+static void log_window_popup_menu_extend(GtkTextView *textview,
+                       GtkMenu *menu, LogWindow *logwin)
+{
+       GtkWidget *menuitem;
+       
+       g_return_if_fail(menu != NULL);
+       g_return_if_fail(GTK_IS_MENU_SHELL(menu));
+
+       menuitem = gtk_separator_menu_item_new();
+       gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menuitem);
+       gtk_widget_show(menuitem);
+       
+       menuitem = gtk_menu_item_new_with_mnemonic("Clear _Log");
+       g_signal_connect(G_OBJECT(menuitem), "activate",
+                        G_CALLBACK(log_window_clear), logwin);
+       gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menuitem);
+       gtk_widget_show(menuitem);
+}
+