Updating branch refs/heads/master to 956d4903bccd42425a79ae546d0ae2dabdff1317 (commit) from 134427c074ba04a2e94390e7f6be105921d978d0 (commit)
commit 956d4903bccd42425a79ae546d0ae2dabdff1317 Author: Peter de Ridder <pe...@xfce.org> Date: Sun Oct 11 23:21:15 2009 +0200 * thunar-vcs-plugin/tvp-provider.c thunar-vcs-plugin/tvp-git-action.[ch]: Added extra flags to tvp_git_action_new. * thunar-vcs-plugin/yvp-{svn,git}-action.c: Only show menu items if they are implemented. thunar-vcs-plugin/tvp-git-action.c | 15 +++++++++++---- thunar-vcs-plugin/tvp-git-action.h | 2 ++ thunar-vcs-plugin/tvp-provider.c | 36 ++++++++++++++++++++++++++++++++---- thunar-vcs-plugin/tvp-svn-action.c | 5 +++-- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/thunar-vcs-plugin/tvp-git-action.c b/thunar-vcs-plugin/tvp-git-action.c index 57bfe31..f0b32c5 100644 --- a/thunar-vcs-plugin/tvp-git-action.c +++ b/thunar-vcs-plugin/tvp-git-action.c @@ -139,7 +139,9 @@ tvp_git_action_new (const gchar *name, const gchar *label, GList *files, GtkWidget *window, - gboolean is_parent) + gboolean is_parent, + gboolean is_direcotry, + gboolean is_file) { GtkAction *action; @@ -223,8 +225,9 @@ add_subaction_u (GtkMenuShell *menu, const gchar *name, const gchar *text, const 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_menu_shell_append (menu, subitem); + //gtk_widget_show(subitem); + gtk_widget_unref (subitem); } @@ -233,6 +236,7 @@ tvp_git_action_create_menu_item (GtkAction *action) { GtkWidget *item; GtkWidget *menu; + TvpGitAction *tvp_action = TVP_GIT_ACTION (action); item = GTK_ACTION_CLASS(tvp_git_action_parent_class)->create_menu_item (action); @@ -241,9 +245,11 @@ tvp_git_action_create_menu_item (GtkAction *action) 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_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_u(GTK_MENU_SHELL(menu), "tvp::clone", Q_("Menu|Clone"), _("Clone"), GTK_STOCK_COPY, _("Clone")); + 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")); @@ -258,6 +264,7 @@ tvp_git_action_create_menu_item (GtkAction *action) 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::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")); diff --git a/thunar-vcs-plugin/tvp-git-action.h b/thunar-vcs-plugin/tvp-git-action.h index d6a16ee..a016249 100644 --- a/thunar-vcs-plugin/tvp-git-action.h +++ b/thunar-vcs-plugin/tvp-git-action.h @@ -42,6 +42,8 @@ GtkAction *tvp_git_action_new (const gchar*, const gchar*, GList *, GtkWidget *, + gboolean, + gboolean, gboolean) G_GNUC_MALLOC G_GNUC_INTERNAL; G_END_DECLS; diff --git a/thunar-vcs-plugin/tvp-provider.c b/thunar-vcs-plugin/tvp-provider.c index 13560ac..ac77ffc 100644 --- a/thunar-vcs-plugin/tvp-provider.c +++ b/thunar-vcs-plugin/tvp-provider.c @@ -386,19 +386,25 @@ tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider, { GList *actions = NULL; GtkAction *action; -#ifdef HAVE_SUBVERSION ThunarVfsPathScheme scheme; ThunarVfsInfo *info; + GList *lp; +#ifdef HAVE_SUBVERSION gboolean parent_wc = FALSE; gboolean directory_is_wc = FALSE; gboolean directory_is_not_wc = FALSE; gboolean file_is_vc = FALSE; gboolean file_is_not_vc = FALSE; - GList *lp; gint n_files = 0; GSList *file_status; GSList *iter; +#endif +#ifdef HAVE_GIT + gboolean directory = FALSE; + gboolean file = FALSE; +#endif +#ifdef HAVE_SUBVERSION file_status = tvp_get_parent_status (files->data); /* check all supplied files */ @@ -459,8 +465,30 @@ tvp_provider_get_file_actions (ThunarxMenuProvider *menu_provider, #endif #ifdef HAVE_GIT + /* check all supplied files */ + for (lp = files; lp != NULL; lp = lp->next, ++n_files) + { + /* check if the file is a local file */ + info = thunarx_file_info_get_vfs_info (lp->data); + scheme = thunar_vfs_path_get_scheme (info->path); + thunar_vfs_info_unref (info); + + /* unable to handle non-local files */ + if (G_UNLIKELY (scheme != THUNAR_VFS_PATH_SCHEME_FILE)) + return NULL; + + if (thunarx_file_info_is_directory (lp->data)) + { + directory = TRUE; + } + else + { + file = TRUE; + } + } + /* append the git submenu action */ - action = tvp_git_action_new ("Tvp::git", _("GIT"), files, window, FALSE); + 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); #endif @@ -501,7 +529,7 @@ tvp_provider_get_folder_actions (ThunarxMenuProvider *menu_provider, #endif #ifdef HAVE_GIT - action = tvp_git_action_new ("Tvp::git", _("GIT"), files, window, TRUE); + 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); diff --git a/thunar-vcs-plugin/tvp-svn-action.c b/thunar-vcs-plugin/tvp-svn-action.c index eaf64c2..092fb7d 100644 --- a/thunar-vcs-plugin/tvp-svn-action.c +++ b/thunar-vcs-plugin/tvp-svn-action.c @@ -278,8 +278,9 @@ add_subaction_u (GtkMenuShell *menu, const gchar *name, const gchar *text, const 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_menu_shell_append (menu, subitem); + //gtk_widget_show(subitem); + gtk_widget_unref (subitem); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits