summaryrefslogtreecommitdiff
path: root/thunarx
diff options
context:
space:
mode:
authorAlexander Schwinn <alexxcons@xfce.org>2020-12-24 01:27:10 +0100
committerAlexander Schwinn <alexxcons@xfce.org>2020-12-24 01:27:10 +0100
commit61dcf30a046172f644f63b84570c4ca594e44028 (patch)
tree12094bf7ff5f8d22634779cc51a2bc7b955f30d1 /thunarx
parente32e5942ceb84de1127e2f400e95b303833c5709 (diff)
downloadthunar-61dcf30a046172f644f63b84570c4ca594e44028.tar.gz
Add submenus for custom actions (Issue #184)
Diffstat (limited to 'thunarx')
-rw-r--r--thunarx/thunarx-menu.c17
-rw-r--r--thunarx/thunarx-menu.h3
-rw-r--r--thunarx/thunarx.symbols1
3 files changed, 21 insertions, 0 deletions
diff --git a/thunarx/thunarx-menu.c b/thunarx/thunarx-menu.c
index 87c431a4..f2dd7cf1 100644
--- a/thunarx/thunarx-menu.c
+++ b/thunarx/thunarx-menu.c
@@ -120,10 +120,27 @@ thunarx_menu_append_item (ThunarxMenu *menu, ThunarxMenuItem *item)
/**
+ * thunarx_menu_prepend_item:
+ * @menu: a #ThunarxMenu
+ * @item: a #ThunarxMenuItem
+ */
+void
+thunarx_menu_prepend_item (ThunarxMenu *menu, ThunarxMenuItem *item)
+{
+ g_return_if_fail (menu != NULL);
+ g_return_if_fail (item != NULL);
+
+ menu->priv->items = g_list_prepend (menu->priv->items, g_object_ref (item));
+}
+
+
+
+/**
* thunarx_menu_get_items:
* @menu: a #ThunarxMenu
*
* Returns: (element-type ThunarxMenuItem) (transfer full): the provided #ThunarxMenuItem list
+ * Must be freed with thunarx_menu_item_list_free() after usage
*/
GList *
thunarx_menu_get_items (ThunarxMenu *menu)
diff --git a/thunarx/thunarx-menu.h b/thunarx/thunarx-menu.h
index 6869f5e1..8de23b07 100644
--- a/thunarx/thunarx-menu.h
+++ b/thunarx/thunarx-menu.h
@@ -89,6 +89,9 @@ ThunarxMenu *thunarx_menu_new (void) G_GNUC_MALLOC;
void thunarx_menu_append_item (ThunarxMenu *menu,
ThunarxMenuItem *item);
+void thunarx_menu_prepend_item (ThunarxMenu *menu,
+ ThunarxMenuItem *item);
+
GList* thunarx_menu_get_items (ThunarxMenu *menu);
/* ThunarxMenuItem methods */
diff --git a/thunarx/thunarx.symbols b/thunarx/thunarx.symbols
index 750d55fe..d4b5469c 100644
--- a/thunarx/thunarx.symbols
+++ b/thunarx/thunarx.symbols
@@ -50,6 +50,7 @@ thunarx_file_info_list_free
thunarx_menu_get_type G_GNUC_CONST
thunarx_menu_new G_GNUC_MALLOC
thunarx_menu_append_item
+thunarx_menu_prepend_item
thunarx_menu_get_items
/* ThunarxMenuItem methods */