summaryrefslogtreecommitdiff
path: root/src/math-window.c
diff options
context:
space:
mode:
authorJohannes Unruh <[email protected]>2020-03-23 00:03:52 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2020-04-07 23:27:35 +0200
commit7f43d244e969162ca92d6575085b4196f0c2e19f (patch)
treefffc9391bbe294ea501bd829fd57cba977d5abcf /src/math-window.c
parentd92c6f685a8622905d9ca50479cf19454a5959f5 (diff)
downloadmate-calc-7f43d244e969162ca92d6575085b4196f0c2e19f.tar.bz2
mate-calc-7f43d244e969162ca92d6575085b4196f0c2e19f.tar.xz
history-view: simplify code and add clear option
Diffstat (limited to 'src/math-window.c')
-rw-r--r--src/math-window.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/math-window.c b/src/math-window.c
index 87ac779..08ac3e3 100644
--- a/src/math-window.c
+++ b/src/math-window.c
@@ -180,6 +180,11 @@ static void show_history_cb(MathWindow *window, GParamSpec *spec)
g_settings_set_boolean(g_settings_var, "show-history", math_window_get_show_history(window));
}
+static void clear_history_cb(GtkMenuItem *menu, MathWindow *window)
+{
+ math_history_clear(window->priv->history);
+}
+
static void show_preferences_cb(GtkMenuItem *menu, MathWindow *window)
{
if (!window->priv->preferences_dialog)
@@ -514,6 +519,8 @@ static void create_menu(MathWindow* window)
gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
menu_item = add_menu_item(menu, gtk_image_menu_item_new_from_icon("edit-redo",_("_Redo"), accel_group), G_CALLBACK(redo_cb), window);
gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_Z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
+ menu_item = add_menu_item(menu, gtk_image_menu_item_new_from_icon("edit-clear",_("_Clear History"), accel_group), G_CALLBACK(clear_history_cb), window);
+ gtk_widget_add_accelerator(menu_item, "activate", accel_group, GDK_KEY_Delete, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
add_menu_item(menu, gtk_separator_menu_item_new(), NULL, NULL);
add_menu_item(menu, gtk_image_menu_item_new_from_icon("preferences-desktop",_("_Preferences"), accel_group), G_CALLBACK(show_preferences_cb), window);
add_menu_item(menu, gtk_separator_menu_item_new(), NULL, NULL);