[Xfce4-commits] [thunar-plugins/thunar-vcs-plugin] 07/13: Port actions to thunarx-3's ThunarxMenuItem
noreply at xfce.org
noreply at xfce.org
Thu May 24 04:05:11 CEST 2018
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 thunar-plugins/thunar-vcs-plugin.
commit de79efb50f67124a2ecf5305ffd7ce00d1f42e46
Author: Andre Miranda <andreldm at xfce.org>
Date: Wed Nov 15 22:23:03 2017 -0300
Port actions to thunarx-3's ThunarxMenuItem
---
thunar-vcs-plugin/tvp-git-action.c | 178 ++++++++++++++++++-------------------
thunar-vcs-plugin/tvp-git-action.h | 2 +-
thunar-vcs-plugin/tvp-provider.c | 90 +++++++++----------
thunar-vcs-plugin/tvp-svn-action.c | 168 +++++++++++++++++-----------------
thunar-vcs-plugin/tvp-svn-action.h | 2 +-
5 files changed, 213 insertions(+), 227 deletions(-)
diff --git a/thunar-vcs-plugin/tvp-git-action.c b/thunar-vcs-plugin/tvp-git-action.c
index 10d60ad..2cbcb17 100644
--- a/thunar-vcs-plugin/tvp-git-action.c
+++ b/thunar-vcs-plugin/tvp-git-action.c
@@ -43,14 +43,14 @@ static void tsh_cclosure_marshal_VOID__POINTER_STRING (GClosure *closure,
struct _TvpGitActionClass
{
- GtkActionClass __parent__;
+ ThunarxMenuItemClass __parent__;
};
struct _TvpGitAction
{
- GtkAction __parent__;
+ ThunarxMenuItem __parent__;
struct {
unsigned is_parent : 1;
@@ -83,7 +83,7 @@ static guint action_signal[SIGNAL_COUNT];
-static GtkWidget *tvp_git_action_create_menu_item (GtkAction *action);
+static GtkWidget *tvp_git_action_create_menu_item (ThunarxMenuItem *item);
@@ -95,13 +95,13 @@ static void tvp_git_action_set_property (GObject*, guint, const GValue*, GParamS
static GQuark tvp_action_arg_quark = 0;
-static void tvp_action_exec (GtkAction *item, TvpGitAction *tvp_action);
+static void tvp_action_exec (ThunarxMenuItem *item, TvpGitAction *tvp_action);
-static void tvp_action_unimplemented (GtkAction *, const gchar *);
+static void tvp_action_unimplemented (ThunarxMenuItem *, const gchar *);
-THUNARX_DEFINE_TYPE (TvpGitAction, tvp_git_action, GTK_TYPE_ACTION)
+THUNARX_DEFINE_TYPE (TvpGitAction, tvp_git_action, THUNARX_TYPE_MENU_ITEM)
@@ -109,13 +109,10 @@ static void
tvp_git_action_class_init (TvpGitActionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkActionClass *gtkaction_class = GTK_ACTION_CLASS (klass);
gobject_class->finalize = tvp_git_action_finalize;
gobject_class->set_property = tvp_git_action_set_property;
- gtkaction_class->create_menu_item = tvp_git_action_create_menu_item;
-
g_object_class_install_property (gobject_class, PROPERTY_IS_PARENT,
g_param_spec_boolean ("is-parent", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
@@ -143,7 +140,7 @@ tvp_git_action_init (TvpGitAction *self)
-GtkAction *
+ThunarxMenuItem *
tvp_git_action_new (const gchar *name,
const gchar *label,
GList *files,
@@ -152,28 +149,25 @@ tvp_git_action_new (const gchar *name,
gboolean is_direcotry,
gboolean is_file)
{
- GtkAction *action;
+ ThunarxMenuItem *item;
g_return_val_if_fail(name, NULL);
g_return_val_if_fail(label, NULL);
- action = g_object_new (TVP_TYPE_GIT_ACTION,
- "hide-if-empty", FALSE,
+ item = g_object_new (TVP_TYPE_GIT_ACTION,
"name", name,
"label", label,
"is-parent", is_parent,
"is-directory", is_direcotry,
"is-file", is_file,
-#if !GTK_CHECK_VERSION(2,9,0)
- "stock-id", "git",
-#else
- "icon-name", "git",
-#endif
+ "icon", "git",
NULL);
- TVP_GIT_ACTION (action)->files = thunarx_file_info_list_copy (files);
- // TVP_GIT_ACTION (action)->window = gtk_widget_ref (window);
- TVP_GIT_ACTION (action)->window = window;
- return action;
+ TVP_GIT_ACTION (item)->files = thunarx_file_info_list_copy (files);
+ TVP_GIT_ACTION (item)->window = window;
+
+ tvp_git_action_create_menu_item (item);
+
+ return item;
}
@@ -183,7 +177,6 @@ tvp_git_action_finalize (GObject *object)
{
thunarx_file_info_list_free (TVP_GIT_ACTION (object)->files);
TVP_GIT_ACTION (object)->files = NULL;
- // gtk_widget_unref (TVP_GIT_ACTION (object)->window);
TVP_GIT_ACTION (object)->window = NULL;
G_OBJECT_CLASS (tvp_git_action_parent_class)->finalize (object);
@@ -213,99 +206,91 @@ tvp_git_action_set_property (GObject *object, guint property_id, const GValue *v
static void
-add_subaction(GtkAction *action, GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+add_subaction(ThunarxMenuItem *item, ThunarxMenu *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *icon, gchar *arg)
{
- GtkAction *subaction;
- GtkWidget *subitem;
-
- subaction = gtk_action_new (name, text, tooltip, stock);
- g_object_set_qdata (G_OBJECT (subaction), tvp_action_arg_quark, arg);
- g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_exec), action);
-
- subitem = gtk_action_create_menu_item (subaction);
- g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
- gtk_widget_set_tooltip_text(subitem, tooltip);
- gtk_menu_shell_append (menu, subitem);
- gtk_widget_show(subitem);
+ ThunarxMenuItem *subitem;
+ subitem = thunarx_menu_item_new (name, text, tooltip, icon);
+ thunarx_menu_append_item (menu, subitem);
+ g_object_set_qdata (G_OBJECT (subitem), tvp_action_arg_quark, arg);
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_exec), item);
+ g_object_unref (subitem);
}
static void
-add_subaction_u (GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+add_subaction_u (ThunarxMenu *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *icon, gchar *arg)
{
- GtkAction *subaction;
- GtkWidget *subitem;
-
- subaction = gtk_action_new (name, text, tooltip, stock);
- g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_unimplemented), arg);
-
- subitem = gtk_action_create_menu_item (subaction);
- g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
- gtk_widget_set_tooltip_text(subitem, tooltip);
- //gtk_menu_shell_append (menu, subitem);
- //gtk_widget_show(subitem);
- gtk_widget_unref (subitem);
+ /* keep the current behavior, only show menu items if they are implemented */
+ /*ThunarxMenuItem *subitem;
+ subitem = thunarx_menu_item_new (name, text, tooltip, icon);
+ thunarx_menu_append_item (menu, subitem);
+ g_object_set_qdata (G_OBJECT (subitem), tvp_action_arg_quark, arg);
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), arg);
+ g_object_unref (subitem);*/
}
static GtkWidget *
-tvp_git_action_create_menu_item (GtkAction *action)
+tvp_git_action_create_menu_item (ThunarxMenuItem *item)
{
- GtkWidget *item;
- GtkWidget *menu;
- TvpGitAction *tvp_action = TVP_GIT_ACTION (action);
-
- item = GTK_ACTION_CLASS(tvp_git_action_parent_class)->create_menu_item (action);
-
- menu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
-
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::add", Q_("Menu|Add"), _("Add"), GTK_STOCK_ADD, "--add");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::bisect", Q_("Menu|Bisect"), _("Bisect"), NULL, _("Bisect"));
- if (tvp_action->property.is_file)
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::blame", Q_("Menu|Blame"), _("Blame"), GTK_STOCK_INDEX, "--blame");
- if(tvp_action->property.is_parent)
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::branch", Q_("Menu|Branch"), _("Branch"), NULL, "--branch");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::checkout", Q_("Menu|Checkout"), _("Checkout"), GTK_STOCK_CONNECT, _("Checkout"));
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::clean", Q_("Menu|Clean"), _("Clean"), GTK_STOCK_CLEAR, "--clean");
- if(tvp_action->property.is_parent)
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::clone", Q_("Menu|Clone"), _("Clone"), GTK_STOCK_COPY, "--clone");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::commit", Q_("Menu|Commit"), _("Commit"), GTK_STOCK_APPLY, _("Commit"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::diff", Q_("Menu|Diff"), _("Diff"), GTK_STOCK_FIND_AND_REPLACE, _("Diff"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::fetch", Q_("Menu|Fetch"), _("Fetch"), NULL, _("Fetch"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::grep", Q_("Menu|Grep"), _("Grep"), NULL, _("Grep"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::init", Q_("Menu|Init"), _("Init"), NULL, _("Init"));
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::log", Q_("Menu|Log"), _("Log"), GTK_STOCK_INDEX, "--log");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::merge", Q_("Menu|Merge"), _("Merge"), NULL, _("Merge"));
- if(!tvp_action->property.is_parent)
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::move", Q_("Menu|Move"), _("Move"), GTK_STOCK_DND_MULTIPLE, "--move");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::pull", Q_("Menu|Pull"), _("Pull"), NULL, _("Pull"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::push", Q_("Menu|Push"), _("Push"), NULL, _("Push"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::rebase", Q_("Menu|Rebase"), _("Rebase"), NULL, _("Rebase"));
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::reset", Q_("Menu|Reset"), _("Reset"), GTK_STOCK_UNDO, "--reset");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::remove", Q_("Menu|Remove"), _("Remove"), GTK_STOCK_DELETE, _("Remove"));
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::show", Q_("Menu|Show"), _("Show"), NULL, _("Show"));
- if(tvp_action->property.is_parent)
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::stash", Q_("Menu|Stash"), _("Stash"), GTK_STOCK_SAVE, "--stash");
- if(tvp_action->property.is_parent)
- add_subaction (action, GTK_MENU_SHELL(menu), "tvp::status", Q_("Menu|Status"), _("Status"), GTK_STOCK_DIALOG_INFO, "--status");
- add_subaction_u(GTK_MENU_SHELL(menu), "tvp::tag", Q_("Menu|Tag"), _("Tag"), NULL, _("Tag"));
+ ThunarxMenu *menu;
+ TvpGitAction *tvp_action = TVP_GIT_ACTION (item);
+
+ menu = thunarx_menu_new ();
+ thunarx_menu_item_set_menu (item, menu);
+
+ add_subaction (item, menu, "tvp::git::add", Q_("Menu|Add"), _("Add"), "list-add", "--add");
+ add_subaction_u(menu, "tvp::bisect", Q_("Menu|Bisect"), _("Bisect"), NULL, _("Bisect"));
+ if (tvp_action->property.is_file)
+ add_subaction (item, menu, "tvp::blame", Q_("Menu|Blame"), _("Blame"), "gtk-index", "--blame");
+ if (tvp_action->property.is_parent)
+ add_subaction (item, menu, "tvp::branch", Q_("Menu|Branch"), _("Branch"), NULL, "--branch");
+ add_subaction_u(menu, "tvp::checkout", Q_("Menu|Checkout"), _("Checkout"), "gtk-connect", _("Checkout"));
+ add_subaction (item, menu, "tvp::clean", Q_("Menu|Clean"), _("Clean"), "edit-clear", "--clean");
+ if (tvp_action->property.is_parent)
+ add_subaction (item, menu, "tvp::clone", Q_("Menu|Clone"), _("Clone"), "edit-copy", "--clone");
+ add_subaction_u(menu, "tvp::commit", Q_("Menu|Commit"), _("Commit"), "gtk-apply", _("Commit"));
+ add_subaction_u(menu, "tvp::diff", Q_("Menu|Diff"), _("Diff"), "edit-find-replace", _("Diff"));
+ add_subaction_u(menu, "tvp::fetch", Q_("Menu|Fetch"), _("Fetch"), NULL, _("Fetch"));
+ add_subaction_u(menu, "tvp::grep", Q_("Menu|Grep"), _("Grep"), NULL, _("Grep"));
+ add_subaction_u(menu, "tvp::init", Q_("Menu|Init"), _("Init"), NULL, _("Init"));
+ add_subaction (item, menu, "tvp::git::log", Q_("Menu|Log"), _("Log"), "gtk-index", "--log");
+ add_subaction_u(menu, "tvp::merge", Q_("Menu|Merge"), _("Merge"), NULL, _("Merge"));
+ if (!tvp_action->property.is_parent)
+ add_subaction (item, menu, "tvp::move", Q_("Menu|Move"), _("Move"), "gtk-dnd-multiple", "--move");
+ add_subaction_u(menu, "tvp::pull", Q_("Menu|Pull"), _("Pull"), NULL, _("Pull"));
+ add_subaction_u(menu, "tvp::push", Q_("Menu|Push"), _("Push"), NULL, _("Push"));
+ add_subaction_u(menu, "tvp::rebase", Q_("Menu|Rebase"), _("Rebase"), NULL, _("Rebase"));
+ add_subaction (item, menu, "tvp::reset", Q_("Menu|Reset"), _("Reset"), "edit-undo", "--reset");
+ add_subaction_u(menu, "tvp::remove", Q_("Menu|Remove"), _("Remove"), "edit-delete", _("Remove"));
+ add_subaction_u(menu, "tvp::show", Q_("Menu|Show"), _("Show"), NULL, _("Show"));
+ if (tvp_action->property.is_parent)
+ add_subaction (item, menu, "tvp::stash", Q_("Menu|Stash"), _("Stash"), "document-save", "--stash");
+ if (tvp_action->property.is_parent)
+ add_subaction (item, menu, "tvp::git::status", Q_("Menu|Status"), _("Status"), "dialog-information", "--status");
+ add_subaction_u(menu, "tvp::tag", Q_("Menu|Tag"), _("Tag"), NULL, _("Tag"));
return item;
}
-static void tvp_action_unimplemented (GtkAction *item, const gchar *tvp_action)
+static void tvp_action_unimplemented (ThunarxMenuItem *item, const gchar *action)
{
- GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Action %s is unimplemented"), tvp_action);
+ GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Action %s is unimplemented"), action);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy(dialog);
}
+static void
+tvp_setup_display_cb (gpointer data)
+{
+ g_setenv ("DISPLAY", (char *) data, TRUE);
+}
+
-static void tvp_action_exec (GtkAction *item, TvpGitAction *tvp_action)
+static void tvp_action_exec (ThunarxMenuItem *item, TvpGitAction *tvp_action)
{
guint size, i;
gchar **argv;
@@ -316,6 +301,7 @@ static void tvp_action_exec (GtkAction *item, TvpGitAction *tvp_action)
gchar *watch_path = NULL;
gint pid;
GError *error = NULL;
+ char *display = NULL;
GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (tvp_action->window));
iter = tvp_action->files;
@@ -381,8 +367,12 @@ static void tvp_action_exec (GtkAction *item, TvpGitAction *tvp_action)
iter = g_list_next (iter);
}
+
pid = 0;
- if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &error))
+ if (screen != NULL)
+ display = gdk_screen_make_display_name (screen);
+
+ if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, tvp_setup_display_cb, display, &pid, &error))
{
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (tvp_action->window), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Could not spawn \'" TVP_GIT_HELPER "\'");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s.", error->message);
@@ -394,6 +384,8 @@ static void tvp_action_exec (GtkAction *item, TvpGitAction *tvp_action)
{
g_signal_emit(tvp_action, action_signal[SIGNAL_NEW_PROCESS], 0, &pid, watch_path);
}
+
+ g_free (display);
g_free (watch_path);
g_strfreev (argv);
}
diff --git a/thunar-vcs-plugin/tvp-git-action.h b/thunar-vcs-plugin/tvp-git-action.h
index b95c618..025fc7e 100644
--- a/thunar-vcs-plugin/tvp-git-action.h
+++ b/thunar-vcs-plugin/tvp-git-action.h
@@ -37,7 +37,7 @@ typedef struct _TvpGitAction TvpGitAction;
GType tvp_git_action_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
void tvp_git_action_register_type (ThunarxProviderPlugin *) G_GNUC_INTERNAL;
-GtkAction *tvp_git_action_new (const gchar*,
+ThunarxMenuItem *tvp_git_action_new (const gchar*,
const gchar*,
GList *,
GtkWidget *,
diff --git a/thunar-vcs-plugin/tvp-provider.c b/thunar-vcs-plugin/tvp-provider.c
index f53e7cd..edd2f77 100644
--- a/thunar-vcs-plugin/tvp-provider.c
+++ b/thunar-vcs-plugin/tvp-provider.c
@@ -55,21 +55,21 @@
-static void tvp_provider_menu_provider_init (ThunarxMenuProviderIface *iface);
+static void tvp_provider_menu_provider_init (ThunarxMenuProviderIface *iface);
static void tvp_provider_property_page_provider_init (ThunarxPropertyPageProviderIface *iface);
-static void tvp_provider_finalize (GObject *object);
-static GList *tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- GList *files);
-static GList *tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- ThunarxFileInfo *folder);
-static GList *tvp_provider_get_pages (ThunarxPropertyPageProvider *menu_provider,
- GList *files);
-static void tvp_new_process (GtkAction *action,
- const GPid *pid,
- const gchar *path,
- TvpProvider *tvp_provider);
+static void tvp_provider_finalize (GObject *object);
+static GList *tvp_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files);
+static GList *tvp_provider_get_folder_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder);
+static GList *tvp_provider_get_pages (ThunarxPropertyPageProvider *menu_provider,
+ GList *files);
+static void tvp_new_process (ThunarxMenuItem *item,
+ const GPid *pid,
+ const gchar *path,
+ TvpProvider *tvp_provider);
@@ -118,8 +118,8 @@ tvp_provider_class_init (TvpProviderClass *klass)
static void
tvp_provider_menu_provider_init (ThunarxMenuProviderIface *iface)
{
- iface->get_file_actions = tvp_provider_get_file_actions;
- iface->get_folder_actions = tvp_provider_get_folder_actions;
+ iface->get_file_menu_items = tvp_provider_get_file_menu_items;
+ iface->get_folder_menu_items = tvp_provider_get_folder_menu_items;
}
@@ -340,12 +340,12 @@ tvp_compare_path (TvpSvnFileStatus *file_status, ThunarxFileInfo *file_info)
static GList*
-tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- GList *files)
+tvp_provider_get_file_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ GList *files)
{
- GList *actions = NULL;
- GtkAction *action;
+ GList *items = NULL;
+ ThunarxMenuItem *item;
GList *lp;
gint n_files = 0;
gchar *scheme;
@@ -417,10 +417,10 @@ tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
}
- /* append the svn submenu action */
- action = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, FALSE, parent_wc, directory_is_wc, directory_is_not_wc, file_is_vc, file_is_not_vc);
- g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
- actions = g_list_append (actions, action);
+ /* append the svn submenu item */
+ item = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, FALSE, parent_wc, directory_is_wc, directory_is_not_wc, file_is_vc, file_is_not_vc);
+ g_signal_connect(item, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ items = g_list_append (items, item);
#endif
#ifdef HAVE_GIT
@@ -448,24 +448,24 @@ tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
}
}
- /* append the git submenu action */
- action = tvp_git_action_new ("Tvp::git", _("GIT"), files, window, FALSE, directory, file);
- g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
- actions = g_list_append (actions, action);
+ /* append the git submenu item */
+ item = tvp_git_action_new ("Tvp::git", _("GIT"), files, window, FALSE, directory, file);
+ g_signal_connect(item, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ items = g_list_append (items, item);
#endif
- return actions;
+ return items;
}
static GList*
-tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
- GtkWidget *window,
- ThunarxFileInfo *folder)
+tvp_provider_get_folder_menu_items (ThunarxMenuProvider *menu_provider,
+ GtkWidget *window,
+ ThunarxFileInfo *folder)
{
- GtkAction *action;
- GList *actions = NULL;
+ ThunarxMenuItem *item;
+ GList *items = NULL;
gchar *scheme;
GList *files;
@@ -484,22 +484,22 @@ tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider,
#ifdef HAVE_SUBVERSION
/* Lets see if we are dealing with a working copy */
- action = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, TRUE, tvp_is_working_copy (folder), FALSE, FALSE, FALSE, FALSE);
- g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
- /* append the svn submenu action */
- actions = g_list_append (actions, action);
+ item = tvp_svn_action_new ("Tvp::svn", _("SVN"), files, window, TRUE, tvp_is_working_copy (folder), FALSE, FALSE, FALSE, FALSE);
+ g_signal_connect(item, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ /* append the svn submenu item */
+ items = g_list_append (items, item);
#endif
#ifdef HAVE_GIT
- action = tvp_git_action_new ("Tvp::git", _("GIT"), files, window, TRUE, TRUE, FALSE);
- g_signal_connect(action, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
- /* append the git submenu action */
- actions = g_list_append (actions, action);
+ item = tvp_git_action_new ("Tvp::git-folder", _("GIT"), files, window, TRUE, TRUE, FALSE);
+ g_signal_connect(item, "new-process", G_CALLBACK(tvp_new_process), menu_provider);
+ /* append the git submenu item */
+ items = g_list_append (items, item);
#endif
g_list_free (files);
- return actions;
+ return items;
}
@@ -583,7 +583,7 @@ tvp_child_watch_free (TvpChildWatch *watch)
static void
-tvp_new_process (GtkAction *action, const GPid *pid, const gchar *path, TvpProvider *tvp_provider)
+tvp_new_process (ThunarxMenuItem *item, const GPid *pid, const gchar *path, TvpProvider *tvp_provider)
{
TvpChildWatch *watch;
if (tvp_provider->child_watch)
diff --git a/thunar-vcs-plugin/tvp-svn-action.c b/thunar-vcs-plugin/tvp-svn-action.c
index e87fbaa..ba62698 100644
--- a/thunar-vcs-plugin/tvp-svn-action.c
+++ b/thunar-vcs-plugin/tvp-svn-action.c
@@ -43,14 +43,14 @@ static void tsh_cclosure_marshal_VOID__POINTER_STRING (GClosure *closure,
struct _TvpSvnActionClass
{
- GtkActionClass __parent__;
+ ThunarxMenuItemClass __parent__;
};
struct _TvpSvnAction
{
- GtkAction __parent__;
+ ThunarxMenuItem __parent__;
struct {
unsigned is_parent : 1;
@@ -89,7 +89,7 @@ static guint action_signal[SIGNAL_COUNT];
-static GtkWidget *tvp_svn_action_create_menu_item (GtkAction *action);
+static GtkWidget *tvp_svn_action_create_menu_item (ThunarxMenuItem *action);
@@ -101,13 +101,13 @@ static void tvp_svn_action_set_property (GObject*, guint, const GValue*, GParamS
static GQuark tvp_action_arg_quark = 0;
-static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action);
+static void tvp_action_exec (ThunarxMenuItem *item, TvpSvnAction *tvp_action);
-static void tvp_action_unimplemented (GtkAction *, const gchar *);
+static void tvp_action_unimplemented (ThunarxMenuItem *, const gchar *);
-THUNARX_DEFINE_TYPE (TvpSvnAction, tvp_svn_action, GTK_TYPE_ACTION)
+THUNARX_DEFINE_TYPE (TvpSvnAction, tvp_svn_action, THUNARX_TYPE_MENU_ITEM)
@@ -115,13 +115,10 @@ static void
tvp_svn_action_class_init (TvpSvnActionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkActionClass *gtkaction_class = GTK_ACTION_CLASS (klass);
gobject_class->finalize = tvp_svn_action_finalize;
gobject_class->set_property = tvp_svn_action_set_property;
- gtkaction_class->create_menu_item = tvp_svn_action_create_menu_item;
-
g_object_class_install_property (gobject_class, PROPERTY_IS_PARENT,
g_param_spec_boolean ("is-parent", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
@@ -163,7 +160,7 @@ tvp_svn_action_init (TvpSvnAction *self)
-GtkAction *
+ThunarxMenuItem *
tvp_svn_action_new (const gchar *name,
const gchar *label,
GList *files,
@@ -175,13 +172,12 @@ tvp_svn_action_new (const gchar *name,
gboolean file_version_control,
gboolean file_no_version_control)
{
- GtkAction *action;
+ ThunarxMenuItem *item;
g_return_val_if_fail(name, NULL);
g_return_val_if_fail(label, NULL);
- action = g_object_new (TVP_TYPE_SVN_ACTION,
- "hide-if-empty", FALSE,
+ item = g_object_new (TVP_TYPE_SVN_ACTION,
"name", name,
"label", label,
"is-parent", is_parent,
@@ -190,16 +186,14 @@ tvp_svn_action_new (const gchar *name,
"directory-no-version-control", directory_no_version_control,
"file-version-control", file_version_control,
"file-no-version-control", file_no_version_control,
-#if !GTK_CHECK_VERSION(2,9,0)
- "stock-id", "subversion",
-#else
- "icon-name", "subversion",
-#endif
+ "icon", "subversion",
NULL);
- TVP_SVN_ACTION (action)->files = thunarx_file_info_list_copy (files);
-// TVP_SVN_ACTION (action)->window = gtk_widget_ref (window);
- TVP_SVN_ACTION (action)->window = window;
- return action;
+ TVP_SVN_ACTION (item)->files = thunarx_file_info_list_copy (files);
+ TVP_SVN_ACTION (item)->window = window;
+
+ tvp_svn_action_create_menu_item (item);
+
+ return item;
}
@@ -209,7 +203,6 @@ tvp_svn_action_finalize (GObject *object)
{
thunarx_file_info_list_free (TVP_SVN_ACTION (object)->files);
TVP_SVN_ACTION (object)->files = NULL;
-// gtk_widget_unref (TVP_SVN_ACTION (object)->window);
TVP_SVN_ACTION (object)->window = NULL;
G_OBJECT_CLASS (tvp_svn_action_parent_class)->finalize (object);
@@ -248,148 +241,135 @@ tvp_svn_action_set_property (GObject *object, guint property_id, const GValue *v
static void
-add_subaction (GtkAction *action, GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+add_subaction(ThunarxMenuItem *item, ThunarxMenu *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *icon, gchar *arg)
{
- GtkAction *subaction;
- GtkWidget *subitem;
-
- subaction = gtk_action_new (name, text, tooltip, stock);
- g_object_set_qdata (G_OBJECT (subaction), tvp_action_arg_quark, arg);
- g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_exec), action);
-
- subitem = gtk_action_create_menu_item (subaction);
- g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
- gtk_widget_set_tooltip_text(subitem, tooltip);
- gtk_menu_shell_append (menu, subitem);
- gtk_widget_show(subitem);
+ ThunarxMenuItem *subitem;
+ subitem = thunarx_menu_item_new (name, text, tooltip, icon);
+ thunarx_menu_append_item (menu, subitem);
+ g_object_set_qdata (G_OBJECT (subitem), tvp_action_arg_quark, arg);
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_exec), item);
+ g_object_unref (subitem);
}
static void
-add_subaction_u (GtkMenuShell *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *stock, gchar *arg)
+add_subaction_u (ThunarxMenu *menu, const gchar *name, const gchar *text, const gchar *tooltip, const gchar *icon, gchar *arg)
{
- GtkAction *subaction;
- GtkWidget *subitem;
-
- subaction = gtk_action_new (name, text, tooltip, stock);
- g_signal_connect_after (subaction, "activate", G_CALLBACK (tvp_action_unimplemented), arg);
-
- subitem = gtk_action_create_menu_item (subaction);
- g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
- gtk_widget_set_tooltip_text(subitem, tooltip);
- //gtk_menu_shell_append (menu, subitem);
- //gtk_widget_show(subitem);
- gtk_widget_unref (subitem);
+ /* keep the current behavior, only show menu items if they are implemented */
+ /*ThunarxMenuItem *subitem;
+ subitem = thunarx_menu_item_new (name, text, tooltip, icon);
+ thunarx_menu_append_item (menu, subitem);
+ g_object_set_qdata (G_OBJECT (subitem), tvp_action_arg_quark, arg);
+ g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), arg);
+ g_object_unref (subitem);*/
}
static GtkWidget *
-tvp_svn_action_create_menu_item (GtkAction *action)
+tvp_svn_action_create_menu_item (ThunarxMenuItem *item)
{
- GtkWidget *item;
- GtkWidget *menu;
- TvpSvnAction *tvp_action = TVP_SVN_ACTION (action);
+ ThunarxMenu *menu;
+ TvpSvnAction *tvp_action = TVP_SVN_ACTION (item);
- item = GTK_ACTION_CLASS(tvp_svn_action_parent_class)->create_menu_item (action);
+ menu = thunarx_menu_new ();
+ thunarx_menu_item_set_menu (item, menu);
- menu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
/* No version control or version control (parent) */
if (tvp_action->property.parent_version_control && (tvp_action->property.is_parent || tvp_action->property.directory_no_version_control || tvp_action->property.file_no_version_control))
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::add", Q_("Menu|Add"), _("Add"), GTK_STOCK_ADD, "--add");
+ add_subaction (item, menu, "tvp::add", Q_("Menu|Add"), _("Add"), "list-add", "--add");
}
/* Version control (file) */
if (tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::blame", Q_("Menu|Blame"), _("Blame"), GTK_STOCK_INDEX, "--blame");
+ add_subaction (item, menu, "tvp::blame", Q_("Menu|Blame"), _("Blame"), "gtk-index", "--blame");
}
/* No need
subitem = gtk_menu_item_new_with_label (_("Cat"));
g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Cat");
g_object_get (G_OBJECT (subaction), "tooltip", &tooltip, NULL);
gtk_widget_set_tooltip_text(subitem, tooltip);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_menu_shell_append (menu, subitem);
gtk_widget_show(subitem);
*//* Version control (file) */
if (tvp_action->property.file_version_control)
{
- add_subaction_u (GTK_MENU_SHELL (menu), "tvp::changelist", Q_("Menu|Changelist"), _("Changelist"), GTK_STOCK_INDEX, _("Changelist"));
+ add_subaction_u (menu, "tvp::changelist", Q_("Menu|Changelist"), _("Changelist"), "gtk-index", _("Changelist"));
}
/* No version control (parent) */
if (tvp_action->property.is_parent && !tvp_action->property.parent_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::checkout", Q_("Menu|Checkout"), _("Checkout"), GTK_STOCK_CONNECT, "--checkout");
+ add_subaction (item, menu, "tvp::checkout", Q_("Menu|Checkout"), _("Checkout"), "gtk-connect", "--checkout");
}
/* Version control (parent) */
if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::cleanup", Q_("Menu|Cleanup"), _("Cleanup"), GTK_STOCK_CLEAR, "--cleanup");
+ add_subaction (item, menu, "tvp::cleanup", Q_("Menu|Cleanup"), _("Cleanup"), "edit-clear", "--cleanup");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::commit", Q_("Menu|Commit"), _("Commit"), GTK_STOCK_APPLY, "--commit");
+ add_subaction (item, menu, "tvp::commit", Q_("Menu|Commit"), _("Commit"), "gtk-apply", "--commit");
}
/* Version control (no parent) */
if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::copy", Q_("Menu|Copy"), _("Copy"), GTK_STOCK_COPY, "--copy");
+ add_subaction (item, menu, "tvp::copy", Q_("Menu|Copy"), _("Copy"), "edit-copy", "--copy");
}
/* Version control (no parent) */
if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::delete", Q_("Menu|Delete"), _("Delete"), GTK_STOCK_DELETE, "--delete");
+ add_subaction (item, menu, "tvp::delete", Q_("Menu|Delete"), _("Delete"), "edit-delete", "--delete");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::diff", Q_("Menu|Diff"), _("Diff"), GTK_STOCK_CONVERT, "--diff");
+ add_subaction (item, menu, "tvp::diff", Q_("Menu|Diff"), _("Diff"), "gtk-convert", "--diff");
}
/* Version control and No version control (parent) */
if (tvp_action->property.is_parent || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::export", Q_("Menu|Export"), _("Export"), GTK_STOCK_SAVE, "--export");
+ add_subaction (item, menu, "tvp::export", Q_("Menu|Export"), _("Export"), "document-save", "--export");
}
/* No version control (all) */
if (!tvp_action->property.parent_version_control && (tvp_action->property.is_parent || tvp_action->property.directory_no_version_control || tvp_action->property.file_no_version_control))
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::import", Q_("Menu|Import"), _("Import"), GTK_STOCK_NETWORK, "--import");
+ add_subaction (item, menu, "tvp::import", Q_("Menu|Import"), _("Import"), "network-workgroup", "--import");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction_u (GTK_MENU_SHELL (menu), "tvp::info", Q_("Menu|Info"), _("Info"), GTK_STOCK_INFO, _("Info"));
+ add_subaction_u (menu, "tvp::info", Q_("Menu|Info"), _("Info"), "dialog-information", _("Info"));
}
/* Ehmm...
subitem = gtk_menu_item_new_with_label (_("List"));
g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "List");
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_menu_shell_append (menu, subitem);
gtk_widget_show(subitem);
*//* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::lock", Q_("Menu|Lock"), _("Lock"), GTK_STOCK_DIALOG_AUTHENTICATION, "--lock");
+ add_subaction (item, menu, "tvp::lock", Q_("Menu|Lock"), _("Lock"), "dialog-password", "--lock");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::log", Q_("Menu|Log"), _("Log"), GTK_STOCK_INDEX, "--log");
+ add_subaction (item, menu, "tvp::log", Q_("Menu|Log"), _("Log"), "gtk-index", "--log");
}
/* Ehmm ...
subitem = gtk_menu_item_new_with_label (_("Merge"));
g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Merge");
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_menu_shell_append (menu, subitem);
gtk_widget_show(subitem);
*//* No need
subitem = gtk_menu_item_new_with_label (_("Make Dir"));
g_signal_connect_after (subitem, "activate", G_CALLBACK (tvp_action_unimplemented), "Make Dir");
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), subitem);
+ gtk_menu_shell_append (menu, subitem);
gtk_widget_show(subitem);
*//* Version control (no parent) */
if (!tvp_action->property.is_parent && tvp_action->property.parent_version_control && (tvp_action->property.directory_version_control || tvp_action->property.file_version_control))
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::move", Q_("Menu|Move"), _("Move"), GTK_STOCK_DND_MULTIPLE, "--move");
+ add_subaction (item, menu, "tvp::move", Q_("Menu|Move"), _("Move"), "gtk-dnd-multiple", "--move");
}
/* Merged
subitem = gtk_menu_item_new_with_label (_("Delete Properties"));
@@ -400,48 +380,48 @@ tvp_svn_action_create_menu_item (GtkAction *action)
*//* Version control */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::properties", Q_("Menu|Edit Properties"), _("Edit Properties"), GTK_STOCK_EDIT, "--properties");
+ add_subaction (item, menu, "tvp::properties", Q_("Menu|Edit Properties"), _("Edit Properties"), "gtk-edit", "--properties");
}
/* Version control (parent) */
if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::relocate", Q_("Menu|Relocate"), _("Relocate"), GTK_STOCK_FIND_AND_REPLACE, "--relocate");
+ add_subaction (item, menu, "tvp::relocate", Q_("Menu|Relocate"), _("Relocate"), "edit-find-replace", "--relocate");
}
/* Changed
subitem = gtk_menu_item_new_with_label (_("Mark Resolved"));
*/if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::resolved", Q_("Menu|Resolved"), _("Resolved"), GTK_STOCK_YES, "--resolved");
+ add_subaction (item, menu, "tvp::resolved", Q_("Menu|Resolved"), _("Resolved"), "gtk-yes", "--resolved");
}/*
*//* Version control (file) */
if (tvp_action->property.file_version_control)
{
- add_subaction_u (GTK_MENU_SHELL (menu), "tvp::resolve", Q_("Menu|Resolve"), _("Resolve"), GTK_STOCK_YES, _("Resolve"));
+ add_subaction_u (menu, "tvp::resolve", Q_("Menu|Resolve"), _("Resolve"), "gtk-yes", _("Resolve"));
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::revert", Q_("Menu|Revert"), _("Revert"), GTK_STOCK_UNDO, "--revert");
+ add_subaction (item, menu, "tvp::revert", Q_("Menu|Revert"), _("Revert"), "edit-undo", "--revert");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::status", Q_("Menu|Status"), _("Status"), GTK_STOCK_DIALOG_INFO, "--status");
+ add_subaction (item, menu, "tvp::status", Q_("Menu|Status"), _("Status"), "dialog-information", "--status");
}
/* Version control (parent) */
if (tvp_action->property.is_parent && tvp_action->property.parent_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::switch", Q_("Menu|Switch"), _("Switch"), GTK_STOCK_JUMP_TO, "--switch");
+ add_subaction (item, menu, "tvp::switch", Q_("Menu|Switch"), _("Switch"), "go-jump", "--switch");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::unlock", Q_("Menu|Unlock"), _("Unlock"), NULL, "--unlock");
+ add_subaction (item, menu, "tvp::unlock", Q_("Menu|Unlock"), _("Unlock"), NULL, "--unlock");
}
/* Version control (all) */
if ((tvp_action->property.is_parent && tvp_action->property.parent_version_control) || tvp_action->property.directory_version_control || tvp_action->property.file_version_control)
{
- add_subaction (action, GTK_MENU_SHELL (menu), "tvp::update", Q_("Menu|Update"), _("Update"), GTK_STOCK_REFRESH, "--update");
+ add_subaction (item, menu, "tvp::update", Q_("Menu|Update"), _("Update"), "view-refresh", "--update");
}
return item;
@@ -449,7 +429,7 @@ tvp_svn_action_create_menu_item (GtkAction *action)
-static void tvp_action_unimplemented (GtkAction *item, const gchar *tvp_action)
+static void tvp_action_unimplemented (ThunarxMenuItem *item, const gchar *tvp_action)
{
GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Action %s is unimplemented"), tvp_action);
gtk_dialog_run (GTK_DIALOG (dialog));
@@ -457,8 +437,15 @@ static void tvp_action_unimplemented (GtkAction *item, const gchar *tvp_action)
}
+static void
+tvp_setup_display_cb (gpointer data)
+{
+ g_setenv ("DISPLAY", (char *) data, TRUE);
+}
+
+
-static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action)
+static void tvp_action_exec (ThunarxMenuItem *item, TvpSvnAction *tvp_action)
{
guint size, i;
gchar **argv;
@@ -469,6 +456,7 @@ static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action)
gchar *watch_path = NULL;
gint pid;
GError *error = NULL;
+ char *display = NULL;
GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (tvp_action->window));
iter = tvp_action->files;
@@ -534,8 +522,12 @@ static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action)
iter = g_list_next (iter);
}
+
pid = 0;
- if (!gdk_spawn_on_screen (screen, NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, &error))
+ if (screen != NULL)
+ display = gdk_screen_make_display_name (screen);
+
+ if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, tvp_setup_display_cb, display, &pid, &error))
{
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (tvp_action->window), GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Could not spawn \'" TVP_SVN_HELPER "\'");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s.", error->message);
@@ -547,6 +539,8 @@ static void tvp_action_exec (GtkAction *item, TvpSvnAction *tvp_action)
{
g_signal_emit(tvp_action, action_signal[SIGNAL_NEW_PROCESS], 0, &pid, watch_path);
}
+
+ g_free (display);
g_free (watch_path);
g_strfreev (argv);
}
diff --git a/thunar-vcs-plugin/tvp-svn-action.h b/thunar-vcs-plugin/tvp-svn-action.h
index d95eefb..16b1a5b 100644
--- a/thunar-vcs-plugin/tvp-svn-action.h
+++ b/thunar-vcs-plugin/tvp-svn-action.h
@@ -37,7 +37,7 @@ typedef struct _TvpSvnAction TvpSvnAction;
GType tvp_svn_action_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
void tvp_svn_action_register_type (ThunarxProviderPlugin *) G_GNUC_INTERNAL;
-GtkAction *tvp_svn_action_new (const gchar*,
+ThunarxMenuItem *tvp_svn_action_new (const gchar*,
const gchar*,
GList *,
GtkWidget *,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list