diff options
author | Nick Schermer <nick@xfce.org> | 2011-07-03 23:32:24 +0200 |
---|---|---|
committer | Nick Schermer <nick@xfce.org> | 2011-07-09 16:14:56 +0200 |
commit | 3125a8da5e59615a6aae220bfbfcf4df8c460fcc (patch) | |
tree | 8f68e443013412b79f4a4d3fd1e74270789cdbf5 /src/appfinder-model.c | |
parent | b6f1f951eb0cd98f3bc02fa32ba71ea0d3f173d3 (diff) | |
download | xfce4-appfinder-3125a8da5e59615a6aae220bfbfcf4df8c460fcc.tar.gz |
Clear command history menu item.
Diffstat (limited to 'src/appfinder-model.c')
-rw-r--r-- | src/appfinder-model.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/appfinder-model.c b/src/appfinder-model.c index efaad74..1edc597 100644 --- a/src/appfinder-model.c +++ b/src/appfinder-model.c @@ -24,6 +24,7 @@ #include <string.h> #endif +#include <glib/gstdio.h> #include <libxfce4util/libxfce4util.h> #include <libxfce4ui/libxfce4ui.h> @@ -1582,6 +1583,42 @@ xfce_appfinder_model_icon_theme_changed (XfceAppfinderModel *model) +void +xfce_appfinder_model_commands_clear (XfceAppfinderModel *model) +{ + ModelItem *item; + GSList *li, *lnext; + gint idx; + GtkTreePath *path; + gchar *filename; + + appfinder_return_if_fail (XFCE_IS_APPFINDER_MODEL (model)); + + for (li = model->items, idx = 0; li != NULL; li = lnext, idx++) + { + lnext = li->next; + item = li->data; + if (item->item != NULL) + continue; + + model->items = g_slist_delete_link (model->items, li); + + path = gtk_tree_path_new_from_indices (idx--, -1); + gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path); + gtk_tree_path_free (path); + + xfce_appfinder_model_item_free (item, model); + } + + /* remove the history file */ + filename = xfce_resource_save_location (XFCE_RESOURCE_CACHE, HISTORY_PATH, FALSE); + if (filename != NULL) + g_unlink (filename); + g_free (filename); +} + + + GarconMenuDirectory * xfce_appfinder_model_get_command_category (void) { |