Commit 0fa8145c authored by Andre Miranda's avatar Andre Miranda

Rename thunarx methods *_actions to *_menu_items

parent 47fe1cbc
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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 ();
......
......@@ -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 */
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......
......@@ -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);