[gnumeric] Recent: allow removing an item from the recent history.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Recent: allow removing an item from the recent history.
- Date: Tue, 30 Dec 2014 02:00:29 +0000 (UTC)
commit 598e031edcd012df83ac75a73bd847d0f00af949
Author: Morten Welinder <terra gnome org>
Date: Mon Dec 29 20:59:39 2014 -0500
Recent: allow removing an item from the recent history.
Pressing [Delete] will remove the currently selected item.
NEWS | 1 +
src/dialogs/ChangeLog | 5 ++++
src/dialogs/dialog-recent.c | 51 +++++++++++++++++++++++++++++++++++++-----
3 files changed, 51 insertions(+), 6 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1f7dbad..ac36d32 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Morten:
* Fix multihead issue with graph windows.
* Improve test suite.
* Reorganize icon handling.
+ * Allow removing a specific item from the history. [#735305]
Thomas Kluyver:
* Fix import of extended floats from wk4 files. [#739697]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 7897e45..23e7ca6 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-29 Morten Welinder <terra gnome org>
+
+ * dialog-recent.c (cb_key_press): New function. On [Delete],
+ remove the current item from the recent history.
+
2014-12-25 Morten Welinder <terra gnome org>
* dialog-about.c (text_item_renderer): Fade using alpha. The old
diff --git a/src/dialogs/dialog-recent.c b/src/dialogs/dialog-recent.c
index 8fedb33..6f8c660 100644
--- a/src/dialogs/dialog-recent.c
+++ b/src/dialogs/dialog-recent.c
@@ -76,6 +76,41 @@ cb_response (GtkWidget *dialog,
}
}
+static gboolean
+cb_key_press (GtkWidget *widget, GdkEventKey *event)
+{
+ GtkTreeView *tree_view = (GtkTreeView *) widget;
+
+ switch (event->keyval) {
+ case GDK_KEY_KP_Delete:
+ case GDK_KEY_Delete: {
+ GtkTreeSelection *tsel = gtk_tree_view_get_selection (tree_view);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (tsel, &model, &iter)) {
+ GtkRecentInfo *info;
+ const char *uri;
+ GtkRecentManager *manager = gtk_recent_manager_get_default ();
+
+ gtk_tree_model_get (model, &iter, RECENT_COL_INFO, &info, -1);
+ uri = gtk_recent_info_get_uri (info);
+
+ gtk_recent_manager_remove_item (manager, uri, NULL);
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ gtk_recent_info_unref (info);
+ }
+ return TRUE;
+ }
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+
static void
url_renderer_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
@@ -247,14 +282,18 @@ dialog_recent_used (WBCGtk *wbcg)
{
- GtkWidget *w = GTK_WIDGET (wbcg_toplevel (wbcg));
+ GtkWidget *w;
int width, height, vsep;
- PangoLayout *layout =
- gtk_widget_create_pango_layout (w, "Mg19");
+ PangoLayout *layout;
+
+ w = GTK_WIDGET (wbcg_toplevel (wbcg));
+ layout = gtk_widget_create_pango_layout (w, "Mg19");
- gtk_widget_style_get (go_gtk_builder_get_widget (gui, "docs_treeview"),
- "vertical_separator", &vsep,
- NULL);
+ w = go_gtk_builder_get_widget (gui, "docs_treeview");
+ gtk_widget_style_get (w, "vertical_separator", &vsep, NULL);
+ g_signal_connect (w, "key-press-event",
+ G_CALLBACK (cb_key_press),
+ NULL);
pango_layout_get_pixel_size (layout, &width, &height);
gtk_widget_set_size_request (go_gtk_builder_get_widget (gui, "docs_scrolledwindow"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]