[Xfce4-commits] <garcon:jannis/global-monitoring> Add new method garcon_menu_item_pool_lookup_file().
Jannis Pohlmann
noreply at xfce.org
Sun Sep 5 14:50:21 CEST 2010
Updating branch refs/heads/jannis/global-monitoring
to 054fca01e68de8b08bb647288301b08c9fc28a22 (commit)
from fb08ed6509a3277f879ae04125a8c4b2e4ef7fc0 (commit)
commit 054fca01e68de8b08bb647288301b08c9fc28a22
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue Mar 9 19:35:39 2010 +0100
Add new method garcon_menu_item_pool_lookup_file().
This method allows to search the GarconMenuItemPool for a GarconMenuItem
that belongs to a given GFile.
garcon/garcon-menu-item-pool.c | 28 ++++++++++++++++++++++++++++
garcon/garcon-menu-item-pool.h | 2 ++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/garcon/garcon-menu-item-pool.c b/garcon/garcon-menu-item-pool.c
index 49ec005..5f0923f 100644
--- a/garcon/garcon-menu-item-pool.c
+++ b/garcon/garcon-menu-item-pool.c
@@ -134,6 +134,34 @@ garcon_menu_item_pool_lookup (GarconMenuItemPool *pool,
+GarconMenuItem *
+garcon_menu_item_pool_lookup_file (GarconMenuItemPool *pool,
+ GFile *file)
+{
+ GarconMenuItem *result = NULL;
+ GHashTableIter iter;
+ gpointer item;
+ GFile *item_file;
+
+ g_return_val_if_fail (GARCON_IS_MENU_ITEM_POOL (pool), NULL);
+ g_return_val_if_fail (G_IS_FILE (file), NULL);
+
+ g_hash_table_iter_init (&iter, pool->priv->items);
+ while (result == NULL && g_hash_table_iter_next (&iter, NULL, &item))
+ {
+ item_file = garcon_menu_item_get_file (item);
+
+ if (g_file_equal (item_file, file))
+ result = item;
+
+ g_object_unref (item_file);
+ }
+
+ return result;
+}
+
+
+
void
garcon_menu_item_pool_foreach (GarconMenuItemPool *pool,
GHFunc func,
diff --git a/garcon/garcon-menu-item-pool.h b/garcon/garcon-menu-item-pool.h
index 9e127ae..3d95346 100644
--- a/garcon/garcon-menu-item-pool.h
+++ b/garcon/garcon-menu-item-pool.h
@@ -49,6 +49,8 @@ void garcon_menu_item_pool_insert (GarconMenuItemPool
GarconMenuItem *item);
GarconMenuItem *garcon_menu_item_pool_lookup (GarconMenuItemPool *pool,
const gchar *desktop_id);
+GarconMenuItem *garcon_menu_item_pool_lookup_file (GarconMenuItemPool *pool,
+ GFile *file);
void garcon_menu_item_pool_foreach (GarconMenuItemPool *pool,
GHFunc func,
gpointer user_data);
More information about the Xfce4-commits
mailing list