[anjuta] git: Only show the Git Tasks menu when the Git window is active
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: Only show the Git Tasks menu when the Git window is active
- Date: Wed, 1 Aug 2012 06:27:58 +0000 (UTC)
commit 664209e1c379d8b3dbccadb70d0b88d637fa0aea
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Wed Aug 1 08:18:01 2012 +0200
git: Only show the Git Tasks menu when the Git window is active
Restore this patch as now GDL remember the position of hidden widgets
plugins/git/plugin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/plugins/git/plugin.c b/plugins/git/plugin.c
index f9d67a3..09207f4 100644
--- a/plugins/git/plugin.c
+++ b/plugins/git/plugin.c
@@ -648,6 +648,33 @@ git_register_stock_icons (AnjutaPlugin *plugin)
END_REGISTER_ICON
}
+static void
+on_dock_window_mapped (GtkWidget *dock_window, Git *plugin)
+{
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->command_bar_window, NULL);
+}
+
+static void
+on_dock_window_unmapped (GtkWidget *dock_window, Git *plugin)
+{
+ anjuta_shell_hide_dockable_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->command_bar_window, NULL);
+}
+
+static void
+on_shell_exiting (AnjutaShell *shell, Git *plugin)
+{
+ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->dock_window),
+ G_CALLBACK (on_dock_window_mapped),
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->dock_window),
+ G_CALLBACK (on_dock_window_unmapped),
+ plugin);
+}
+
+
static gboolean
git_activate_plugin (AnjutaPlugin *plugin)
{
@@ -700,6 +727,14 @@ git_activate_plugin (AnjutaPlugin *plugin)
_("Git"), "git-plugin", ANJUTA_SHELL_PLACEMENT_CENTER,
NULL);
+ g_signal_connect (G_OBJECT (git_plugin->dock_window), "map",
+ G_CALLBACK (on_dock_window_mapped),
+ git_plugin);
+
+ g_signal_connect (G_OBJECT (git_plugin->dock_window), "unmap",
+ G_CALLBACK (on_dock_window_unmapped),
+ git_plugin);
+
/* Create the branch list commands. There are two commands because some
* views need to be able to tell the difference between local and
* remote branches */
@@ -805,6 +840,10 @@ git_activate_plugin (AnjutaPlugin *plugin)
on_editor_added,
on_editor_removed,
NULL);
+
+ g_signal_connect (G_OBJECT (plugin->shell), "exiting",
+ G_CALLBACK (on_shell_exiting),
+ git_plugin);
/* Git needs a working directory to work with; it can't take full paths,
@@ -837,6 +876,18 @@ git_deactivate_plugin (AnjutaPlugin *plugin)
anjuta_shell_remove_widget (plugin->shell, git_plugin->command_bar_window, NULL);
anjuta_shell_remove_widget (plugin->shell, git_plugin->dock_window, NULL);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (git_plugin->dock_window),
+ G_CALLBACK (on_dock_window_mapped),
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (git_plugin->dock_window),
+ G_CALLBACK (on_dock_window_unmapped),
+ plugin);
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (plugin->shell),
+ G_CALLBACK (on_shell_exiting),
+ git_plugin);
+
g_object_unref (git_plugin->local_branch_list_command);
g_object_unref (git_plugin->remote_branch_list_command);
g_object_unref (git_plugin->commit_status_command);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]