[anjuta] git: Add a popup menu to the Remotes pane
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: Add a popup menu to the Remotes pane
- Date: Mon, 10 Jun 2013 05:03:44 +0000 (UTC)
commit 59e7d9c843b3d9731684f7549de2511a85832b27
Author: James Liggett <jrliggett cox net>
Date: Sun Jun 9 20:52:04 2013 -0700
git: Add a popup menu to the Remotes pane
plugins/git/anjuta-git.xml | 6 ++++++
plugins/git/git-remotes-pane.c | 34 ++++++++++++++++++++++++++++++++++
plugins/git/plugin.c | 34 ++++++++++++++++++++++++++++++++++
plugins/git/plugin.h | 1 +
4 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/plugins/git/anjuta-git.xml b/plugins/git/anjuta-git.xml
index 1b20467..f91a89c 100644
--- a/plugins/git/anjuta-git.xml
+++ b/plugins/git/anjuta-git.xml
@@ -21,4 +21,10 @@
<menuitem name="Delete..." action="GitBranchDelete" />
<menuitem name="Merge..." action="GitBranchMerge" />
</popup>
+
+ <popup name="GitRemotePopup">
+ <menuitem name="Push..." action="GitRemotePush" />
+ <menuitem name="Pull..." action="GitRemotePull" />
+ <menuitem name="Fetch" action="GitRemoteFetch" />
+ </popup>
</ui>
\ No newline at end of file
diff --git a/plugins/git/git-remotes-pane.c b/plugins/git/git-remotes-pane.c
index 7cfae46..b73d4cf 100644
--- a/plugins/git/git-remotes-pane.c
+++ b/plugins/git/git-remotes-pane.c
@@ -47,6 +47,35 @@ on_remote_selected (GtkTreeSelection *selection, GtkTreeModel *model,
return TRUE;
}
+static gboolean
+on_remotes_view_button_press_event (GtkWidget *remotes_view,
+ GdkEventButton *event,
+ GitRemotesPane *self)
+{
+ GtkTreeSelection *selection;
+ AnjutaPlugin *plugin;
+ AnjutaUI *ui;
+ GtkMenu *menu;
+
+ if (event->type == GDK_BUTTON_PRESS && event->button == 3)
+ {
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (remotes_view));
+
+ if (gtk_tree_selection_count_selected_rows (selection) > 0)
+ {
+ plugin = anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self));
+ ui = anjuta_shell_get_ui (plugin->shell, NULL);
+ menu = GTK_MENU (gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
+ "/GitRemotePopup"));
+
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button,
+ event->time);
+ }
+ }
+
+ return FALSE;
+}
+
static void
git_remotes_pane_init (GitRemotesPane *self)
{
@@ -76,6 +105,11 @@ git_remotes_pane_init (GitRemotesPane *self)
gtk_tree_selection_set_select_function (selection,
(GtkTreeSelectionFunc) on_remote_selected,
self, NULL);
+
+ /* Pop-up menu */
+ g_signal_connect (G_OBJECT (remotes_view), "button-press-event",
+ G_CALLBACK (on_remotes_view_button_press_event),
+ self);
}
static void
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index 1bf4bf7..07f32ca 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -569,6 +569,34 @@ static GtkActionEntry branch_menu_entries[] =
}
};
+static GtkActionEntry remote_menu_entries[] =
+{
+ {
+ "GitRemotePush",
+ NULL,
+ N_("Push..."),
+ NULL,
+ NULL,
+ G_CALLBACK (on_push_button_clicked)
+ },
+ {
+ "GitRemotePull",
+ NULL,
+ N_("Pull..."),
+ NULL,
+ NULL,
+ G_CALLBACK (on_pull_button_clicked)
+ },
+ {
+ "GitRemoteFetch",
+ NULL,
+ N_("Fetch"),
+ NULL,
+ NULL,
+ G_CALLBACK (on_fetch_button_clicked)
+ }
+};
+
static gpointer parent_class;
static void
@@ -826,6 +854,11 @@ git_activate_plugin (AnjutaPlugin *plugin)
G_N_ELEMENTS
(branch_menu_entries),
GETTEXT_PACKAGE,
FALSE, plugin);
+ git_plugin->remote_menu_group = anjuta_ui_add_action_group_entries (ui, "GitRemotePopup",
+ _("Remote popup menu"),
+ remote_menu_entries,
+ G_N_ELEMENTS
(remote_menu_entries),
+ GETTEXT_PACKAGE, FALSE, plugin);
/* Create the branch list commands. There are two commands because some
@@ -967,6 +1000,7 @@ git_deactivate_plugin (AnjutaPlugin *plugin)
anjuta_ui_remove_action_group (ui, git_plugin->status_menu_group);
anjuta_ui_remove_action_group (ui, git_plugin->log_menu_group);
anjuta_ui_remove_action_group (ui, git_plugin->branch_menu_group);
+ anjuta_ui_remove_action_group (ui, git_plugin->remote_menu_group);
anjuta_ui_unmerge (ui, git_plugin->uiid);
g_object_unref (git_plugin->local_branch_list_command);
diff --git a/plugins/git/plugin.h b/plugins/git/plugin.h
index 37bf3c9..f9bc5db 100644
--- a/plugins/git/plugin.h
+++ b/plugins/git/plugin.h
@@ -82,6 +82,7 @@ struct _Git
GtkActionGroup *status_menu_group;
GtkActionGroup *log_menu_group;
GtkActionGroup *branch_menu_group;
+ GtkActionGroup *remote_menu_group;
/* List commands for various panes.
* Keep them in the plugin so that the commands have the most direct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]