[Xfce4-commits] <garcon:jannis/global-monitoring> Add new method garcon_menu_item_pool_lookup_file().
Jannis Pohlmann
noreply at xfce.org
Wed Mar 10 21:02:08 CET 2010
Updating branch refs/heads/jannis/global-monitoring
to f0b36ddc544530e4e950d8e6bdd213e846a9d4a9 (commit)
from 66191c5fd08abcfd2e90a064b376f46d87e43943 (commit)
commit f0b36ddc544530e4e950d8e6bdd213e846a9d4a9
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