From 2a8ae11ba5282976b06f0ef35bc2a90111b49791 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 4 Oct 2015 01:41:04 +0200 Subject: [PATCH] List a few actions for files as well This does not detect if a given file is actually managed by Git or not. --- src/plugins/git.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/plugins/git.c b/src/plugins/git.c index a246957..55dffaa 100644 --- a/src/plugins/git.c +++ b/src/plugins/git.c @@ -189,7 +189,7 @@ static Git * _git_init(BrowserPluginHelper * helper) git->file = gtk_vbox_new(FALSE, 4); #endif widget = _init_button(group, GTK_STOCK_FIND_AND_REPLACE, - _("Request diff"), G_CALLBACK(_git_on_diff), git); + _("Diff"), G_CALLBACK(_git_on_diff), git); gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); widget = _init_button(group, GTK_STOCK_INDEX, _("Annotate"), G_CALLBACK(_git_on_blame), git); @@ -197,15 +197,6 @@ static Git * _git_init(BrowserPluginHelper * helper) widget = _init_button(group, GTK_STOCK_FIND, _("View log"), G_CALLBACK(_git_on_log), git); gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); - widget = _init_button(group, GTK_STOCK_PROPERTIES, _("Status"), - G_CALLBACK(_git_on_status), git); - gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); - widget = _init_button(group, GTK_STOCK_REFRESH, _("Pull"), - G_CALLBACK(_git_on_pull), git); - gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); - widget = _init_button(group, GTK_STOCK_CONNECT, _("Push"), - G_CALLBACK(_git_on_push), git); - gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); widget = _init_button(group, GTK_STOCK_JUMP_TO, _("Commit"), G_CALLBACK(_git_on_commit), git); gtk_box_pack_start(GTK_BOX(git->file), widget, FALSE, TRUE, 0); @@ -279,6 +270,7 @@ static GtkWidget * _git_get_widget(Git * git) /* git_refresh */ static void _refresh_dir(Git * git); static void _refresh_error(Git * git, char const * message); +static void _refresh_file(Git * git); static void _refresh_hide(Git * git, gboolean name); static void _refresh_status(Git * git, char const * status); @@ -309,7 +301,7 @@ static void _git_refresh(Git * git, GList * selection) if(S_ISDIR(st.st_mode)) _refresh_dir(git); else - _refresh_hide(git, FALSE); + _refresh_file(git); } static void _refresh_dir(Git * git) @@ -339,6 +331,13 @@ static void _refresh_error(Git * git, char const * message) helper->error(helper->browser, error_get(), 1); } +static void _refresh_file(Git * git) +{ + _refresh_hide(git, FALSE); + /* FIXME detect if the file is actually managed */ + gtk_widget_show(git->file); +} + static void _refresh_hide(Git * git, gboolean name) { name ? gtk_widget_hide(git->name) : gtk_widget_show(git->name);