summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/thunarx/thunarx-docs.xml2
-rw-r--r--docs/reference/thunarx/thunarx.types1
-rw-r--r--examples/tex-open-terminal/tex-open-terminal.c28
-rw-r--r--plugins/thunar-uca/thunar-uca-provider.c46
-rw-r--r--plugins/thunar-wallpaper/twp-provider.c41
-rw-r--r--thunar/thunar-icon-factory.c20
-rw-r--r--thunar/thunar-icon-factory.h3
-rw-r--r--thunar/thunar-icon-renderer.c2
-rw-r--r--thunar/thunar-standard-view.c36
-rw-r--r--thunar/thunar-util.c64
-rw-r--r--thunar/thunar-util.h5
-rw-r--r--thunar/thunar-window.c52
-rw-r--r--thunarx/Makefile.am2
-rw-r--r--thunarx/thunarx-menu-item.c337
-rw-r--r--thunarx/thunarx-menu-item.h53
-rw-r--r--thunarx/thunarx-menu-provider.c20
-rw-r--r--thunarx/thunarx-preferences-provider.c6
-rw-r--r--thunarx/thunarx-renamer.c12
-rw-r--r--thunarx/thunarx.h1
19 files changed, 606 insertions, 125 deletions
diff --git a/docs/reference/thunarx/thunarx-docs.xml b/docs/reference/thunarx/thunarx-docs.xml
index 0d6cc095..3fc60d3e 100644
--- a/docs/reference/thunarx/thunarx-docs.xml
+++ b/docs/reference/thunarx/thunarx-docs.xml
@@ -190,7 +190,7 @@
<title>Names</title>
<para>
- Most objects created by the extensions need names, e.g. the <link linkend="GtkAction"><type>GtkAction</type></link>s
+ Most objects created by the extensions need names, e.g. the <link linkend="ThunarxMenuItem"><type>ThunarxMenuItem</type></link>s
returned from the <link linkend="ThunarxMenuProvider"><type>ThunarxMenuProvider</type></link>s. These names must be
namespaced with the name of the extension. For example the main action returned from the
<application>TexOpenTerminal</application> extension (which can be found in the <filename
diff --git a/docs/reference/thunarx/thunarx.types b/docs/reference/thunarx/thunarx.types
index 588ee869..81cbc41c 100644
--- a/docs/reference/thunarx/thunarx.types
+++ b/docs/reference/thunarx/thunarx.types
@@ -1,6 +1,7 @@
#include <thunarx/thunarx.h>
thunarx_file_info_get_type
+thunarx_menu_item_get_type
thunarx_menu_provider_get_type
thunarx_preferences_provider_get_type
thunarx_property_page_get_type
diff --git a/examples/tex-open-terminal/tex-open-terminal.c b/examples/tex-open-terminal/tex-open-terminal.c
index 42da069d..18c17886 100644
--- a/examples/tex-open-terminal/tex-open-terminal.c
+++ b/examples/tex-open-terminal/tex-open-terminal.c
@@ -41,7 +41,7 @@ static GList *tex_open_terminal_get_file_actions (ThunarxMenuProvider *pr
static GList *tex_open_terminal_get_folder_actions (ThunarxMenuProvider *provider,
GtkWidget *window,
ThunarxFileInfo *folder);
-static void tex_open_terminal_activated (GtkAction *action,
+static void tex_open_terminal_activated (ThunarxMenuItem *item,
GtkWidget *window);
@@ -110,10 +110,10 @@ tex_open_terminal_get_folder_actions (ThunarxMenuProvider *provider,
GtkWidget *window,
ThunarxFileInfo *folder)
{
- GtkAction *action = NULL;
- gchar *scheme;
- gchar *path;
- gchar *uri;
+ ThunarxMenuItem *item = NULL;
+ gchar *scheme;
+ gchar *path;
+ gchar *uri;
/* determine the uri scheme of the folder and check if we support it */
scheme = thunarx_file_info_get_uri_scheme (folder);
@@ -127,33 +127,33 @@ tex_open_terminal_get_folder_actions (ThunarxMenuProvider *provider,
/* check if we have a valid path here */
if (G_LIKELY (path != NULL))
{
- action = gtk_action_new ("TexOpenTerminal::open-terminal-here", "Open Terminal Here", "Open Terminal in this folder", NULL);
- g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (tex_open_terminal_activated), window);
- g_object_set_data_full (G_OBJECT (action), "open-terminal-here-path", path, g_free);
+ item = thunarx_menu_item_new ("TexOpenTerminal::open-terminal-here", "Open Terminal Here", "Open Terminal in this folder", "utilities-terminal");
+ g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (tex_open_terminal_activated), window);
+ g_object_set_data_full (G_OBJECT (item), "open-terminal-here-path", path, g_free);
}
}
g_free (scheme);
- return (action != NULL) ? g_list_prepend (NULL, action) : NULL;
+ return (item != NULL) ? g_list_prepend (NULL, item) : NULL;
}
static void
-tex_open_terminal_activated (GtkAction *action,
- GtkWidget *window)
+tex_open_terminal_activated (ThunarxMenuItem *item,
+ GtkWidget *window)
{
const gchar *path;
GError *error = NULL;
gchar *command;
/* determine the folder path */
- path = g_object_get_data (G_OBJECT (action), "open-terminal-here-path");
+ path = g_object_get_data (G_OBJECT (item), "open-terminal-here-path");
if (G_UNLIKELY (path == NULL))
return;
/* build up the command line for the terminal */
- command = g_strdup_printf ("Terminal --working-directory \"%s\"", path);
+ command = g_strdup_printf ("exo-open --launch TerminalEmulator --working-directory \"%s\"", path);
/* try to run the terminal command */
if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (window), command, FALSE, FALSE, &error))
@@ -166,5 +166,3 @@ tex_open_terminal_activated (GtkAction *action,
/* cleanup */
g_free (command);
}
-
-
diff --git a/plugins/thunar-uca/thunar-uca-provider.c b/plugins/thunar-uca/thunar-uca-provider.c
index e14db0ce..7686ee3d 100644
--- a/plugins/thunar-uca/thunar-uca-provider.c
+++ b/plugins/thunar-uca/thunar-uca-provider.c
@@ -48,7 +48,7 @@ static GList *thunar_uca_provider_get_folder_actions (ThunarxMenuProvider
GtkWidget *window,
ThunarxFileInfo *folder);
static void thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
- GtkAction *action);
+ ThunarxMenuItem *item);
static void thunar_uca_provider_child_watch (ThunarUcaProvider *uca_provider,
gint exit_status);
static void thunar_uca_provider_child_watch_destroy (gpointer user_data,
@@ -175,15 +175,15 @@ static GList*
thunar_uca_provider_get_actions (ThunarxPreferencesProvider *preferences_provider,
GtkWidget *window)
{
- GtkAction *action;
- GClosure *closure;
+ ThunarxMenuItem *item;
+ GClosure *closure;
- action = gtk_action_new ("ThunarUca::manage-actions", _("Configure c_ustom actions..."),
- _("Setup custom actions that will appear in the file managers context menus"), NULL);
+ 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));
- g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);
+ g_signal_connect_closure (G_OBJECT (item), "activate", closure, TRUE);
- return g_list_prepend (NULL, action);
+ return g_list_prepend (NULL, item);
}
@@ -197,7 +197,7 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
ThunarUcaProvider *uca_provider = THUNAR_UCA_PROVIDER (menu_provider);
ThunarUcaContext *uca_context = NULL;
GtkTreeIter iter;
- GtkAction *action;
+ ThunarxMenuItem *item;
GList *actions = NULL;
GList *paths;
GList *lp;
@@ -205,7 +205,8 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
gchar *label;
gchar *unique_id;
gchar *name;
- GIcon *gicon;
+ gchar *icon_name = NULL;
+ GIcon *gicon = NULL;
paths = thunar_uca_model_match (uca_provider->model, files);
for (lp = g_list_last (paths); lp != NULL; lp = lp->prev)
@@ -224,13 +225,15 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
/* generate a unique action name */
name = g_strdup_printf ("uca-action-%s", unique_id);
+ if (gicon != NULL)
+ icon_name = g_icon_to_string (gicon);
+
/* create the new action with the given parameters */
- action = gtk_action_new (name, label, tooltip, NULL);
- gtk_action_set_gicon (action, gicon);
+ item = thunarx_menu_item_new (name, label, tooltip, icon_name);
/* grab a tree row reference on the given path */
row = gtk_tree_row_reference_new (GTK_TREE_MODEL (uca_provider->model), lp->data);
- g_object_set_qdata_full (G_OBJECT (action), thunar_uca_row_quark, row,
+ g_object_set_qdata_full (G_OBJECT (item), thunar_uca_row_quark, row,
(GDestroyNotify) gtk_tree_row_reference_free);
/* allocate a new context on-demand */
@@ -238,20 +241,21 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
uca_context = thunar_uca_context_new (window, files);
else
uca_context = thunar_uca_context_ref (uca_context);
- g_object_set_qdata_full (G_OBJECT (action), thunar_uca_context_quark, uca_context, (GDestroyNotify) thunar_uca_context_unref);
+ g_object_set_qdata_full (G_OBJECT (item), thunar_uca_context_quark, uca_context, (GDestroyNotify) thunar_uca_context_unref);
/* connect the "activate" signal */
- g_signal_connect_data (G_OBJECT (action), "activate", G_CALLBACK (thunar_uca_provider_activated),
+ g_signal_connect_data (G_OBJECT (item), "activate", G_CALLBACK (thunar_uca_provider_activated),
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, action);
+ actions = g_list_prepend (actions, item);
/* cleanup */
g_free (tooltip);
g_free (label);
g_free (name);
+ g_free (icon_name);
g_free (unique_id);
if (gicon != NULL)
@@ -296,7 +300,7 @@ thunar_uca_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
static void
thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
- GtkAction *action)
+ ThunarxMenuItem *item)
{
GtkTreeRowReference *row;
ThunarUcaContext *uca_context;
@@ -318,10 +322,10 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
GClosure *child_watch;
g_return_if_fail (THUNAR_UCA_IS_PROVIDER (uca_provider));
- g_return_if_fail (GTK_IS_ACTION (action));
+ g_return_if_fail (THUNARX_IS_MENU_ITEM (item));
/* check if the row reference is still valid */
- row = g_object_get_qdata (G_OBJECT (action), thunar_uca_row_quark);
+ row = g_object_get_qdata (G_OBJECT (item), thunar_uca_row_quark);
if (G_UNLIKELY (!gtk_tree_row_reference_valid (row)))
return;
@@ -331,7 +335,7 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
gtk_tree_path_free (path);
/* determine the files and the window for the action */
- uca_context = g_object_get_qdata (G_OBJECT (action), thunar_uca_context_quark);
+ 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);
@@ -354,7 +358,7 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
if (G_LIKELY (filename != NULL))
{
/* if this is a folder action, we just use the filename as working directory */
- if (g_object_get_qdata (G_OBJECT (action), thunar_uca_folder_quark) != NULL)
+ if (g_object_get_qdata (G_OBJECT (item), thunar_uca_folder_quark) != NULL)
{
working_directory = filename;
filename = NULL;
@@ -412,7 +416,7 @@ thunar_uca_provider_activated (ThunarUcaProvider *uca_provider,
/* present error message to the user */
if (G_UNLIKELY (!succeed))
{
- g_object_get (G_OBJECT (action), "label", &label, NULL);
+ g_object_get (G_OBJECT (item), "label", &label, NULL);
dialog = gtk_message_dialog_new ((GtkWindow *) window,
GTK_DIALOG_DESTROY_WITH_PARENT
| GTK_DIALOG_MODAL,
diff --git a/plugins/thunar-wallpaper/twp-provider.c b/plugins/thunar-wallpaper/twp-provider.c
index b0b5ae1e..5d903c59 100644
--- a/plugins/thunar-wallpaper/twp-provider.c
+++ b/plugins/thunar-wallpaper/twp-provider.c
@@ -46,7 +46,7 @@ static void twp_provider_finalize (GObject *objec
static GList *twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
GtkWidget *window,
GList *files);
-static void twp_action_set_wallpaper (GtkAction *action,
+static void twp_action_set_wallpaper (ThunarxMenuItem *item,
gpointer user_data);
static gint twp_get_active_workspace_number (GdkScreen *screen);
@@ -129,15 +129,15 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
GtkWidget *window,
GList *files)
{
- GtkWidget *action = NULL;
- GFile *location;
- GList *actions = NULL;
- gchar *mime_type;
- gchar selection_name[100];
- Atom xfce_selection_atom;
- Atom nautilus_selection_atom;
- GdkScreen *gdk_screen = gdk_screen_get_default();
- gint xscreen = gdk_screen_get_number(gdk_screen);
+ ThunarxMenuItem *item = NULL;
+ GFile *location;
+ GList *actions = NULL;
+ gchar *mime_type;
+ gchar selection_name[100];
+ Atom xfce_selection_atom;
+ Atom nautilus_selection_atom;
+ GdkScreen *gdk_screen = gdk_screen_get_default();
+ gint xscreen = gdk_screen_get_number(gdk_screen);
desktop_type = DESKTOP_TYPE_NONE;
@@ -168,14 +168,10 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
|| thunarx_file_info_has_mime_type (files->data, "image/svg+xml")
|| thunarx_file_info_has_mime_type (files->data, "image/svg+xml-compressed")))
{
- action = g_object_new (GTK_TYPE_ACTION,
- "name", "Twp::setwallpaper",
- "icon-name", "preferences-desktop-wallpaper",
- "label", _("Set as wallpaper"),
- NULL);
- g_signal_connect (action, "activate", G_CALLBACK (twp_action_set_wallpaper), files->data);
-
- actions = g_list_append (actions, action);
+ 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);
}
g_free(mime_type);
}
@@ -200,17 +196,12 @@ twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
}
- if ((desktop_type == DESKTOP_TYPE_NONE) && (action != NULL))
- {
- /* gtk_widget_set_sensitive (action, FALSE); */
- }
-
return actions;
}
static void
-twp_action_set_wallpaper (GtkAction *action,
- gpointer user_data)
+twp_action_set_wallpaper (ThunarxMenuItem *item,
+ gpointer user_data)
{
ThunarxFileInfo *file_info = user_data;
GdkDisplay *display = gdk_display_get_default();
diff --git a/thunar/thunar-icon-factory.c b/thunar/thunar-icon-factory.c
index fd6bdc3c..06312215 100644
--- a/thunar/thunar-icon-factory.c
+++ b/thunar/thunar-icon-factory.c
@@ -79,7 +79,8 @@ static GdkPixbuf *thunar_icon_factory_load_from_file (ThunarIconFactory
static GdkPixbuf *thunar_icon_factory_lookup_icon (ThunarIconFactory *factory,
const gchar *name,
gint size,
- gboolean wants_default);
+ gboolean wants_default,
+ gboolean force_size);
static guint thunar_icon_key_hash (gconstpointer data);
static gboolean thunar_icon_key_equal (gconstpointer a,
gconstpointer b);
@@ -468,7 +469,8 @@ static GdkPixbuf*
thunar_icon_factory_lookup_icon (ThunarIconFactory *factory,
const gchar *name,
gint size,
- gboolean wants_default)
+ gboolean wants_default,
+ gboolean force_size)
{
ThunarIconKey lookup_key;
ThunarIconKey *key;
@@ -499,7 +501,8 @@ thunar_icon_factory_lookup_icon (ThunarIconFactory *factory,
name = "folder";
/* check if the icon theme contains an icon of that name */
- icon_info = gtk_icon_theme_lookup_icon (factory->icon_theme, name, size, GTK_ICON_LOOKUP_FORCE_SIZE);
+ icon_info = gtk_icon_theme_lookup_icon (factory->icon_theme, name, size,
+ force_size ? GTK_ICON_LOOKUP_FORCE_SIZE : 0);
if (G_LIKELY (icon_info != NULL))
{
/* try to load the pixbuf from the icon info */
@@ -603,7 +606,7 @@ static GdkPixbuf*
thunar_icon_factory_load_fallback (ThunarIconFactory *factory,
gint size)
{
- return thunar_icon_factory_lookup_icon (factory, "text-x-generic", size, FALSE);
+ return thunar_icon_factory_lookup_icon (factory, "text-x-generic", size, FALSE, TRUE);
}
@@ -749,7 +752,8 @@ GdkPixbuf*
thunar_icon_factory_load_icon (ThunarIconFactory *factory,
const gchar *name,
gint size,
- gboolean wants_default)
+ gboolean wants_default,
+ gboolean force_size)
{
_thunar_return_val_if_fail (THUNAR_IS_ICON_FACTORY (factory), NULL);
_thunar_return_val_if_fail (size > 0, NULL);
@@ -767,7 +771,7 @@ thunar_icon_factory_load_icon (ThunarIconFactory *factory,
}
/* lookup the icon */
- return thunar_icon_factory_lookup_icon (factory, name, size, wants_default);
+ return thunar_icon_factory_lookup_icon (factory, name, size, wants_default, force_size);
}
@@ -819,7 +823,7 @@ thunar_icon_factory_load_file_icon (ThunarIconFactory *factory,
if (custom_icon != NULL)
{
/* try to load the icon */
- icon = thunar_icon_factory_lookup_icon (factory, custom_icon, icon_size, FALSE);
+ icon = thunar_icon_factory_lookup_icon (factory, custom_icon, icon_size, FALSE, TRUE);
if (G_LIKELY (icon != NULL))
return icon;
}
@@ -893,7 +897,7 @@ thunar_icon_factory_load_file_icon (ThunarIconFactory *factory,
if (G_LIKELY (icon == NULL))
{
icon_name = thunar_file_get_icon_name (file, icon_state, factory->icon_theme);
- icon = thunar_icon_factory_load_icon (factory, icon_name, icon_size, TRUE);
+ icon = thunar_icon_factory_load_icon (factory, icon_name, icon_size, TRUE, TRUE);
}
if (G_LIKELY (icon != NULL))
diff --git a/thunar/thunar-icon-factory.h b/thunar/thunar-icon-factory.h
index a7137ab5..cf29a717 100644
--- a/thunar/thunar-icon-factory.h
+++ b/thunar/thunar-icon-factory.h
@@ -54,7 +54,8 @@ gboolean thunar_icon_factory_get_show_thumbnail (const ThunarIconF
GdkPixbuf *thunar_icon_factory_load_icon (ThunarIconFactory *factory,
const gchar *name,
gint size,
- gboolean wants_default);
+ gboolean wants_default,
+ gboolean force_size);
GdkPixbuf *thunar_icon_factory_load_file_icon (ThunarIconFactory *factory,
ThunarFile *file,
diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c
index 1561dc71..fe411708 100644
--- a/thunar/thunar-icon-renderer.c
+++ b/thunar/thunar-icon-renderer.c
@@ -497,7 +497,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer,
emblem_size = MIN ((2 * icon_renderer->size) / 3, 32);
/* check if we have the emblem in the icon theme */
- emblem = thunar_icon_factory_load_icon (icon_factory, lp->data, emblem_size, FALSE);
+ emblem = thunar_icon_factory_load_icon (icon_factory, lp->data, emblem_size, FALSE, TRUE);
if (G_UNLIKELY (emblem == NULL))
continue;
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 3e8a5b0e..2911bd58 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1994,14 +1994,16 @@ static void
thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
GList *selected_items)
{
- GtkTreeIter iter;
- ThunarFile *file = NULL;
- GtkWidget *window;
- GList *providers;
- GList *actions = NULL;
- GList *files = NULL;
- GList *tmp;
- GList *lp;
+ GtkTreeIter iter;
+ ThunarFile *file = NULL;
+ GtkWidget *window;
+ GList *providers;
+ GList *actions = 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))
@@ -2077,8 +2079,11 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
/* add the actions to the UI manager */
for (lp = actions; lp != NULL; lp = lp->next)
{
+ item = THUNARX_MENU_ITEM (lp->data);
+ action = thunar_util_action_from_menu_item (item, GTK_WIDGET (window));
+
/* add the action to the action group */
- gtk_action_group_add_action (standard_view->priv->custom_actions, GTK_ACTION (lp->data));
+ gtk_action_group_add_action (standard_view->priv->custom_actions, action);
/* add the action to the UI manager */
if (G_LIKELY (selected_items != NULL))
@@ -2087,8 +2092,8 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
gtk_ui_manager_add_ui (standard_view->ui_manager,
standard_view->priv->custom_merge_id,
"/file-context-menu/placeholder-custom-actions",
- gtk_action_get_name (GTK_ACTION (lp->data)),
- gtk_action_get_name (GTK_ACTION (lp->data)),
+ gtk_action_get_name (GTK_ACTION (action)),
+ gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
}
else
@@ -2097,13 +2102,14 @@ thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view,
gtk_ui_manager_add_ui (standard_view->ui_manager,
standard_view->priv->custom_merge_id,
"/folder-context-menu/placeholder-custom-actions",
- gtk_action_get_name (GTK_ACTION (lp->data)),
- gtk_action_get_name (GTK_ACTION (lp->data)),
+ gtk_action_get_name (GTK_ACTION (action)),
+ gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
}
- /* release the reference on the action */
- g_object_unref (G_OBJECT (lp->data));
+ /* release the reference on item and action */
+ g_object_unref (item);
+ g_object_unref (action);
}
/* be sure to update the UI manager to avoid flickering */
diff --git a/thunar/thunar-util.c b/thunar/thunar-util.c
index 86402495..dd3a04df 100644
--- a/thunar/thunar-util.c
+++ b/thunar/thunar-util.c
@@ -54,6 +54,7 @@
#include <glib/gwin32.h>
#endif
+#include <thunar/thunar-icon-factory.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-util.h>
@@ -609,3 +610,66 @@ thunar_setup_display_cb (gpointer data)
{
g_setenv ("DISPLAY", (char *) data, TRUE);
}
+
+
+
+static void
+extension_action_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ thunarx_menu_item_activate (THUNARX_MENU_ITEM (callback_data));
+}
+
+
+
+GtkAction *
+thunar_util_action_from_menu_item (ThunarxMenuItem *item,
+ GtkWidget *parent_widget)
+{
+ gchar *name, *label, *tooltip, *icon_name;
+ gboolean sensitive, priority;
+ GtkAction *action;
+ GdkPixbuf *icon;
+ GtkIconTheme *icon_theme;
+ ThunarIconFactory *icon_factory;
+
+ g_object_get (G_OBJECT (item),
+ "name", &name,
+ "label", &label,
+ "tooltip", &tooltip,
+ "icon", &icon_name,
+ "sensitive", &sensitive,
+ "priority", &priority,
+ NULL);
+
+ action = gtk_action_new (name, label, tooltip, NULL);
+
+ if (icon_name != NULL && parent_widget != NULL)
+ {
+ icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (parent_widget));
+ 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);
+ }
+
+ g_object_unref (G_OBJECT (icon_factory));
+ }
+
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "is-important", priority, NULL);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (extension_action_callback),
+ g_object_ref (item),
+ (GClosureNotify)g_object_unref, 0);
+
+ g_free (name);
+ g_free (label);
+ g_free (tooltip);
+ g_free (icon_name);
+
+ return action;
+}
diff --git a/thunar/thunar-util.h b/thunar/thunar-util.h
index 82cba4da..78f31358 100644
--- a/thunar/thunar-util.h
+++ b/thunar/thunar-util.h
@@ -24,6 +24,8 @@
#include <thunar/thunar-enum-types.h>
+#include <thunarx/thunarx-menu-item.h>
+
G_BEGIN_DECLS;
typedef void (*ThunarBookmarksFunc) (GFile *file,
@@ -55,6 +57,9 @@ 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;
+
G_END_DECLS;
#endif /* !__THUNAR_UTIL_H__ */
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 6b2594e6..28a39d48 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1944,9 +1944,11 @@ thunar_window_install_sidepane (ThunarWindow *window,
static void
thunar_window_merge_custom_preferences (ThunarWindow *window)
{
- GList *providers;
- GList *actions;
- GList *ap, *pp;
+ GList *providers;
+ GList *actions;
+ 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);
@@ -1966,18 +1968,21 @@ thunar_window_merge_custom_preferences (ThunarWindow *window)
for (ap = actions; ap != NULL; ap = ap->next)
{
/* add the action to the action group */
- gtk_action_group_add_action (window->action_group, GTK_ACTION (ap->data));
+ item = THUNARX_MENU_ITEM (ap->data);
+ action = thunar_util_action_from_menu_item (item, GTK_WIDGET (window));
+ gtk_action_group_add_action (window->action_group, action);
/* add the action to the UI manager */
gtk_ui_manager_add_ui (window->ui_manager,
window->custom_preferences_merge_id,
"/main-menu/edit-menu/placeholder-custom-preferences",
- gtk_action_get_name (GTK_ACTION (ap->data)),
- gtk_action_get_name (GTK_ACTION (ap->data)),
+ gtk_action_get_name (GTK_ACTION (action)),
+ gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
- /* release the reference on the action */
- g_object_unref (G_OBJECT (ap->data));
+ /* release the references on item and action */
+ g_object_unref (G_OBJECT (item));
+ g_object_unref (G_OBJECT (action));
}
/* release the reference on the provider */
@@ -3352,12 +3357,14 @@ thunar_window_update_custom_actions (ThunarView *view,
GParamSpec *pspec,
ThunarWindow *window)
{
- ThunarFile *folder;
- GList *selected_files;
- GList *actions = NULL;
- GList *lp;
- GList *providers;
- GList *tmp;
+ ThunarFile *folder;
+ GList *selected_files;
+ GList *actions = 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));
@@ -3434,21 +3441,28 @@ thunar_window_update_custom_actions (ThunarView *view,
/* add the actions to the UI manager */
for (lp = actions; 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));
+
/* add the action to the action group */
gtk_action_group_add_action_with_accel (window->custom_actions,
- GTK_ACTION (lp->data),
+ action,
NULL);
/* add to the file context menu */
gtk_ui_manager_add_ui (window->ui_manager,
window->custom_merge_id,
"/main-menu/file-menu/placeholder-custom-actions",
- gtk_action_get_name (GTK_ACTION (lp->data)),
- gtk_action_get_name (GTK_ACTION (lp->data)),
+ gtk_action_get_name (GTK_ACTION (action)),
+ gtk_action_get_name (GTK_ACTION (action)),
GTK_UI_MANAGER_MENUITEM, FALSE);
- /* release the reference on the action */
- g_object_unref (G_OBJECT (lp->data));
+ /* release the references on item and action */
+ g_object_unref (item);
+ g_object_unref (action);
}
/* cleanup */
diff --git a/thunarx/Makefile.am b/thunarx/Makefile.am
index a992f929..abea8793 100644
--- a/thunarx/Makefile.am
+++ b/thunarx/Makefile.am
@@ -9,6 +9,7 @@ libthunarx_headers = \
thunarx.h \
thunarx-config.h \
thunarx-file-info.h \
+ thunarx-menu-item.h \
thunarx-menu-provider.h \
thunarx-preferences-provider.h \
thunarx-property-page.h \
@@ -31,6 +32,7 @@ libthunarx_3_la_SOURCES = \
$(libthunarx_headers) \
thunarx-config.c \
thunarx-file-info.c \
+ thunarx-menu-item.c \
thunarx-menu-provider.c \
thunarx-preferences-provider.c \
thunarx-private.c \
diff --git a/thunarx/thunarx-menu-item.c b/thunarx/thunarx-menu-item.c
new file mode 100644
index 00000000..dcacfe75
--- /dev/null
+++ b/thunarx/thunarx-menu-item.c
@@ -0,0 +1,337 @@
+/*-
+ * Copyright (c) 2017 Andre Miranda <andreldm@xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include "thunarx-menu-item.h"
+
+enum
+{
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+enum
+{
+ 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
+{
+ char *name;
+ char *label;
+ char *tooltip;
+ char *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)
+
+
+
+static void
+thunarx_menu_item_class_init (ThunarxMenuItemClass *class)
+{
+ 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));
+}
+
+
+
+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);
+}
+
+
+
+static void
+thunarx_menu_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ThunarxMenuItem *item;
+
+ item = THUNARX_MENU_ITEM (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_value_set_string (value, item->details->name);
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_value_set_string (value, item->details->label);
+ }
+ break;
+
+ case PROP_TOOLTIP:
+ {
+ g_value_set_string (value, item->details->tooltip);
+ }
+ break;
+
+ case PROP_ICON:
+ {
+ g_value_set_string (value, item->details->icon);
+ }
+ break;
+
+ case PROP_SENSITIVE:
+ {
+ g_value_set_boolean (value, item->details->sensitive);
+ }
+ break;
+
+ case PROP_PRIORITY:
+ {
+ g_value_set_boolean (value, item->details->priority);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+
+
+static void
+thunarx_menu_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ThunarxMenuItem *item;
+
+ item = THUNARX_MENU_ITEM (object);
+
+ 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");
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_free (item->details->label);
+ item->details->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");
+ }
+ break;
+
+ case PROP_ICON:
+ {
+ g_free (item->details->icon);
+ item->details->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");
+ }
+ break;
+
+ case PROP_PRIORITY:
+ {
+ item->details->priority = g_value_get_boolean (value);
+ g_object_notify (object, "priority");
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+
+
+static void
+thunarx_menu_item_finalize (GObject *object)
+{
+ ThunarxMenuItem *item;
+
+ item = THUNARX_MENU_ITEM (object);
+
+ 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);
+}
diff --git a/thunarx/thunarx-menu-item.h b/thunarx/thunarx-menu-item.h
new file mode 100644
index 00000000..db61f9f3
--- /dev/null
+++ b/thunarx/thunarx-menu-item.h
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2017 Andre Miranda <andreldm@xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef THUNARX_MENU_ITEM_H
+#define THUNARX_MENU_ITEM_H
+
+#include <glib-object.h>
+
+#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))
+
+typedef struct _ThunarxMenuItem ThunarxMenuItem;
+typedef struct _ThunarxMenuItemDetails ThunarxMenuItemDetails;
+typedef struct _ThunarxMenuItemClass ThunarxMenuItemClass;
+
+struct _ThunarxMenuItem {
+ GObject parent;
+ ThunarxMenuItemDetails *details;
+};
+
+struct _ThunarxMenuItemClass {
+ GObjectClass parent;
+ void (*activate) (ThunarxMenuItem *item);
+};
+
+GType thunarx_menu_item_get_type (void);
+ThunarxMenuItem *thunarx_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon);
+
+void thunarx_menu_item_activate (ThunarxMenuItem *item);
+
+#endif
diff --git a/thunarx/thunarx-menu-provider.c b/thunarx/thunarx-menu-provider.c
index 9fd77f07..a268860d 100644
--- a/thunarx/thunarx-menu-provider.c
+++ b/thunarx/thunarx-menu-provider.c
@@ -45,7 +45,7 @@
* 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.
*
- * The <link linkend="GtkAction">GtkAction</link>s returned from the
+ * The <link linkend="ThunarxMenuItem">ThunarxMenuItem</link>s returned from the
* thunarx_menu_provider_get_file_actions() and thunarx_menu_provider_get_folder_actions()
* 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
@@ -85,11 +85,11 @@ thunarx_menu_provider_get_type (void)
* @window : the #GtkWindow within which the actions will be used.
* @files : the list of #ThunarxFileInfo<!---->s to which the actions will be applied.
*
- * Returns the list of #GtkAction<!---->s that @provider has to offer for
+ * Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer for
* @files.
*
* As a special note, this method automatically takes a reference on the
- * @provider for every #GtkAction object returned from the real implementation
+ * @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
* wants to stay in memory for a longer time, it'll need to take care of this
@@ -102,7 +102,7 @@ thunarx_menu_provider_get_type (void)
* g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
- * Return value: the list of #GtkAction<!---->s that @provider has to offer
+ * Return value: the list of #ThunarxMenuItem<!---->s that @provider has to offer
* for @files.
**/
GList*
@@ -140,11 +140,11 @@ thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
* @window : the #GtkWindow within which the actions will be used.
* @folder : the folder to which the actions should will be applied.
*
- * Returns the list of #GtkAction<!---->s that @provider has to offer for
+ * Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer for
* @folder.
*
* As a special note, this method automatically takes a reference on the
- * @provider for every #GtkAction object returned from the real implementation
+ * @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
* wants to stay in memory for a longer time, it'll need to take care of this
@@ -157,7 +157,7 @@ thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
* g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
- * Return value: the list of #GtkAction<!---->s that @provider has to offer
+ * Return value: the list of #ThunarxMenuItem<!---->s that @provider has to offer
* for @folder.
**/
GList*
@@ -198,13 +198,13 @@ thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
* @files : the list of #ThunarxFileInfo<!---->s for the files that are
* being dropped to @folder in @window.
*
- * Returns the list of #GtkAction<!---->s that @provider has to offer for
+ * 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
* 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 #GtkAction object returned from the real implementation
+ * @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
* wants to stay in memory for a longer time, it'll need to take care of this
@@ -217,7 +217,7 @@ thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
* g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
- * Return value: the list of #GtkAction<!---->s that @provider has to offer
+ * Return value: the list of #ThunarxMenuItem<!---->s that @provider has to offer
* for dropping @files to @folder.
*
* Since: 0.4.1
diff --git a/thunarx/thunarx-preferences-provider.c b/thunarx/thunarx-preferences-provider.c
index e4908f5c..97f7485f 100644
--- a/thunarx/thunarx-preferences-provider.c
+++ b/thunarx/thunarx-preferences-provider.c
@@ -41,7 +41,7 @@
* the file manager menu, because it should use desktop-wide settings for
* archive managers instead).
*
- * The <link linkend="GtkAction"><type>GtkAction</type></link>s returned from the
+ * 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
@@ -80,7 +80,7 @@ thunarx_preferences_provider_get_type (void)
* @provider : a #ThunarxPreferencesProvider.
* @window : the #GtkWindow within which the actions will be used.
*
- * Returns the list of #GtkAction<!---->s that @provider has to offer
+ * Returns the list of #ThunarxMenuItem<!---->s that @provider has to offer
* as preferences within @window. These actions will usually be added
* to the builtin list of preferences in the "Edit" menu of the file
* manager's @window.
@@ -97,7 +97,7 @@ thunarx_preferences_provider_get_type (void)
* g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
- * Return value: the list of #GtkAction<!---->s that @provider has
+ * Return value: the list of #ThunarxMenuItem<!---->s that @provider has
* to offer as preferences within @window.
**/
GList*
diff --git a/thunarx/thunarx-renamer.c b/thunarx/thunarx-renamer.c
index cec3a697..7082dcc1 100644
--- a/thunarx/thunarx-renamer.c
+++ b/thunarx/thunarx-renamer.c
@@ -627,13 +627,13 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* @window : a #GtkWindow or %NULL.
* @files : a #GList of #ThunarxFileInfo<!---->s.
*
- * Returns the list of #GtkAction<!---->s provided by @renamer for
+ * 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
* dialog list.
*
- * The returned #GtkAction<!---->s will be displayed in the file's
+ * 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
* "Edit Tags" to the context menus of supported media files and,
@@ -670,16 +670,16 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* </programlisting></informalexample>
*
* As a special note, this method automatically takes a reference on the
- * @renamer for every #GtkAction object returned from the real implementation
+ * @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.
*
- * The #GtkAction<!---->s returned from this method must be namespaced with
+ * 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
* 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 #GtkAction<!---->s
+ * is the class name). For additional information about the way #ThunarxMenuItem<!---->s
* should be returned from extensions and the way they are used, read the
* description of the #ThunarxMenuProvider interface or read the introduction
* provided with this reference manual.
@@ -692,7 +692,7 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* forget to release the weak reference if @window survived the lifetime
* of your action (which is likely to be the case in most situations).
*
- * Return value: the list of #GtkAction<!---->s provided by @renamer
+ * Return value: the list of #ThunarxMenuItem<!---->s provided by @renamer
* for the given list of @files.
**/
GList*
diff --git a/thunarx/thunarx.h b/thunarx/thunarx.h
index ebdb9af0..d6de6913 100644
--- a/thunarx/thunarx.h
+++ b/thunarx/thunarx.h
@@ -25,6 +25,7 @@
#include <thunarx/thunarx-config.h>
#include <thunarx/thunarx-file-info.h>
+#include <thunarx/thunarx-menu-item.h>
#include <thunarx/thunarx-menu-provider.h>
#include <thunarx/thunarx-preferences-provider.h>
#include <thunarx/thunarx-property-page.h>