diff -Naur clipit-1.4.1.orig/po/ru.po clipit-1.4.1/po/ru.po --- clipit-1.4.1.orig/po/ru.po 2011-05-27 10:33:51.000000000 +0300 +++ clipit-1.4.1/po/ru.po 2014-06-08 23:07:20.875130296 +0300 @@ -50,6 +50,11 @@ msgid "Empty" msgstr "Пусто" +#. Clear +#: ../src/main.c:439 ../src/main.c:635 +msgid "Clear" +msgstr "Очистить" + #. Edit actions #: ../src/main.c:542 msgid "_Edit actions" diff -Naur clipit-1.4.1.orig/src/history.c clipit-1.4.1/src/history.c --- clipit-1.4.1.orig/src/history.c 2011-05-27 10:10:07.000000000 +0300 +++ clipit-1.4.1/src/history.c 2014-06-08 23:07:20.871130282 +0300 @@ -219,6 +219,22 @@ #endif } +/* Clear all history */ +void clear_history() +{ + history = NULL; + + GtkClipboard *primary = gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_clear(primary); + gtk_clipboard_set_text(primary, "", 0); + + GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + gtk_clipboard_clear(clipboard); + gtk_clipboard_set_text(clipboard, "", 0); + + save_history(); +} + /* Checks if item should be included in history and calls append */ void check_and_append(gchar *item) { diff -Naur clipit-1.4.1.orig/src/history.h clipit-1.4.1/src/history.h --- clipit-1.4.1.orig/src/history.h 2011-05-27 10:10:07.000000000 +0300 +++ clipit-1.4.1/src/history.h 2014-06-08 23:07:20.871130282 +0300 @@ -43,6 +43,8 @@ void save_history(); +void clear_history(); + void check_and_append(gchar *item); void append_item(gchar *item); diff -Naur clipit-1.4.1.orig/src/main.c clipit-1.4.1/src/main.c --- clipit-1.4.1.orig/src/main.c 2011-05-27 10:10:07.000000000 +0300 +++ clipit-1.4.1/src/main.c 2014-06-08 23:08:46.491554850 +0300 @@ -435,6 +435,11 @@ } /* -------------------- */ gtk_menu_shell_append((GtkMenuShell*)menu, gtk_separator_menu_item_new()); + /* Append "Clear" item */ + menu_item = gtk_menu_item_new_with_label(_("Clear")); + gtk_menu_shell_append((GtkMenuShell*)menu, menu_item); + g_signal_connect((GObject*)menu_item, "activate", + (GCallback)clear_history, NULL); /* Edit actions */ menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Edit actions")); menu_image = gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU); @@ -625,6 +630,13 @@ elem = elem->next; } } + + /* Append "Clear" item */ + menu_item = gtk_menu_item_new_with_label(_("Clear")); + gtk_menu_shell_append((GtkMenuShell*)history_menu, menu_item); + g_signal_connect((GObject*)menu_item, "activate", + (GCallback)clear_history, NULL); + return history_menu; }