[Xfce4-commits] [xfce/thunar] 02/04: Rename thunarx methods *_actions to *_menu_items
noreply at xfce.org
noreply at xfce.org
Thu Nov 2 04:40:36 CET 2017
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit 0fa8145c7f024a134966200ef86741115c9db3a1
Author: Andre Miranda <andreldm at xfce.org>
Date: Mon Oct 23 22:47:27 2017 -0300
Rename thunarx methods *_actions to *_menu_items
---
docs/reference/thunarx/thunarx-sections.txt | 10 +-
examples/tex-open-terminal/tex-open-terminal.c | 36 +-
plugins/thunar-uca/thunar-uca-provider.c | 58 +--
plugins/thunar-wallpaper/twp-provider.c | 16 +-
thunar/thunar-dnd.c | 29 +-
thunar/thunar-renamer-dialog.c | 31 +-
thunar/thunar-shortcuts-view.c | 27 +-
thunar/thunar-standard-view.c | 30 +-
thunar/thunar-tree-view.c | 27 +-
thunar/thunar-util.c | 18 +-
thunar/thunar-util.h | 6 +-
thunar/thunar-window.c | 54 ++-
thunarx/thunarx-menu-item.c | 474 +++++++++++++------------
thunarx/thunarx-menu-item.h | 53 ++-
thunarx/thunarx-menu-provider.c | 112 +++---
thunarx/thunarx-menu-provider.h | 46 +--
thunarx/thunarx-preferences-provider.c | 46 +--
thunarx/thunarx-preferences-provider.h | 12 +-
thunarx/thunarx-renamer.c | 98 ++---
thunarx/thunarx-renamer.h | 70 ++--
thunarx/thunarx.symbols | 17 +-
21 files changed, 665 insertions(+), 605 deletions(-)
diff --git a/docs/reference/thunarx/thunarx-sections.txt b/docs/reference/thunarx/thunarx-sections.txt
index 85f33d9..86a34b6 100644
--- a/docs/reference/thunarx/thunarx-sections.txt
+++ b/docs/reference/thunarx/thunarx-sections.txt
@@ -35,9 +35,9 @@ thunarx_file_info_list_get_type
<TITLE>ThunarxMenuProvider</TITLE>
ThunarxMenuProviderIface
ThunarxMenuProvider
-thunarx_menu_provider_get_file_actions
-thunarx_menu_provider_get_folder_actions
-thunarx_menu_provider_get_dnd_actions
+thunarx_menu_provider_get_file_menu_items
+thunarx_menu_provider_get_folder_menu_items
+thunarx_menu_provider_get_dnd_menu_items
<SUBSECTION Standard>
THUNARX_TYPE_MENU_PROVIDER
THUNARX_MENU_PROVIDER
@@ -52,7 +52,7 @@ thunarx_menu_provider_get_type
<TITLE>ThunarxPreferencesProvider</TITLE>
ThunarxPreferencesProviderIface
ThunarxPreferencesProvider
-thunarx_preferences_provider_get_actions
+thunarx_preferences_provider_get_menu_items
<SUBSECTION Standard>
THUNARX_TYPE_PREFERENCES_PROVIDER
THUNARX_PREFERENCES_PROVIDER
@@ -156,7 +156,7 @@ thunarx_renamer_set_name
thunarx_renamer_process
thunarx_renamer_load
thunarx_renamer_save
-thunarx_renamer_get_actions
+thunarx_renamer_get_menu_items
thunarx_renamer_changed
<SUBSECTION Standard>
THUNARX_TYPE_RENAMER
diff --git a/examples/tex-open-terminal/tex-open-terminal.c b/examples/tex-open-terminal/tex-open-terminal.c
index 18c1788..4c86f8e 100644
--- a/examples/tex-open-terminal/tex-open-terminal.c
+++ b/examples/tex-open-terminal/tex-open-terminal.c
@@ -34,15 +34,15 @@
-static void tex_open_terminal_menu_provider_init (ThunarxMenuProviderIface *iface);
-static GList *tex_open_terminal_get_file_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files);
-static GList *tex_open_terminal_get_folder_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder);
-static void tex_open_terminal_activated (ThunarxMenuItem *item,
- GtkWidget *window);
+static void tex_open_terminal_menu_provider_init (ThunarxMenuProviderIface *iface);
+static GList *tex_open_terminal_get_file_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
+static GList *tex_open_terminal_get_folder_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder);
+static void tex_open_terminal_activated (ThunarxMenuItem *item,
+ GtkWidget *window);
@@ -85,20 +85,20 @@ tex_open_terminal_init (TexOpenTerminal *open_terminal)
static void
tex_open_terminal_menu_provider_init (ThunarxMenuProviderIface *iface)
{
- iface->get_file_actions = tex_open_terminal_get_file_actions;
- iface->get_folder_actions = tex_open_terminal_get_folder_actions;
+ iface->get_file_menu_items = tex_open_terminal_get_file_menu_items;
+ iface->get_folder_menu_items = tex_open_terminal_get_folder_menu_items;
}
static GList*
-tex_open_terminal_get_file_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files)
+tex_open_terminal_get_file_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ GList *files)
{
/* check if we have a directory here */
if (G_LIKELY (files != NULL && files->next == NULL && thunarx_file_info_is_directory (files->data)))
- return tex_open_terminal_get_folder_actions (provider, window, files->data);
+ return tex_open_terminal_get_folder_menu_items (provider, window, files->data);
return NULL;
}
@@ -106,9 +106,9 @@ tex_open_terminal_get_file_actions (ThunarxMenuProvider *provider,
static GList*
-tex_open_terminal_get_folder_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder)
+tex_open_terminal_get_folder_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder)
{
ThunarxMenuItem *item = NULL;
gchar *scheme;
diff --git a/plugins/thunar-uca/thunar-uca-provider.c b/plugins/thunar-uca/thunar-uca-provider.c
index 7686ee3..9d8c536 100644
--- a/plugins/thunar-uca/thunar-uca-provider.c
+++ b/plugins/thunar-uca/thunar-uca-provider.c
@@ -39,12 +39,12 @@
static void thunar_uca_provider_menu_provider_init (ThunarxMenuProviderIface *iface);
static void thunar_uca_provider_preferences_provider_init (ThunarxPreferencesProviderIface *iface);
static void thunar_uca_provider_finalize (GObject *object);
-static GList *thunar_uca_provider_get_actions (ThunarxPreferencesProvider *preferences_provider,
+static GList *thunar_uca_provider_get_menu_items (ThunarxPreferencesProvider *preferences_provider,
GtkWidget *window);
-static GList *thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
+static GList *thunar_uca_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
GtkWidget *window,
GList *files);
-static GList *thunar_uca_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
+static GList *thunar_uca_provider_get_folder_menu_items (ThunarxMenuProvider *menu_provider,
GtkWidget *window,
ThunarxFileInfo *folder);
static void thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
@@ -113,8 +113,8 @@ thunar_uca_provider_class_init (ThunarUcaProviderClass *klass)
static void
thunar_uca_provider_menu_provider_init (ThunarxMenuProviderIface *iface)
{
- iface->get_file_actions = thunar_uca_provider_get_file_actions;
- iface->get_folder_actions = thunar_uca_provider_get_folder_actions;
+ iface->get_file_menu_items = thunar_uca_provider_get_file_menu_items;
+ iface->get_folder_menu_items = thunar_uca_provider_get_folder_menu_items;
}
@@ -122,7 +122,7 @@ thunar_uca_provider_menu_provider_init (ThunarxMenuProviderIface *iface)
static void
thunar_uca_provider_preferences_provider_init (ThunarxPreferencesProviderIface *iface)
{
- iface->get_actions = thunar_uca_provider_get_actions;
+ iface->get_menu_items = thunar_uca_provider_get_menu_items;
}
@@ -156,7 +156,7 @@ thunar_uca_provider_finalize (GObject *object)
static void
-manage_actions (GtkWindow *window)
+manage_menu_items (GtkWindow *window)
{
GtkWidget *dialog;
gboolean use_header_bar = FALSE;
@@ -172,15 +172,15 @@ manage_actions (GtkWindow *window)
static GList*
-thunar_uca_provider_get_actions (ThunarxPreferencesProvider *preferences_provider,
- GtkWidget *window)
+thunar_uca_provider_get_menu_items (ThunarxPreferencesProvider *preferences_provider,
+ GtkWidget *window)
{
ThunarxMenuItem *item;
GClosure *closure;
item = thunarx_menu_item_new ("ThunarUca::manage-actions", _("Configure c_ustom actions..."),
_("Setup custom actions that will appear in the file managers context menus"), NULL);
- closure = g_cclosure_new_object_swap (G_CALLBACK (manage_actions), G_OBJECT (window));
+ closure = g_cclosure_new_object_swap (G_CALLBACK (manage_menu_items), G_OBJECT (window));
g_signal_connect_closure (G_OBJECT (item), "activate", closure, TRUE);
return g_list_prepend (NULL, item);
@@ -189,16 +189,16 @@ thunar_uca_provider_get_actions (ThunarxPreferencesProvider *preferences_provide
static GList*
-thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- GList *files)
+thunar_uca_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files)
{
GtkTreeRowReference *row;
ThunarUcaProvider *uca_provider = THUNAR_UCA_PROVIDER (menu_provider);
ThunarUcaContext *uca_context = NULL;
GtkTreeIter iter;
ThunarxMenuItem *item;
- GList *actions = NULL;
+ GList *items = NULL;
GList *paths;
GList *lp;
gchar *tooltip;
@@ -228,7 +228,7 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
if (gicon != NULL)
icon_name = g_icon_to_string (gicon);
- /* create the new action with the given parameters */
+ /* create the new menu item with the given parameters */
item = thunarx_menu_item_new (name, label, tooltip, icon_name);
/* grab a tree row reference on the given path */
@@ -248,8 +248,8 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
g_object_ref (G_OBJECT (uca_provider)), (GClosureNotify) g_object_unref,
G_CONNECT_SWAPPED);
- /* add the action to the return list */
- actions = g_list_prepend (actions, item);
+ /* add the menu item to the return list */
+ items = g_list_prepend (items, item);
/* cleanup */
g_free (tooltip);
@@ -267,17 +267,17 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
g_list_free (paths);
- return actions;
+ return items;
}
static GList*
-thunar_uca_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- ThunarxFileInfo *folder)
+thunar_uca_provider_get_folder_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder)
{
- GList *actions;
+ GList *items;
GList files;
GList *lp;
@@ -286,14 +286,14 @@ thunar_uca_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
files.next = NULL;
files.prev = NULL;
- /* ...and use the get_file_actions() method */
- actions = thunarx_menu_provider_get_file_actions (menu_provider, window, &files);
+ /* ...and use the get_file_menu_items() method */
+ items = thunarx_menu_provider_get_file_menu_items (menu_provider, window, &files);
- /* mark the actions, so we can properly detect the working directory */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* mark the menu items, so we can properly detect the working directory */
+ for (lp = items; lp != NULL; lp = lp->next)
g_object_set_qdata (G_OBJECT (lp->data), thunar_uca_folder_quark, GUINT_TO_POINTER (TRUE));
- return actions;
+ return items;
}
@@ -334,7 +334,7 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
gtk_tree_model_get_iter (GTK_TREE_MODEL (uca_provider->model), &iter, path);
gtk_tree_path_free (path);
- /* determine the files and the window for the action */
+ /* determine the files and the window for the menu item */
uca_context = g_object_get_qdata (G_OBJECT (item), thunar_uca_context_quark);
window = thunar_uca_context_get_window (uca_context);
files = thunar_uca_context_get_files (uca_context);
@@ -357,7 +357,7 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
filename = g_filename_from_uri (uri, NULL, NULL);
if (G_LIKELY (filename != NULL))
{
- /* if this is a folder action, we just use the filename as working directory */
+ /* if this is a folder menu item, we just use the filename as working directory */
if (g_object_get_qdata (G_OBJECT (item), thunar_uca_folder_quark) != NULL)
{
working_directory = filename;
diff --git a/plugins/thunar-wallpaper/twp-provider.c b/plugins/thunar-wallpaper/twp-provider.c
index 5d903c5..aa486d4 100644
--- a/plugins/thunar-wallpaper/twp-provider.c
+++ b/plugins/thunar-wallpaper/twp-provider.c
@@ -43,7 +43,7 @@
static void twp_menu_provider_init (ThunarxMenuProviderIface *iface);
static void twp_provider_finalize (GObject *object);
-static GList *twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
+static GList *twp_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
GtkWidget *window,
GList *files);
static void twp_action_set_wallpaper (ThunarxMenuItem *item,
@@ -87,7 +87,7 @@ THUNARX_DEFINE_TYPE_WITH_CODE (TwpProvider, twp_provider, G_TYPE_OBJECT,
static void
twp_menu_provider_init (ThunarxMenuProviderIface *iface)
{
- iface->get_file_actions = twp_provider_get_file_actions;
+ iface->get_file_menu_items = twp_provider_get_file_menu_items;
}
@@ -125,13 +125,13 @@ twp_provider_finalize (GObject *object)
static GList*
-twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- GList *files)
+twp_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files)
{
ThunarxMenuItem *item = NULL;
GFile *location;
- GList *actions = NULL;
+ GList *items = NULL;
gchar *mime_type;
gchar selection_name[100];
Atom xfce_selection_atom;
@@ -171,7 +171,7 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
item = thunarx_menu_item_new ("Twp::setwallpaper", _("Set as wallpaper"), NULL, "preferences-desktop-wallpaper");
g_signal_connect (item, "activate", G_CALLBACK (twp_action_set_wallpaper), files->data);
- actions = g_list_append (actions, item);
+ items = g_list_append (items, item);
}
g_free(mime_type);
}
@@ -196,7 +196,7 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
}
- return actions;
+ return items;
}
static void
diff --git a/thunar/thunar-dnd.c b/thunar/thunar-dnd.c
index aa8e173..663156d 100644
--- a/thunar/thunar-dnd.c
+++ b/thunar/thunar-dnd.c
@@ -30,6 +30,7 @@
#include <thunar/thunar-dnd.h>
#include <thunar/thunar-gtk-extensions.h>
#include <thunar/thunar-private.h>
+#include <thunar/thunar-util.h>
@@ -81,9 +82,10 @@ thunar_dnd_ask (GtkWidget *widget,
GtkWidget *item;
GList *file_list = NULL;
GList *providers = NULL;
- GList *actions = NULL;
+ GList *items = NULL;
GList *lp;
guint n;
+ GtkAction *action;
_thunar_return_val_if_fail (thunar_file_is_directory (folder), 0);
_thunar_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
@@ -138,28 +140,33 @@ thunar_dnd_ask (GtkWidget *widget,
/* load the menu providers from the provider factory */
providers = thunarx_provider_factory_list_providers (factory, THUNARX_TYPE_MENU_PROVIDER);
- /* load the dnd actions offered by the menu providers */
+ /* load the dnd menu items offered by the menu providers */
for (lp = providers; lp != NULL; lp = lp->next)
{
- /* merge the actions from this provider */
- actions = g_list_concat (actions, thunarx_menu_provider_get_dnd_actions (lp->data, window, THUNARX_FILE_INFO (folder), file_list));
+ /* merge the menu items from this provider */
+ items = g_list_concat (items, thunarx_menu_provider_get_dnd_menu_items (lp->data, window, THUNARX_FILE_INFO (folder), file_list));
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (providers);
- /* check if we have atleast one action */
- if (G_UNLIKELY (actions != NULL))
+ /* check if we have at least one item */
+ if (G_UNLIKELY (items != NULL))
{
- /* add menu items for all actions */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add menu items for all items */
+ for (lp = items; lp != NULL; lp = lp->next)
{
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), window);
+
/* add a menu item for the action */
- item = gtk_action_create_menu_item (lp->data);
+ item = gtk_action_create_menu_item (action);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- g_object_unref (G_OBJECT (lp->data));
gtk_widget_show (item);
+
+ /* release the reference on the menu item and action */
+ g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
- g_list_free (actions);
+ g_list_free (items);
/* append another separator */
item = gtk_separator_menu_item_new ();
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index 474d7ca..39da1a4 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -43,6 +43,7 @@
#include <thunar/thunar-renamer-dialog-ui.h>
#include <thunar/thunar-renamer-model.h>
#include <thunar/thunar-renamer-progress.h>
+#include <thunar/thunar-util.h>
@@ -847,9 +848,10 @@ thunar_renamer_dialog_context_menu (ThunarRenamerDialog *renamer_dialog,
GtkActionGroup *renamer_actions = NULL;
ThunarxRenamer *renamer;
GtkWidget *menu;
- GList *actions = NULL;
+ GList *items = NULL;
GList *lp;
gint renamer_merge_id = 0;
+ GtkAction *action;
_thunar_return_if_fail (THUNAR_IS_RENAMER_DIALOG (renamer_dialog));
@@ -860,40 +862,43 @@ thunar_renamer_dialog_context_menu (ThunarRenamerDialog *renamer_dialog,
renamer = thunar_renamer_model_get_renamer (renamer_dialog->model);
if (G_LIKELY (renamer != NULL))
{
- /* determine the actions provided by the active renamer */
- actions = thunarx_renamer_get_actions (renamer, GTK_WINDOW (renamer_dialog), renamer_dialog->selected_files);
+ /* determine the menu items provided by the active renamer */
+ items = thunarx_renamer_get_menu_items (renamer, GTK_WINDOW (renamer_dialog), renamer_dialog->selected_files);
}
- /* check if we have any renamer actions */
- if (G_UNLIKELY (actions != NULL))
+ /* check if we have any renamer menu items */
+ if (G_UNLIKELY (items != NULL))
{
- /* allocate a new action group and the merge id for the custom actions */
+ /* allocate a new action group and the merge id for the custom items */
renamer_actions = gtk_action_group_new ("thunar-renamer-dialog-renamer-actions");
renamer_merge_id = gtk_ui_manager_new_merge_id (renamer_dialog->ui_manager);
gtk_ui_manager_insert_action_group (renamer_dialog->ui_manager, renamer_actions, -1);
- /* add the actions to the UI manager */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add the items to the UI manager */
+ for (lp = items; lp != NULL; lp = lp->next)
{
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), GTK_WIDGET (renamer_dialog));
+
/* add the action to the action group */
- gtk_action_group_add_action (renamer_actions, GTK_ACTION (lp->data));
+ gtk_action_group_add_action (renamer_actions, action);
/* add the action to the UI manager */
gtk_ui_manager_add_ui (renamer_dialog->ui_manager, renamer_merge_id,
"/file-context-menu/placeholder-renamer-actions",
- gtk_action_get_name (GTK_ACTION (lp->data)),
- gtk_action_get_name (GTK_ACTION (lp->data)),
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
GTK_UI_MANAGER_MENUITEM, FALSE);
- /* release the reference on the action */
+ /* release the reference on the menu item and action */
g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
/* be sure to update the UI manager to avoid flickering */
gtk_ui_manager_ensure_update (renamer_dialog->ui_manager);
/* cleanup */
- g_list_free (actions);
+ g_list_free (items);
}
/* run the menu on the dialog's screen */
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index fffd9dc..06b5e6f 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -35,6 +35,7 @@
#include <thunar/thunar-application.h>
#include <thunar/thunar-browser.h>
+#include <thunar/thunar-device-monitor.h>
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-dnd.h>
#include <thunar/thunar-gio-extensions.h>
@@ -44,8 +45,8 @@
#include <thunar/thunar-shortcuts-icon-renderer.h>
#include <thunar/thunar-shortcuts-model.h>
#include <thunar/thunar-shortcuts-view.h>
-#include <thunar/thunar-device-monitor.h>
#include <thunar/thunar-stock.h>
+#include <thunar/thunar-util.h>
@@ -1063,7 +1064,7 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view,
gboolean mutable;
ThunarDevice *device;
GList *providers, *lp;
- GList *actions = NULL, *tmp;
+ GList *items = NULL, *tmp;
ThunarShortcutGroup group;
gboolean is_header;
GFile *mount_point;
@@ -1071,6 +1072,7 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view,
gboolean can_mount;
gboolean can_unmount;
gboolean can_eject;
+ GtkAction *action;
/* check if this is an item menu or a header menu */
gtk_tree_model_get (model, iter, THUNAR_SHORTCUTS_MODEL_COLUMN_IS_HEADER, &is_header, -1);
@@ -1222,16 +1224,16 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view,
/* determine the toplevel window we belong to */
window = gtk_widget_get_toplevel (GTK_WIDGET (view));
- /* load the actions offered by the menu providers */
+ /* load the menu items offered by the menu providers */
for (lp = providers; lp != NULL; lp = lp->next)
{
- tmp = thunarx_menu_provider_get_folder_actions (lp->data, window, THUNARX_FILE_INFO (file));
- actions = g_list_concat (actions, tmp);
+ tmp = thunarx_menu_provider_get_folder_menu_items (lp->data, window, THUNARX_FILE_INFO (file));
+ items = g_list_concat (items, tmp);
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (providers);
- if (actions != NULL)
+ if (items != NULL)
{
/* append a menu separator */
item = gtk_separator_menu_item_new ();
@@ -1239,19 +1241,22 @@ thunar_shortcuts_view_context_menu (ThunarShortcutsView *view,
gtk_widget_show (item);
}
- /* add the actions to the menu */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add the menu items to the menu */
+ for (lp = items; lp != NULL; lp = lp->next)
{
- item = gtk_action_create_menu_item (GTK_ACTION (lp->data));
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), window);
+
+ item = gtk_action_create_menu_item (action);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
- /* release the reference on the action */
+ /* release the reference on the menu item and action */
g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
/* cleanup */
- g_list_free (actions);
+ g_list_free (items);
}
}
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 2911bd5..4cfe3e4 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -40,7 +40,7 @@
#include <thunar/thunar-gio-extensions.h>
#include <thunar/thunar-gobject-extensions.h>
#include <thunar/thunar-gtk-extensions.h>
-#include <thunar/thunar-stock.h>
+#include <thunar/thunar-history.h>
#include <thunar/thunar-icon-renderer.h>
#include <thunar/thunar-marshal.h>
#include <thunar/thunar-private.h>
@@ -49,8 +49,8 @@
#include <thunar/thunar-simple-job.h>
#include <thunar/thunar-standard-view.h>
#include <thunar/thunar-standard-view-ui.h>
+#include <thunar/thunar-stock.h>
#include <thunar/thunar-templates-action.h>
-#include <thunar/thunar-history.h>
#include <thunar/thunar-thumbnailer.h>
#include <thunar/thunar-util.h>
@@ -1998,12 +1998,11 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
ThunarFile *file = NULL;
GtkWidget *window;
GList *providers;
- GList *actions = NULL;
+ GList *items = NULL;
GList *files = NULL;
GList *tmp;
GList *lp;
GtkAction *action;
- ThunarxMenuItem *item;
/* we cannot add anything if we aren't connected to any UI manager */
if (G_UNLIKELY (standard_view->ui_manager == NULL))
@@ -2033,16 +2032,16 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
file = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view));
}
- /* load the actions offered by the menu providers */
+ /* load the menu items offered by the menu providers */
for (lp = providers; lp != NULL; lp = lp->next)
{
if (G_LIKELY (files != NULL))
- tmp = thunarx_menu_provider_get_file_actions (lp->data, window, files);
+ tmp = thunarx_menu_provider_get_file_menu_items (lp->data, window, files);
else if (G_LIKELY (file != NULL))
- tmp = thunarx_menu_provider_get_folder_actions (lp->data, window, THUNARX_FILE_INFO (file));
+ tmp = thunarx_menu_provider_get_folder_menu_items (lp->data, window, THUNARX_FILE_INFO (file));
else
tmp = NULL;
- actions = g_list_concat (actions, tmp);
+ items = g_list_concat (items, tmp);
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (providers);
@@ -2069,18 +2068,17 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
}
/* add the actions specified by the menu providers */
- if (G_LIKELY (actions != NULL))
+ if (G_LIKELY (items != NULL))
{
/* allocate the action group and the merge id for the custom actions */
standard_view->priv->custom_actions = gtk_action_group_new ("thunar-standard-view-custom-actions");
standard_view->priv->custom_merge_id = gtk_ui_manager_new_merge_id (standard_view->ui_manager);
gtk_ui_manager_insert_action_group (standard_view->ui_manager, standard_view->priv->custom_actions, -1);
- /* add the actions to the UI manager */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add the menu items to the UI manager */
+ for (lp = items; lp != NULL; lp = lp->next)
{
- item = THUNARX_MENU_ITEM (lp->data);
- action = thunar_util_action_from_menu_item (item, GTK_WIDGET (window));
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), window);
/* add the action to the action group */
gtk_action_group_add_action (standard_view->priv->custom_actions, action);
@@ -2108,15 +2106,15 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
}
/* release the reference on item and action */
- g_object_unref (item);
- g_object_unref (action);
+ g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
/* be sure to update the UI manager to avoid flickering */
gtk_ui_manager_ensure_update (standard_view->ui_manager);
/* cleanup */
- g_list_free (actions);
+ g_list_free (items);
}
}
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 694c028..4856356 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -28,6 +28,7 @@
#include <thunar/thunar-application.h>
#include <thunar/thunar-clipboard-manager.h>
#include <thunar/thunar-create-dialog.h>
+#include <thunar/thunar-device.h>
#include <thunar/thunar-dialogs.h>
#include <thunar/thunar-dnd.h>
#include <thunar/thunar-gio-extensions.h>
@@ -42,7 +43,7 @@
#include <thunar/thunar-simple-job.h>
#include <thunar/thunar-tree-model.h>
#include <thunar/thunar-tree-view.h>
-#include <thunar/thunar-device.h>
+#include <thunar/thunar-util.h>
@@ -1264,7 +1265,8 @@ thunar_tree_view_context_menu (ThunarTreeView *view,
GtkWidget *window;
GIcon *icon;
GList *providers, *lp;
- GList *actions = NULL, *tmp;
+ GList *items = NULL, *tmp;
+ GtkAction *action;
/* verify that we're connected to the clipboard manager */
if (G_UNLIKELY (view->clipboard == NULL))
@@ -1504,28 +1506,31 @@ thunar_tree_view_context_menu (ThunarTreeView *view,
/* determine the toplevel window we belong to */
window = gtk_widget_get_toplevel (GTK_WIDGET (view));
- /* load the actions offered by the menu providers */
+ /* load the menu items offered by the menu providers */
for (lp = providers; lp != NULL; lp = lp->next)
{
- tmp = thunarx_menu_provider_get_folder_actions (lp->data, window, THUNARX_FILE_INFO (file));
- actions = g_list_concat (actions, tmp);
+ tmp = thunarx_menu_provider_get_folder_menu_items (lp->data, window, THUNARX_FILE_INFO (file));
+ items = g_list_concat (items, tmp);
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (providers);
- /* add the actions to the menu */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add the menu items to the menu */
+ for (lp = items; lp != NULL; lp = lp->next)
{
- item = gtk_action_create_menu_item (GTK_ACTION (lp->data));
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), window);
+
+ item = gtk_action_create_menu_item (action);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
- /* release the reference on the action */
+ /* release the reference on the menu item and action */
g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
/* add a separator to the end of the menu */
- if (G_LIKELY (lp != actions))
+ if (G_LIKELY (lp != items))
{
/* append a menu separator */
item = gtk_separator_menu_item_new ();
@@ -1534,7 +1539,7 @@ thunar_tree_view_context_menu (ThunarTreeView *view,
}
/* cleanup */
- g_list_free (actions);
+ g_list_free (items);
}
}
}
diff --git a/thunar/thunar-util.c b/thunar/thunar-util.c
index dd3a04d..c769dbc 100644
--- a/thunar/thunar-util.c
+++ b/thunar/thunar-util.c
@@ -623,8 +623,8 @@ extension_action_callback (GtkAction *action,
GtkAction *
-thunar_util_action_from_menu_item (ThunarxMenuItem *item,
- GtkWidget *parent_widget)
+thunar_util_action_from_menu_item (GObject *item,
+ GtkWidget *parent_widget)
{
gchar *name, *label, *tooltip, *icon_name;
gboolean sensitive, priority;
@@ -633,6 +633,8 @@ thunar_util_action_from_menu_item (ThunarxMenuItem *item,
GtkIconTheme *icon_theme;
ThunarIconFactory *icon_factory;
+ g_return_val_if_fail (THUNARX_IS_MENU_ITEM (item), NULL);
+
g_object_get (G_OBJECT (item),
"name", &name,
"label", &label,
@@ -650,13 +652,13 @@ thunar_util_action_from_menu_item (ThunarxMenuItem *item,
icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
icon = thunar_icon_factory_load_icon (icon_factory, icon_name, GTK_ICON_SIZE_MENU, TRUE, FALSE);
if (icon != NULL)
- {
- gtk_action_set_gicon (action, G_ICON (icon));
- g_object_unref (icon);
- }
+ {
+ gtk_action_set_gicon (action, G_ICON (icon));
+ g_object_unref (icon);
+ }
g_object_unref (G_OBJECT (icon_factory));
- }
+ }
gtk_action_set_sensitive (action, sensitive);
g_object_set (action, "is-important", priority, NULL);
@@ -664,7 +666,7 @@ thunar_util_action_from_menu_item (ThunarxMenuItem *item,
g_signal_connect_data (action, "activate",
G_CALLBACK (extension_action_callback),
g_object_ref (item),
- (GClosureNotify)g_object_unref, 0);
+ (GClosureNotify) g_object_unref, 0);
g_free (name);
g_free (label);
diff --git a/thunar/thunar-util.h b/thunar/thunar-util.h
index 78f3135..68220d6 100644
--- a/thunar/thunar-util.h
+++ b/thunar/thunar-util.h
@@ -24,8 +24,6 @@
#include <thunar/thunar-enum-types.h>
-#include <thunarx/thunarx-menu-item.h>
-
G_BEGIN_DECLS;
typedef void (*ThunarBookmarksFunc) (GFile *file,
@@ -57,8 +55,8 @@ gchar *thunar_util_change_working_directory (const gchar *new_directory)
void thunar_setup_display_cb (gpointer data);
-GtkAction *thunar_util_action_from_menu_item (ThunarxMenuItem *item,
- GtkWidget *parent_widget) G_GNUC_WARN_UNUSED_RESULT;
+GtkAction *thunar_util_action_from_menu_item (GObject *item,
+ GtkWidget *parent_widget) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS;
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 28a39d4..34b6af3 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1945,10 +1945,9 @@ static void
thunar_window_merge_custom_preferences (ThunarWindow *window)
{
GList *providers;
- GList *actions;
+ GList *items;
GList *ap, *pp;
GtkAction *action;
- ThunarxMenuItem *item;
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
_thunar_return_if_fail (window->custom_preferences_merge_id == 0);
@@ -1960,16 +1959,15 @@ thunar_window_merge_custom_preferences (ThunarWindow *window)
/* allocate a new merge id from the UI manager */
window->custom_preferences_merge_id = gtk_ui_manager_new_merge_id (window->ui_manager);
- /* add actions from all providers */
+ /* add menu items from all providers */
for (pp = providers; pp != NULL; pp = pp->next)
{
- /* determine the available actions for the provider */
- actions = thunarx_preferences_provider_get_actions (THUNARX_PREFERENCES_PROVIDER (pp->data), GTK_WIDGET (window));
- for (ap = actions; ap != NULL; ap = ap->next)
+ /* determine the available menu items for the provider */
+ items = thunarx_preferences_provider_get_menu_items (THUNARX_PREFERENCES_PROVIDER (pp->data), GTK_WIDGET (window));
+ for (ap = items; ap != NULL; ap = ap->next)
{
/* add the action to the action group */
- item = THUNARX_MENU_ITEM (ap->data);
- action = thunar_util_action_from_menu_item (item, GTK_WIDGET (window));
+ action = thunar_util_action_from_menu_item (G_OBJECT (ap->data), GTK_WIDGET (window));
gtk_action_group_add_action (window->action_group, action);
/* add the action to the UI manager */
@@ -1980,8 +1978,8 @@ thunar_window_merge_custom_preferences (ThunarWindow *window)
gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
- /* release the references on item and action */
- g_object_unref (G_OBJECT (item));
+ /* release the references on menu item and action */
+ g_object_unref (G_OBJECT (ap->data));
g_object_unref (G_OBJECT (action));
}
@@ -1989,7 +1987,7 @@ thunar_window_merge_custom_preferences (ThunarWindow *window)
g_object_unref (G_OBJECT (pp->data));
/* release the action list */
- g_list_free (actions);
+ g_list_free (items);
}
/* release the provider list */
@@ -3359,12 +3357,11 @@ thunar_window_update_custom_actions (ThunarView *view,
{
ThunarFile *folder;
GList *selected_files;
- GList *actions = NULL;
+ GList *items = NULL;
GList *lp;
GList *providers;
GList *tmp;
GtkAction *action;
- ThunarxMenuItem *item;
_thunar_return_if_fail (THUNAR_IS_VIEW (view));
_thunar_return_if_fail (THUNAR_IS_WINDOW (window));
@@ -3390,22 +3387,22 @@ thunar_window_update_custom_actions (ThunarView *view,
{
if (G_LIKELY (selected_files != NULL))
{
- tmp = thunarx_menu_provider_get_file_actions (lp->data,
- GTK_WIDGET (window),
- selected_files);
+ tmp = thunarx_menu_provider_get_file_menu_items (lp->data,
+ GTK_WIDGET (window),
+ selected_files);
}
else if (G_LIKELY (folder != NULL))
{
- tmp = thunarx_menu_provider_get_folder_actions (lp->data,
- GTK_WIDGET (window),
- THUNARX_FILE_INFO (folder));
+ tmp = thunarx_menu_provider_get_folder_menu_items (lp->data,
+ GTK_WIDGET (window),
+ THUNARX_FILE_INFO (folder));
}
else
{
tmp = NULL;
}
- actions = g_list_concat (actions, tmp);
+ items = g_list_concat (items, tmp);
g_object_unref (G_OBJECT (lp->data));
}
g_list_free (providers);
@@ -3428,7 +3425,7 @@ thunar_window_update_custom_actions (ThunarView *view,
}
/* add the actions specified by the menu providers */
- if (G_LIKELY (actions != NULL))
+ if (G_LIKELY (items != NULL))
{
/* allocate the action group and the merge id for the custom actions */
window->custom_actions = gtk_action_group_new ("ThunarActions");
@@ -3438,14 +3435,13 @@ thunar_window_update_custom_actions (ThunarView *view,
gtk_ui_manager_insert_action_group (window->ui_manager, window->custom_actions, 0);
gtk_ui_manager_ensure_update (window->ui_manager);
- /* add the actions to the UI manager */
- for (lp = actions; lp != NULL; lp = lp->next)
+ /* add the menu items to the UI manager */
+ for (lp = items; lp != NULL; lp = lp->next)
{
if (G_UNLIKELY (lp->data == NULL))
continue;
- item = THUNARX_MENU_ITEM (lp->data);
- action = thunar_util_action_from_menu_item (item, GTK_WIDGET (window));
+ action = thunar_util_action_from_menu_item (G_OBJECT (lp->data), GTK_WIDGET (window));
/* add the action to the action group */
gtk_action_group_add_action_with_accel (window->custom_actions,
@@ -3460,13 +3456,13 @@ thunar_window_update_custom_actions (ThunarView *view,
gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
- /* release the references on item and action */
- g_object_unref (item);
- g_object_unref (action);
+ /* release the references on menu item and action */
+ g_object_unref (G_OBJECT (lp->data));
+ g_object_unref (G_OBJECT (action));
}
/* cleanup */
- g_list_free (actions);
+ g_list_free (items);
}
}
diff --git a/thunarx/thunarx-menu-item.c b/thunarx/thunarx-menu-item.c
index dcacfe7..3a48d6f 100644
--- a/thunarx/thunarx-menu-item.c
+++ b/thunarx/thunarx-menu-item.c
@@ -15,55 +15,80 @@
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
#include <glib/gi18n-lib.h>
-#include "thunarx-menu-item.h"
+#include <thunarx/thunarx-private.h>
+#include <thunarx/thunarx-menu-item.h>
+
+
+
+#define THUNARX_MENU_ITEM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), THUNARX_TYPE_MENU_ITEM, ThunarxMenuItemPrivate))
+
+/**
+ * SECTION: thunarx-menu-item
+ * @short_description: The base class for menu items added to the context menus
+ * @title: ThunarxMenuItem
+ * @include: thunarx/thunarx.h
+ *
+ * The class for menu items that can be added to Thunar's context menus
+ * by extensions implementing the #ThunarxMenuProvider, #ThunarxPreferencesProvider
+ * or #ThunarxRenamerProvider interfaces. The items returned by extensions from
+ * *_get_menu_items() methods are instances of this class or a derived class.
+ */
+/* Signal identifiers */
enum
{
- ACTIVATE,
- LAST_SIGNAL
+ ACTIVATE,
+ LAST_SIGNAL
};
+/* Property identifiers */
enum
{
- PROP_0,
- PROP_NAME,
- PROP_LABEL,
- PROP_TOOLTIP,
- PROP_ICON,
- PROP_SENSITIVE,
- PROP_PRIORITY,
- PROP_MENU,
- LAST_PROP
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_TOOLTIP,
+ PROP_ICON,
+ PROP_SENSITIVE,
+ PROP_PRIORITY,
+ PROP_MENU,
+ LAST_PROP
};
-static void thunarx_menu_item_finalize (GObject *object);
-static void thunarx_menu_item_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void thunarx_menu_item_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-struct _ThunarxMenuItemDetails
+static void thunarx_menu_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void thunarx_menu_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void thunarx_menu_item_finalize (GObject *object);
+
+
+
+struct _ThunarxMenuItemPrivate
{
- char *name;
- char *label;
- char *tooltip;
- char *icon;
- gboolean sensitive;
- gboolean priority;
+ gchar *name;
+ gchar *label;
+ gchar *tooltip;
+ gchar *icon;
+ gboolean sensitive;
+ gboolean priority;
};
+
+
static guint signals[LAST_SIGNAL];
-static GObjectClass *parent_class = NULL;
G_DEFINE_TYPE (ThunarxMenuItem, thunarx_menu_item, G_TYPE_OBJECT)
@@ -71,67 +96,71 @@ G_DEFINE_TYPE (ThunarxMenuItem, thunarx_menu_item, G_TYPE_OBJECT)
static void
-thunarx_menu_item_class_init (ThunarxMenuItemClass *class)
+thunarx_menu_item_class_init (ThunarxMenuItemClass *klass)
{
- parent_class = g_type_class_peek_parent (class);
-
- G_OBJECT_CLASS (class)->finalize = thunarx_menu_item_finalize;
- G_OBJECT_CLASS (class)->get_property = thunarx_menu_item_get_property;
- G_OBJECT_CLASS (class)->set_property = thunarx_menu_item_set_property;
-
- signals[ACTIVATE] =
- g_signal_new ("activate",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ThunarxMenuItemClass,
- activate),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_NAME,
- g_param_spec_string ("name",
- "Name",
- "Name of the item",
- NULL,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_LABEL,
- g_param_spec_string ("label",
- "Label",
- "Label to display to the user",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_TOOLTIP,
- g_param_spec_string ("tooltip",
- "Tooltip",
- "Tooltip for the menu item",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_ICON,
- g_param_spec_string ("icon",
- "Icon",
- "Name of the icon to display in the menu item",
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_SENSITIVE,
- g_param_spec_boolean ("sensitive",
- "Sensitive",
- "Whether the menu item is sensitive",
- TRUE,
- G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (class),
- PROP_PRIORITY,
- g_param_spec_boolean ("priority",
- "Priority",
- "Show priority text in toolbars",
- TRUE,
- G_PARAM_READWRITE));
+ GObjectClass *gobject_class;
+
+ /* add our private data to the class type */
+ g_type_class_add_private (klass, sizeof (ThunarxMenuItemPrivate));
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = thunarx_menu_item_finalize;
+ gobject_class->get_property = thunarx_menu_item_get_property;
+ gobject_class->set_property = thunarx_menu_item_set_property;
+
+ signals[ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ThunarxMenuItemClass,
+ activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ g_object_class_install_property (gobject_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the item",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class,
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Label to display to the user",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_TOOLTIP,
+ g_param_spec_string ("tooltip",
+ "Tooltip",
+ "Tooltip for the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_ICON,
+ g_param_spec_string ("icon",
+ "Icon",
+ "Name of the icon to display in the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_SENSITIVE,
+ g_param_spec_boolean ("sensitive",
+ "Sensitive",
+ "Whether the menu item is sensitive",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class,
+ PROP_PRIORITY,
+ g_param_spec_boolean ("priority",
+ "Priority",
+ "Show priority text in toolbars",
+ TRUE,
+ G_PARAM_READWRITE));
}
@@ -139,114 +168,51 @@ thunarx_menu_item_class_init (ThunarxMenuItemClass *class)
static void
thunarx_menu_item_init (ThunarxMenuItem *item)
{
- item->details = g_new0 (ThunarxMenuItemDetails, 1);
- item->details->sensitive = TRUE;
-}
-
-
-
-/**
- * thunarx_menu_item_new:
- * @name: identifier for the menu item
- * @label: user-visible label of the menu item
- * @tooltip: tooltip of the menu item
- * @icon: path or name of the icon to display in the menu item
- *
- * Creates a new menu item that can be added to the toolbar or to a contextual menu.
- *
- * Returns: a newly created #ThunarxMenuItem
- */
-ThunarxMenuItem *
-thunarx_menu_item_new (const char *name,
- const char *label,
- const char *tooltip,
- const char *icon)
-{
- ThunarxMenuItem *item;
-
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (label != NULL, NULL);
-
- item = g_object_new (THUNARX_TYPE_MENU_ITEM,
- "name", name,
- "label", label,
- "tooltip", tooltip,
- "icon", icon,
- NULL);
-
- return item;
-}
-
-
-
-/**
- * thunarx_menu_item_activate:
- * @item: pointer to a #ThunarxMenuItem instance
- *
- * emits the activate signal.
- */
-void
-thunarx_menu_item_activate (ThunarxMenuItem *item)
-{
- g_signal_emit (item, signals[ACTIVATE], 0);
+ item->priv = THUNARX_MENU_ITEM_GET_PRIVATE (item);
+ item->priv->sensitive = TRUE;
+ item->priv->priority = FALSE;
}
static void
thunarx_menu_item_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- ThunarxMenuItem *item;
-
- item = THUNARX_MENU_ITEM (object);
+ ThunarxMenuItem *item = THUNARX_MENU_ITEM (object);
- switch (param_id)
+ switch (param_id)
{
- case PROP_NAME:
- {
- g_value_set_string (value, item->details->name);
- }
+ case PROP_NAME:
+ g_value_set_string (value, item->priv->name);
break;
- case PROP_LABEL:
- {
- g_value_set_string (value, item->details->label);
- }
+ case PROP_LABEL:
+ g_value_set_string (value, item->priv->label);
break;
- case PROP_TOOLTIP:
- {
- g_value_set_string (value, item->details->tooltip);
- }
+ case PROP_TOOLTIP:
+ g_value_set_string (value, item->priv->tooltip);
break;
- case PROP_ICON:
- {
- g_value_set_string (value, item->details->icon);
- }
+ case PROP_ICON:
+ g_value_set_string (value, item->priv->icon);
break;
- case PROP_SENSITIVE:
- {
- g_value_set_boolean (value, item->details->sensitive);
- }
+ case PROP_SENSITIVE:
+ g_value_set_boolean (value, item->priv->sensitive);
break;
- case PROP_PRIORITY:
- {
- g_value_set_boolean (value, item->details->priority);
- }
+ case PROP_PRIORITY:
+ g_value_set_boolean (value, item->priv->priority);
break;
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- }
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
- }
+ }
}
@@ -257,62 +223,46 @@ thunarx_menu_item_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ThunarxMenuItem *item;
+ ThunarxMenuItem *item = THUNARX_MENU_ITEM (object);
- item = THUNARX_MENU_ITEM (object);
-
- switch (param_id)
+ switch (param_id)
{
- case PROP_NAME:
- {
- g_free (item->details->name);
- item->details->name = g_strdup (g_value_get_string (value));
- g_object_notify (object, "name");
- }
+ case PROP_NAME:
+ g_free (item->priv->name);
+ item->priv->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
break;
- case PROP_LABEL:
- {
- g_free (item->details->label);
- item->details->label = g_strdup (g_value_get_string (value));
- g_object_notify (object, "label");
- }
+ case PROP_LABEL:
+ g_free (item->priv->label);
+ item->priv->label = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "label");
break;
- case PROP_TOOLTIP:
- {
- g_free (item->details->tooltip);
- item->details->tooltip = g_strdup (g_value_get_string (value));
- g_object_notify (object, "tooltip");
- }
+ case PROP_TOOLTIP:
+ g_free (item->priv->tooltip);
+ item->priv->tooltip = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "tooltip");
break;
- case PROP_ICON:
- {
- g_free (item->details->icon);
- item->details->icon = g_strdup (g_value_get_string (value));
- g_object_notify (object, "icon");
- }
+ case PROP_ICON:
+ g_free (item->priv->icon);
+ item->priv->icon = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "icon");
break;
- case PROP_SENSITIVE:
- {
- item->details->sensitive = g_value_get_boolean (value);
- g_object_notify (object, "sensitive");
- }
+ case PROP_SENSITIVE:
+ item->priv->sensitive = g_value_get_boolean (value);
+ g_object_notify (object, "sensitive");
break;
- case PROP_PRIORITY:
- {
- item->details->priority = g_value_get_boolean (value);
- g_object_notify (object, "priority");
- }
+ case PROP_PRIORITY:
+ item->priv->priority = g_value_get_boolean (value);
+ g_object_notify (object, "priority");
break;
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- }
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
@@ -322,16 +272,88 @@ thunarx_menu_item_set_property (GObject *object,
static void
thunarx_menu_item_finalize (GObject *object)
{
- ThunarxMenuItem *item;
+ ThunarxMenuItem *item = THUNARX_MENU_ITEM (object);
+
+ g_free (item->priv->name);
+ g_free (item->priv->label);
+ g_free (item->priv->tooltip);
+ g_free (item->priv->icon);
+
+ (*G_OBJECT_CLASS (thunarx_menu_item_parent_class)->finalize) (object);
+}
+
+
- item = THUNARX_MENU_ITEM (object);
+/**
+ * thunarx_menu_item_new:
+ * @name: identifier for the menu item
+ * @label: user-visible label of the menu item
+ * @tooltip: tooltip of the menu item
+ * @icon: path or name of the icon to display in the menu item
+ *
+ * Creates a new menu item that can be added to the toolbar or to a contextual menu.
+ *
+ * Returns: a newly created #ThunarxMenuItem
+ */
+ThunarxMenuItem *
+thunarx_menu_item_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *icon)
+{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+
+ return g_object_new (THUNARX_TYPE_MENU_ITEM,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "icon", icon,
+ NULL);
+}
- g_free (item->details->name);
- g_free (item->details->label);
- g_free (item->details->tooltip);
- g_free (item->details->icon);
- g_free (item->details);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+/**
+ * thunarx_menu_item_activate:
+ * @item: pointer to a #ThunarxMenuItem instance
+ *
+ * Emits the activate signal.
+ */
+void
+thunarx_menu_item_activate (ThunarxMenuItem *item)
+{
+ g_signal_emit (item, signals[ACTIVATE], 0);
+}
+
+
+
+/**
+ * thunarx_menu_item_get_sensitive:
+ * @item: pointer to a #ThunarxMenuItem instance
+ *
+ * Returns whether the menu item is sensitive.
+ */
+gboolean
+thunarx_menu_item_get_sensitive (ThunarxMenuItem *item)
+{
+ g_return_val_if_fail (THUNARX_IS_MENU_ITEM (item), FALSE);
+ return item->priv->sensitive;
+}
+
+
+
+/**
+ * thunarx_menu_item_set_sensitive:
+ * @item: pointer to a #ThunarxMenuItem instance
+ * @sensitive: %TRUE to make the menu item sensitive
+ *
+ * Sets the ::sensitive property of the menu item to @sensitive.
+ */
+void
+thunarx_menu_item_set_sensitive (ThunarxMenuItem *item,
+ gboolean sensitive)
+{
+ g_return_if_fail (THUNARX_IS_MENU_ITEM (item));
+ item->priv->sensitive = sensitive;
}
diff --git a/thunarx/thunarx-menu-item.h b/thunarx/thunarx-menu-item.h
index db61f9f..6a64ab9 100644
--- a/thunarx/thunarx-menu-item.h
+++ b/thunarx/thunarx-menu-item.h
@@ -16,38 +16,53 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef THUNARX_MENU_ITEM_H
-#define THUNARX_MENU_ITEM_H
+#if !defined(THUNARX_INSIDE_THUNARX_H) && !defined(THUNARX_COMPILATION)
+#error "Only <thunarx/thunarx.h> can be included directly, this file may disappear or change contents"
+#endif
+
+#ifndef __THUNARX_MENU_ITEM_H__
+#define __THUNARX_MENU_ITEM_H__
#include <glib-object.h>
-#define THUNARX_TYPE_MENU_ITEM (thunarx_menu_item_get_type())
+G_BEGIN_DECLS;
+
+typedef struct _ThunarxMenuItemPrivate ThunarxMenuItemPrivate;
+typedef struct _ThunarxMenuItemClass ThunarxMenuItemClass;
+typedef struct _ThunarxMenuItem ThunarxMenuItem;
+
+#define THUNARX_TYPE_MENU_ITEM (thunarx_menu_item_get_type ())
#define THUNARX_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNARX_TYPE_MENU_ITEM, ThunarxMenuItem))
#define THUNARX_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUNARX_TYPE_MENU_ITEM, ThunarxMenuItemClass))
#define THUNARX_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNARX_TYPE_MENU_ITEM))
#define THUNARX_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), THUNARX_TYPE_MENU_ITEM))
-#define THUNARX_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), THUNARX_TYPE_MENU_ITEM, ThunarxMenuItemClass))
+#define THUNARX_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), THUNARX_TYPE_MENU_ITEM))
-typedef struct _ThunarxMenuItem ThunarxMenuItem;
-typedef struct _ThunarxMenuItemDetails ThunarxMenuItemDetails;
-typedef struct _ThunarxMenuItemClass ThunarxMenuItemClass;
+struct _ThunarxMenuItemClass {
+ GObjectClass __parent__;
+ void (*activate) (ThunarxMenuItem *item);
+};
struct _ThunarxMenuItem {
- GObject parent;
- ThunarxMenuItemDetails *details;
-};
+ GObject __parent__;
-struct _ThunarxMenuItemClass {
- GObjectClass parent;
- void (*activate) (ThunarxMenuItem *item);
+ /*< private >*/
+ ThunarxMenuItemPrivate *priv;
};
-GType thunarx_menu_item_get_type (void);
-ThunarxMenuItem *thunarx_menu_item_new (const char *name,
- const char *label,
- const char *tip,
- const char *icon);
+GType thunarx_menu_item_get_type (void) G_GNUC_CONST;
+
+ThunarxMenuItem *thunarx_menu_item_new (const gchar *name,
+ const gchar *label,
+ const gchar *tip,
+ const gchar *icon) G_GNUC_MALLOC;
void thunarx_menu_item_activate (ThunarxMenuItem *item);
-#endif
+gboolean thunarx_menu_item_get_sensitive (ThunarxMenuItem *item);
+void thunarx_menu_item_set_sensitive (ThunarxMenuItem *item,
+ gboolean sensitive)
+
+G_END_DECLS;
+
+#endif /* !__THUNARX_MENU_ITEM_H__ */
diff --git a/thunarx/thunarx-menu-provider.c b/thunarx/thunarx-menu-provider.c
index a268860..1b1cff6 100644
--- a/thunarx/thunarx-menu-provider.c
+++ b/thunarx/thunarx-menu-provider.c
@@ -38,17 +38,17 @@
*
* Extensions that implement this interface should do its best to respond as
* fast as possible to method invokations by the file manager. That said, when
- * the file manager calls the thunarx_menu_provider_get_file_actions() or the
- * thunarx_menu_provider_get_folder_actions() method, the implementation in the
+ * the file manager calls the thunarx_menu_provider_get_file_menu_items() or the
+ * thunarx_menu_provider_get_folder_menu_items() method, the implementation in the
* extension should use only the thunarx_file_info_has_mime_type() and
- * thunarx_file_info_is_directory() methods to determine the actions that should
+ * thunarx_file_info_is_directory() methods to determine the menu items that should
* be added to the file manager's context menu. Don't perform any complicated I/O
- * to determine the action list, as that would block the whole file manager process.
+ * to determine the menu items list, as that would block the whole file manager process.
*
- * The <link linkend="ThunarxMenuItem">ThunarxMenuItem</link>s returned from the
- * thunarx_menu_provider_get_file_actions() and thunarx_menu_provider_get_folder_actions()
+ * The name of <link linkend="ThunarxMenuItem">ThunarxMenuItem</link>s returned from the
+ * thunarx_menu_provider_get_file_menu_items() and thunarx_menu_provider_get_folder_menu_items()
* methods must be namespaced with the module to avoid collision with internal file manager
- * actions and actions provided by other extensions. For example, the menu action provided
+ * menu items and menu items provided by other extensions. For example, the menu item provided
* by the <systemitem class="library">ThunarOpenTerminal</systemitem> extension should be
* called <literal>ThunarOpenTerminal::open-terminal</literal>.
*/
@@ -80,10 +80,10 @@ thunarx_menu_provider_get_type (void)
/**
- * thunarx_menu_provider_get_file_actions:
+ * thunarx_menu_provider_get_file_menu_items:
* @provider : a #ThunarxMenuProvider.
- * @window : the #GtkWindow within which the actions will be used.
- * @files : the list of #ThunarxFileInfo<!---->s to which the actions will be applied.
+ * @window : the #GtkWindow within which the menu items will be used.
+ * @files : the list of #ThunarxFileInfo<!---->s to which the menu items will be applied.
*
* Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer for
* @files.
@@ -91,12 +91,12 @@ thunarx_menu_provider_get_type (void)
* As a special note, this method automatically takes a reference on the
* @provider for every #ThunarxMenuItem object returned from the real implementation
* of this method in @provider. This is to make sure that the extension stays
- * in memory for atleast the time that the actions are used. If the extension
+ * in memory for at least the time that the menu items are used. If the extension
* wants to stay in memory for a longer time, it'll need to take care of this
* itself (e.g. by taking an additional reference on the @provider itself,
* that's released at a later time).
*
- * The caller is responsible to free the returned list of actions using
+ * The caller is responsible to free the returned list of menu items using
* something like this when no longer needed:
* <informalexample><programlisting>
* g_list_free_full (list, g_object_unref);
@@ -106,39 +106,39 @@ thunarx_menu_provider_get_type (void)
* for @files.
**/
GList*
-thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files)
+thunarx_menu_provider_get_file_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ GList *files)
{
- GList *actions;
+ GList *items;
g_return_val_if_fail (THUNARX_IS_MENU_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
g_return_val_if_fail (files != NULL, NULL);
- if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_file_actions != NULL)
+ if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_file_menu_items != NULL)
{
- /* query the actions from the implementation */
- actions = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_file_actions) (provider, window, files);
+ /* query the menu items from the implementation */
+ items = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_file_menu_items) (provider, window, files);
- /* take a reference on the provider for each action */
- thunarx_object_list_take_reference (actions, provider);
+ /* take a reference on the provider for each menu item */
+ thunarx_object_list_take_reference (items, provider);
}
else
{
- actions = NULL;
+ items = NULL;
}
- return actions;
+ return items;
}
/**
- * thunarx_menu_provider_get_folder_actions:
+ * thunarx_menu_provider_get_folder_menu_items:
* @provider : a #ThunarxMenuProvider.
- * @window : the #GtkWindow within which the actions will be used.
- * @folder : the folder to which the actions should will be applied.
+ * @window : the #GtkWindow within which the menu items will be used.
+ * @folder : the folder to which the menu items should will be applied.
*
* Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer for
* @folder.
@@ -146,12 +146,12 @@ thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
* As a special note, this method automatically takes a reference on the
* @provider for every #ThunarxMenuItem object returned from the real implementation
* of this method in @provider. This is to make sure that the extension stays
- * in memory for atleast the time that the actions are used. If the extension
+ * in memory for at least the time that the menu items are used. If the extension
* wants to stay in memory for a longer time, it'll need to take care of this
* itself (e.g. by taking an additional reference on the @provider itself,
* that's released at a later time).
*
- * The caller is responsible to free the returned list of actions using
+ * The caller is responsible to free the returned list of menu items using
* something like this when no longer needed:
* <informalexample><programlisting>
* g_list_free_full (list, g_object_unref);
@@ -161,57 +161,57 @@ thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
* for @folder.
**/
GList*
-thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder)
+thunarx_menu_provider_get_folder_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder)
{
- GList *actions;
+ GList *items;
g_return_val_if_fail (THUNARX_IS_MENU_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
g_return_val_if_fail (THUNARX_IS_FILE_INFO (folder), NULL);
g_return_val_if_fail (thunarx_file_info_is_directory (folder), NULL);
- if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_folder_actions != NULL)
+ if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_folder_menu_items != NULL)
{
- /* query the actions from the implementation */
- actions = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_folder_actions) (provider, window, folder);
+ /* query the menu items from the implementation */
+ items = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_folder_menu_items) (provider, window, folder);
- /* take a reference on the provider for each action */
- thunarx_object_list_take_reference (actions, provider);
+ /* take a reference on the provider for each menu item */
+ thunarx_object_list_take_reference (items, provider);
}
else
{
- actions = NULL;
+ items = NULL;
}
- return actions;
+ return items;
}
/**
- * thunarx_menu_provider_get_dnd_actions:
+ * thunarx_menu_provider_get_dnd_menu_items:
* @provider : a #ThunarxMenuProvider.
- * @window : the #GtkWindow within which the actions will be used.
+ * @window : the #GtkWindow within which the menu items will be used.
* @folder : the folder into which the @files are being dropped
* @files : the list of #ThunarxFileInfo<!---->s for the files that are
* being dropped to @folder in @window.
*
* Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer for
* dropping the @files into the @folder. For example, the thunar-archive-plugin
- * provides <guilabel>Extract Here</guilabel> actions when dropping archive
+ * provides <guilabel>Extract Here</guilabel> menu items when dropping archive
* files into a folder that is writable by the user.
*
* As a special note, this method automatically takes a reference on the
* @provider for every #ThunarxMenuItem object returned from the real implementation
* of this method in @provider. This is to make sure that the extension stays
- * in memory for atleast the time that the actions are used. If the extension
+ * in memory for at least the time that the menu items are used. If the extension
* wants to stay in memory for a longer time, it'll need to take care of this
* itself (e.g. by taking an additional reference on the @provider itself,
* that's released at a later time).
*
- * The caller is responsible to free the returned list of actions using
+ * The caller is responsible to free the returned list of menu items using
* something like this when no longer needed:
* <informalexample><programlisting>
* g_list_free_full (list, g_object_unref);
@@ -223,12 +223,12 @@ thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
* Since: 0.4.1
**/
GList*
-thunarx_menu_provider_get_dnd_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder,
- GList *files)
+thunarx_menu_provider_get_dnd_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder,
+ GList *files)
{
- GList *actions;
+ GList *items;
g_return_val_if_fail (THUNARX_IS_MENU_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
@@ -236,18 +236,18 @@ thunarx_menu_provider_get_dnd_actions (ThunarxMenuProvider *provider,
g_return_val_if_fail (thunarx_file_info_is_directory (folder), NULL);
g_return_val_if_fail (files != NULL, NULL);
- if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_dnd_actions != NULL)
+ if (THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_dnd_menu_items != NULL)
{
- /* query the actions from the implementation */
- actions = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_dnd_actions) (provider, window, folder, files);
+ /* query the menu items from the implementation */
+ items = (*THUNARX_MENU_PROVIDER_GET_IFACE (provider)->get_dnd_menu_items) (provider, window, folder, files);
- /* take a reference on the provider for each action */
- thunarx_object_list_take_reference (actions, provider);
+ /* take a reference on the provider for each menu item */
+ thunarx_object_list_take_reference (items, provider);
}
else
{
- actions = NULL;
+ items = NULL;
}
- return actions;
+ return items;
}
diff --git a/thunarx/thunarx-menu-provider.h b/thunarx/thunarx-menu-provider.h
index 1adabcc..f81ba22 100644
--- a/thunarx/thunarx-menu-provider.h
+++ b/thunarx/thunarx-menu-provider.h
@@ -41,9 +41,9 @@ typedef struct _ThunarxMenuProvider ThunarxMenuProvider;
/**
* ThunarxMenuProviderIface:
- * @get_file_actions: See thunarx_menu_provider_get_file_actions().
- * @get_folder_actions: See thunarx_menu_provider_get_folder_actions().
- * @get_dnd_actions: See thunarx_menu_provider_get_dnd_actions().
+ * @get_file_menu_items: See thunarx_menu_provider_get_file_menu_items().
+ * @get_folder_menu_items: See thunarx_menu_provider_get_folder_menu_items().
+ * @get_dnd_menu_items: See thunarx_menu_provider_get_dnd_menu_items().
*
* Interface with virtual methods implemented by extensions that provide
* additional menu items for the file manager's context menus.
@@ -57,18 +57,18 @@ struct _ThunarxMenuProviderIface
GTypeInterface __parent__;
/*< public >*/
- GList *(*get_file_actions) (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files);
+ GList *(*get_file_menu_items) (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
- GList *(*get_folder_actions) (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder);
+ GList *(*get_folder_menu_items) (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder);
- GList *(*get_dnd_actions) (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder,
- GList *files);
+ GList *(*get_dnd_menu_items) (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder,
+ GList *files);
/*< private >*/
void (*reserved1) (void);
@@ -78,18 +78,18 @@ struct _ThunarxMenuProviderIface
GType thunarx_menu_provider_get_type (void) G_GNUC_CONST;
-GList *thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- GList *files) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GList *thunarx_menu_provider_get_file_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ GList *files) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-GList *thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GList *thunarx_menu_provider_get_folder_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
-GList *thunarx_menu_provider_get_dnd_actions (ThunarxMenuProvider *provider,
- GtkWidget *window,
- ThunarxFileInfo *folder,
- GList *files) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GList *thunarx_menu_provider_get_dnd_menu_items (ThunarxMenuProvider *provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder,
+ GList *files) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS;
diff --git a/thunarx/thunarx-preferences-provider.c b/thunarx/thunarx-preferences-provider.c
index 97f7485..249c7f8 100644
--- a/thunarx/thunarx-preferences-provider.c
+++ b/thunarx/thunarx-preferences-provider.c
@@ -32,7 +32,7 @@
* @include: thunarx/thunarx.h
*
* The ThunarxPreferencesProvider interface is implemented by extensions that
- * want to register additional actions in the preferences menu of the file
+ * want to register additional items in the preferences menu of the file
* manager. In general this should only be done by extensions that are closely
* tied to the file manager (for example, the <literal>thunar-uca</literal> is
* such an extension, while an extension that just adds <guimenuitem>Compress
@@ -41,12 +41,12 @@
* the file manager menu, because it should use desktop-wide settings for
* archive managers instead).
*
- * The <link linkend="ThunarxMenuItem"><type>ThunarxMenuItem</type></link>s returned from the
- * thunarx_preferences_provider_get_actions() method must be namespaced with the
- * model to avoid collision with internal file manager actions and actions provided
- * by other extensions. For example, the preferences action provided by the
- * <literal>thunar-uca</literal> extension is called
- * <literal>ThunarUca::manage-actions</literal>.
+ * The name of <link linkend="ThunarxMenuItem"><type>ThunarxMenuItem</type></link>s
+ * returned from the thunarx_preferences_provider_get_menu items() method must be
+ * namespaced with the model to avoid collision with internal file manager menu items
+ * and menu items provided by other extensions. For example, the preferences menu item
+ * provided by the <literal>thunar-uca</literal> extension is called
+ * <literal>ThunarUca::manage-menu-items</literal>.
*/
GType
@@ -76,22 +76,22 @@ thunarx_preferences_provider_get_type (void)
/**
- * thunarx_preferences_provider_get_actions:
+ * thunarx_preferences_provider_get_menu_items:
* @provider : a #ThunarxPreferencesProvider.
- * @window : the #GtkWindow within which the actions will be used.
+ * @window : the #GtkWindow within which the menu items will be used.
*
* Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer
- * as preferences within @window. These actions will usually be added
+ * as preferences within @window. These menu items will usually be added
* to the builtin list of preferences in the "Edit" menu of the file
* manager's @window.
*
* Plugin writers that implement this interface should make sure to
- * choose descriptive action names and tooltips, and not to crowd the
+ * choose descriptive names and tooltips, and not to crowd the
* "Edit" menu too much. That said, think twice before implementing
- * this interface, as too many preference actions will render the
+ * this interface, as too many preference menu items will render the
* file manager useless over time!
*
- * The caller is responsible to free the returned list of actions using
+ * The caller is responsible to free the returned list of menu items using
* something like this when no longer needed:
* <informalexample><programlisting>
* g_list_free_full (list, g_object_unref);
@@ -101,26 +101,26 @@ thunarx_preferences_provider_get_type (void)
* to offer as preferences within @window.
**/
GList*
-thunarx_preferences_provider_get_actions (ThunarxPreferencesProvider *provider,
- GtkWidget *window)
+thunarx_preferences_provider_get_menu_items (ThunarxPreferencesProvider *provider,
+ GtkWidget *window)
{
- GList *actions;
+ GList *items;
g_return_val_if_fail (THUNARX_IS_PREFERENCES_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
- if (THUNARX_PREFERENCES_PROVIDER_GET_IFACE (provider)->get_actions != NULL)
+ if (THUNARX_PREFERENCES_PROVIDER_GET_IFACE (provider)->get_menu_items != NULL)
{
- /* query the actions from the implementation */
- actions = (*THUNARX_PREFERENCES_PROVIDER_GET_IFACE (provider)->get_actions) (provider, window);
+ /* query the menu items from the implementation */
+ items = (*THUNARX_PREFERENCES_PROVIDER_GET_IFACE (provider)->get_menu_items) (provider, window);
- /* take a reference on the provider for each action */
- thunarx_object_list_take_reference (actions, provider);
+ /* take a reference on the provider for each menu item */
+ thunarx_object_list_take_reference (items, provider);
}
else
{
- actions = NULL;
+ items = NULL;
}
- return actions;
+ return items;
}
diff --git a/thunarx/thunarx-preferences-provider.h b/thunarx/thunarx-preferences-provider.h
index 856c5a1..1a742d9 100644
--- a/thunarx/thunarx-preferences-provider.h
+++ b/thunarx/thunarx-preferences-provider.h
@@ -39,10 +39,10 @@ typedef struct _ThunarxPreferencesProvider ThunarxPreferencesProvider;
/**
* ThunarxPreferencesProviderIface:
- * @get_actions: See thunarx_preferences_provider_get_actions().
+ * @get_menu_items: See thunarx_preferences_provider_get_menu_items().
*
* Interface with virtual methods implementation by extensions that
- * want to install preferences actions in the file managers menu.
+ * want to install preferences items in the file managers menu.
* Providers don't need to implement all of the virtual methods listed
* in the interface.
*/
@@ -53,8 +53,8 @@ struct _ThunarxPreferencesProviderIface
GTypeInterface __parent__;
/*< public >*/
- GList *(*get_actions) (ThunarxPreferencesProvider *provider,
- GtkWidget *window);
+ GList *(*get_menu_items) (ThunarxPreferencesProvider *provider,
+ GtkWidget *window);
/*< private >*/
void (*reserved1) (void);
@@ -66,8 +66,8 @@ struct _ThunarxPreferencesProviderIface
GType thunarx_preferences_provider_get_type (void) G_GNUC_CONST;
-GList *thunarx_preferences_provider_get_actions (ThunarxPreferencesProvider *provider,
- GtkWidget *window);
+GList *thunarx_preferences_provider_get_menu_items (ThunarxPreferencesProvider *provider,
+ GtkWidget *window);
G_END_DECLS;
diff --git a/thunarx/thunarx-renamer.c b/thunarx/thunarx-renamer.c
index 7082dcc..510fc89 100644
--- a/thunarx/thunarx-renamer.c
+++ b/thunarx/thunarx-renamer.c
@@ -76,29 +76,29 @@ enum
* button which opens a dialog with the additional settings.
*/
-static void thunarx_renamer_finalize (GObject *object);
-static GObject *thunarx_renamer_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties);
-static void thunarx_renamer_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void thunarx_renamer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static gchar *thunarx_renamer_real_process (ThunarxRenamer *renamer,
- ThunarxFileInfo *file,
- const gchar *text,
- guint num);
-static void thunarx_renamer_real_load (ThunarxRenamer *renamer,
- GHashTable *settings);
-static void thunarx_renamer_real_save (ThunarxRenamer *renamer,
- GHashTable *settings);
-static GList *thunarx_renamer_real_get_actions (ThunarxRenamer *renamer,
- GtkWindow *window,
- GList *files);
+static void thunarx_renamer_finalize (GObject *object);
+static GObject *thunarx_renamer_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties);
+static void thunarx_renamer_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void thunarx_renamer_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static gchar *thunarx_renamer_real_process (ThunarxRenamer *renamer,
+ ThunarxFileInfo *file,
+ const gchar *text,
+ guint num);
+static void thunarx_renamer_real_load (ThunarxRenamer *renamer,
+ GHashTable *settings);
+static void thunarx_renamer_real_save (ThunarxRenamer *renamer,
+ GHashTable *settings);
+static GList *thunarx_renamer_real_get_menu_items (ThunarxRenamer *renamer,
+ GtkWindow *window,
+ GList *files);
@@ -135,7 +135,7 @@ thunarx_renamer_class_init (ThunarxRenamerClass *klass)
klass->process = thunarx_renamer_real_process;
klass->load = thunarx_renamer_real_load;
klass->save = thunarx_renamer_real_save;
- klass->get_actions = thunarx_renamer_real_get_actions;
+ klass->get_menu_items = thunarx_renamer_real_get_menu_items;
/**
* ThunarxRenamer:help-url:
@@ -406,9 +406,9 @@ thunarx_renamer_real_save (ThunarxRenamer *renamer,
static GList*
-thunarx_renamer_real_get_actions (ThunarxRenamer *renamer,
- GtkWindow *window,
- GList *files)
+thunarx_renamer_real_get_menu_items (ThunarxRenamer *renamer,
+ GtkWindow *window,
+ GList *files)
{
/* return an empty list, derived classes may override this method */
return NULL;
@@ -622,7 +622,7 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
/**
- * thunarx_renamer_get_actions:
+ * thunarx_renamer_get_menu_items:
* @renamer : a #ThunarxRenamer.
* @window : a #GtkWindow or %NULL.
* @files : a #GList of #ThunarxFileInfo<!---->s.
@@ -630,12 +630,12 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* Returns the list of #ThunarxMenuItem<!---->s provided by @renamer for
* the given list of @files. By default, this method returns %NULL
* (the empty list), but derived classes may override this method
- * to provide additional actions for files in the bulk renamer
+ * to provide additional items for files in the bulk renamer
* dialog list.
*
* The returned #ThunarxMenuItem<!---->s will be displayed in the file's
* context menu of the bulk renamer dialog, when this @renamer is
- * active. For example, an ID3-Tag based renamer may add an action
+ * active. For example, an ID3-Tag based renamer may add an menu item
* "Edit Tags" to the context menus of supported media files and,
* when activated, display a dialog (which should be transient and
* modal for @window, if not %NULL), which allows the users to edit
@@ -643,24 +643,24 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
*
* Derived classes that override this method should always check
* first if all the #ThunarxFileInfo<!---->s in the list of @files
- * are supported, and only return actions that can be performed on
+ * are supported, and only return menu items that can be performed on
* this specific list of @files. For example, the ID3-Tag renamer
* mentioned above, should first check whether all items in @files
* are actually audio files. The thunarx_file_info_has_mime_type()
* of the #ThunarxFileInfo interface can be used to easily test
* whether a file in the @files list is of a certain MIME type.
*
- * Some actions may only work properly if only a single file ist
+ * Some menu items may only work properly if only a single file is
* selected (for example, the ID3-Tag renamer will probably only
* supporting editing one file at a time). In this case you have
* basicly two options: Either you can return %NULL here if @files
- * does not contain exactly one item, or you can return the actions
+ * does not contain exactly one item, or you can return the menu items
* as usual, but make them insensitive, using:
* <informalexample><programlisting>
- * gtk_action_set_sensitive (action, FALSE);
+ * thunarx_menu_item_set_sensitive (item, FALSE);
* </programlisting></informalexample>
* The latter has the advantage that the user will still notice the
- * existance of the action and probably realize that it can only be
+ * existance of the menu item and probably realize that it can only be
* applied to a single item at once.
*
* The caller is responsible to free the returned list using something
@@ -672,11 +672,11 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* As a special note, this method automatically takes a reference on the
* @renamer for every #ThunarxMenuItem object returned from the real implementation
* of this method in @renamer. This is to make sure that the extension stays
- * in memory for atleast the time that the actions are used.
+ * in memory for at least the time that the menu items are used.
*
- * The #ThunarxMenuItem<!---->s returned from this method must be namespaced with
- * the module to avoid collision with internal file manager actions and
- * actions provided by other extensions. For example, the menu action
+ * The name of #ThunarxMenuItem<!---->s returned from this method must be namespaced with
+ * the module to avoid collision with internal file manager menu items and
+ * menu items provided by other extensions. For example, the menu item
* provided by the ID3-Tag renamer mentioned above, should be named
* <literal>TagRenamer::edit-tags</literal> (if <literal>TagRenamer</literal>
* is the class name). For additional information about the way #ThunarxMenuItem<!---->s
@@ -690,28 +690,28 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* Instead, if @window is not %NULL, add a weak reference using the
* g_object_weak_ref() or g_object_add_weak_pointer() method. But don't
* forget to release the weak reference if @window survived the lifetime
- * of your action (which is likely to be the case in most situations).
+ * of your menu item (which is likely to be the case in most situations).
*
* Return value: the list of #ThunarxMenuItem<!---->s provided by @renamer
* for the given list of @files.
**/
GList*
-thunarx_renamer_get_actions (ThunarxRenamer *renamer,
- GtkWindow *window,
- GList *files)
+thunarx_renamer_get_menu_items (ThunarxRenamer *renamer,
+ GtkWindow *window,
+ GList *files)
{
- GList *actions;
+ GList *items;
g_return_val_if_fail (THUNARX_IS_RENAMER (renamer), NULL);
g_return_val_if_fail (window == NULL || GTK_IS_WINDOW (window), NULL);
- /* query the actions from the implementation */
- actions = (*THUNARX_RENAMER_GET_CLASS (renamer)->get_actions) (renamer, window, files);
+ /* query the menu items from the implementation */
+ items = (*THUNARX_RENAMER_GET_CLASS (renamer)->get_menu_items) (renamer, window, files);
- /* take a reference on the renamer for each action */
- thunarx_object_list_take_reference (actions, renamer);
+ /* take a reference on the renamer for each menu item */
+ thunarx_object_list_take_reference (items, renamer);
- return actions;
+ return items;
}
diff --git a/thunarx/thunarx-renamer.h b/thunarx/thunarx-renamer.h
index 8143aa8..5291554 100644
--- a/thunarx/thunarx-renamer.h
+++ b/thunarx/thunarx-renamer.h
@@ -44,11 +44,11 @@ typedef struct _ThunarxRenamer ThunarxRenamer;
/**
* ThunarxRenamerClass:
- * @process: see thunarx_renamer_process().
- * @load: see thunarx_renamer_load().
- * @save: see thunarx_renamer_save().
- * @get_actions: see thunarx_renamer_get_actions().
- * @changed: see thunarx_renamer_changed().
+ * @process: see thunarx_renamer_process().
+ * @load: see thunarx_renamer_load().
+ * @save: see thunarx_renamer_save().
+ * @get_menu_items: see thunarx_renamer_get_menu_items().
+ * @changed: see thunarx_renamer_changed().
*
* Abstract base class with virtual methods implemented by extensions
* that provide additional bulk renamers for the integrated bulk
@@ -64,19 +64,19 @@ struct _ThunarxRenamerClass
/*< public >*/
/* virtual methods */
- gchar *(*process) (ThunarxRenamer *renamer,
- ThunarxFileInfo *file,
- const gchar *text,
- guint index);
+ gchar *(*process) (ThunarxRenamer *renamer,
+ ThunarxFileInfo *file,
+ const gchar *text,
+ guint index);
- void (*load) (ThunarxRenamer *renamer,
- GHashTable *settings);
- void (*save) (ThunarxRenamer *renamer,
- GHashTable *settings);
+ void (*load) (ThunarxRenamer *renamer,
+ GHashTable *settings);
+ void (*save) (ThunarxRenamer *renamer,
+ GHashTable *settings);
- GList *(*get_actions) (ThunarxRenamer *renamer,
- GtkWindow *window,
- GList *files);
+ GList *(*get_menu_items) (ThunarxRenamer *renamer,
+ GtkWindow *window,
+ GList *files);
/*< private >*/
void (*reserved0) (void);
@@ -104,31 +104,31 @@ struct _ThunarxRenamer
ThunarxRenamerPrivate *priv;
};
-GType thunarx_renamer_get_type (void) G_GNUC_CONST;
+GType thunarx_renamer_get_type (void) G_GNUC_CONST;
-const gchar *thunarx_renamer_get_help_url (ThunarxRenamer *renamer);
-void thunarx_renamer_set_help_url (ThunarxRenamer *renamer,
- const gchar *help_url);
+const gchar *thunarx_renamer_get_help_url (ThunarxRenamer *renamer);
+void thunarx_renamer_set_help_url (ThunarxRenamer *renamer,
+ const gchar *help_url);
-const gchar *thunarx_renamer_get_name (ThunarxRenamer *renamer);
-void thunarx_renamer_set_name (ThunarxRenamer *renamer,
- const gchar *name);
+const gchar *thunarx_renamer_get_name (ThunarxRenamer *renamer);
+void thunarx_renamer_set_name (ThunarxRenamer *renamer,
+ const gchar *name);
-gchar *thunarx_renamer_process (ThunarxRenamer *renamer,
- ThunarxFileInfo *file,
- const gchar *text,
- guint idx) G_GNUC_MALLOC;
+gchar *thunarx_renamer_process (ThunarxRenamer *renamer,
+ ThunarxFileInfo *file,
+ const gchar *text,
+ guint idx) G_GNUC_MALLOC;
-void thunarx_renamer_load (ThunarxRenamer *renamer,
- GHashTable *settings);
-void thunarx_renamer_save (ThunarxRenamer *renamer,
- GHashTable *settings);
+void thunarx_renamer_load (ThunarxRenamer *renamer,
+ GHashTable *settings);
+void thunarx_renamer_save (ThunarxRenamer *renamer,
+ GHashTable *settings);
-GList *thunarx_renamer_get_actions (ThunarxRenamer *renamer,
- GtkWindow *window,
- GList *files) G_GNUC_MALLOC;
+GList *thunarx_renamer_get_menu_items (ThunarxRenamer *renamer,
+ GtkWindow *window,
+ GList *files) G_GNUC_MALLOC;
-void thunarx_renamer_changed (ThunarxRenamer *renamer);
+void thunarx_renamer_changed (ThunarxRenamer *renamer);
G_END_DECLS;
diff --git a/thunarx/thunarx.symbols b/thunarx/thunarx.symbols
index 9b0cf61..a53ed09 100644
--- a/thunarx/thunarx.symbols
+++ b/thunarx/thunarx.symbols
@@ -46,15 +46,22 @@ thunarx_file_info_list_get_type
thunarx_file_info_list_copy
thunarx_file_info_list_free
+/* ThunarxMenuItem methods */
+thunarx_menu_item_get_type G_GNUC_CONST
+thunarx_menu_item_new G_GNUC_MALLOC
+thunarx_menu_item_activate
+thunarx_menu_item_get_sensitive
+thunarx_menu_item_set_sensitive
+
/* ThunarxMenuProvider methods */
thunarx_menu_provider_get_type G_GNUC_CONST
-thunarx_menu_provider_get_file_actions G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
-thunarx_menu_provider_get_folder_actions G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
-thunarx_menu_provider_get_dnd_actions G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
+thunarx_menu_provider_get_file_menu_items G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
+thunarx_menu_provider_get_folder_menu_items G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
+thunarx_menu_provider_get_dnd_menu_items G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT
/* ThunarxPreferencesProvider methods */
thunarx_preferences_provider_get_type G_GNUC_CONST
-thunarx_preferences_provider_get_actions
+thunarx_preferences_provider_get_menu_items
/* ThunarxPropertyPage methods */
thunarx_property_page_get_type G_GNUC_CONST
@@ -92,7 +99,7 @@ thunarx_renamer_set_name
thunarx_renamer_process G_GNUC_MALLOC
thunarx_renamer_save
thunarx_renamer_load
-thunarx_renamer_get_actions G_GNUC_MALLOC
+thunarx_renamer_get_menu_items G_GNUC_MALLOC
thunarx_renamer_changed
/* ThunarxRenamerProvider methods */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list