2 * geanyvc.c - Plugin to geany light IDE to work with vc
4 * Copyright 2007 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
5 * Copyright 2007 Enrico Tröger <enrico.troeger@uvena.de>
6 * Copyright 2007 Nick Treleaven <nick.treleaven@btinternet.com>
7 * Copyright 2007 Yura Siamashka <yurand2@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 /* This plugin allow to works with cvs/svn/git inside geany light IDE. */
29 #include "plugindata.h"
31 #include "filetypes.h"
34 #include "pluginmacros.h"
37 PluginFields
*plugin_fields
;
38 GeanyData
*geany_data
;
42 PLUGIN_INFO(_("Project"), _("Alternative project support."), VERSION
,
43 _("Yura Siamashka <yurand2@gmail.com>"));
46 /* Called by Geany to initialize the plugin */
48 init(GeanyData
* data
)
51 GtkWidget *menu_vc = NULL;
52 GtkWidget *menu_vc_menu = NULL;
53 GtkTooltips *tooltips = NULL;
55 config_file = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", G_DIR_SEPARATOR_S,
56 "VC", G_DIR_SEPARATOR_S, "VC.conf", NULL);
61 tooltips = gtk_tooltips_new();
63 menu_vc = gtk_image_menu_item_new_with_mnemonic(_("_VC"));
64 gtk_container_add(GTK_CONTAINER(data->tools_menu), menu_vc);
66 g_signal_connect((gpointer) menu_vc, "activate", G_CALLBACK(update_menu_items), NULL);
68 menu_vc_menu = gtk_menu_new();
69 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_vc), menu_vc_menu);
72 menu_vc_diff_file = gtk_menu_item_new_with_mnemonic(_("Diff From Current File"));
73 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_file);
74 gtk_tooltips_set_tip(tooltips, menu_vc_diff_file,
75 _("Make a diff from the current active file"), NULL);
77 g_signal_connect((gpointer) menu_vc_diff_file, "activate",
78 G_CALLBACK(vcfile_activated), NULL);
81 menu_vc_diff_dir = gtk_menu_item_new_with_mnemonic(_("Diff From Current Directory"));
82 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_dir);
83 gtk_tooltips_set_tip(tooltips, menu_vc_diff_dir,
84 _("Make a diff from the directory of the current active file"), NULL);
86 g_signal_connect((gpointer) menu_vc_diff_dir, "activate",
87 G_CALLBACK(vcdirectory_activated), NULL);
90 menu_vc_diff_project = gtk_menu_item_new_with_mnemonic(_("Diff From Current Project"));
91 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_diff_project);
92 gtk_tooltips_set_tip(tooltips, menu_vc_diff_project,
93 _("Make a diff from the current project's base path"), NULL);
95 g_signal_connect((gpointer) menu_vc_diff_project, "activate",
96 G_CALLBACK(vcproject_activated), NULL);
98 gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
101 menu_vc_log_file = gtk_menu_item_new_with_mnemonic(_("Log Of Current File"));
102 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_file);
103 gtk_tooltips_set_tip(tooltips, menu_vc_log_file,
104 _("Shows the log of the current file"), NULL);
106 g_signal_connect((gpointer) menu_vc_log_file, "activate",
107 G_CALLBACK(vclog_file_activated), NULL);
109 menu_vc_log_dir = gtk_menu_item_new_with_mnemonic(_("Log Of Current Directory"));
110 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_dir);
111 gtk_tooltips_set_tip(tooltips, menu_vc_log_dir,
112 _("Shows the log of the current directory"), NULL);
114 g_signal_connect((gpointer) menu_vc_log_dir, "activate",
115 G_CALLBACK(vclog_dir_activated), NULL);
117 menu_vc_log_project = gtk_menu_item_new_with_mnemonic(_("Log Of Current Project"));
118 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_log_project);
119 gtk_tooltips_set_tip(tooltips, menu_vc_log_project,
120 _("Shows the log of the current project"), NULL);
122 g_signal_connect((gpointer) menu_vc_log_project, "activate",
123 G_CALLBACK(vclog_project_activated), NULL);
125 gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
128 menu_vc_status = gtk_menu_item_new_with_mnemonic(_("_Status"));
129 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_status);
130 gtk_tooltips_set_tip(tooltips, menu_vc_status, _("Show status."), NULL);
132 g_signal_connect((gpointer) menu_vc_status, "activate",
133 G_CALLBACK(vcstatus_activated), NULL);
135 gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
138 menu_vc_revert_file = gtk_menu_item_new_with_mnemonic(_("_Revert File"));
139 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_revert_file);
140 gtk_tooltips_set_tip(tooltips, menu_vc_revert_file,
141 _("Restore pristine working copy file (undo local edits)."), NULL);
143 g_signal_connect((gpointer) menu_vc_revert_file, "activate",
144 G_CALLBACK(vcrevert_activated), NULL);
146 gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
149 menu_vc_add_file = gtk_menu_item_new_with_mnemonic(_("_Add File"));
150 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_add_file);
151 gtk_tooltips_set_tip(tooltips, menu_vc_add_file, _("Add file to repository."), NULL);
153 g_signal_connect((gpointer) menu_vc_add_file, "activate",
154 G_CALLBACK(vcadd_activated), NULL);
157 menu_vc_remove_file = gtk_menu_item_new_with_mnemonic(_("Remove File"));
158 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_remove_file);
159 gtk_tooltips_set_tip(tooltips, menu_vc_remove_file,
160 _("Remove file from repository."), NULL);
162 g_signal_connect((gpointer) menu_vc_remove_file, "activate",
163 G_CALLBACK(vcremove_activated), NULL);
165 gtk_container_add(GTK_CONTAINER(menu_vc_menu), gtk_separator_menu_item_new());
168 menu_vc_commit = gtk_menu_item_new_with_mnemonic(_("_Commit"));
169 gtk_container_add(GTK_CONTAINER(menu_vc_menu), menu_vc_commit);
170 gtk_tooltips_set_tip(tooltips, menu_vc_commit, _("Commit changes."), NULL);
172 g_signal_connect((gpointer) menu_vc_commit, "activate",
173 G_CALLBACK(vccommit_activated), NULL);
175 gtk_widget_show_all(menu_vc);
177 plugin_fields->menu_item = menu_vc;
178 plugin_fields->flags = PLUGIN_IS_DOCUMENT_SENSITIVE;
183 /* Called by Geany before unloading the plugin. */