anjuta r4796 - in trunk: . plugins/class-gen
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4796 - in trunk: . plugins/class-gen
- Date: Tue, 24 Feb 2009 23:25:43 +0000 (UTC)
Author: jhs
Date: Tue Feb 24 23:25:43 2009
New Revision: 4796
URL: http://svn.gnome.org/viewvc/anjuta?rev=4796&view=rev
Log:
2009-02-25 Johannes Schmid <jhs gnome org>
* plugins/class-gen/plugin.c (cg_plugin_add_to_project),
(cg_plugin_add_to_repository), (cg_plugin_generator_created_cb):
* plugins/class-gen/window.c (cg_window_add_project_toggled_cb),
(cg_window_cc_name_changed_cb), (cg_window_get_add_to_repository):
Fixed serveral issues in class-gen plugin, including the add to
repository feature.
Modified:
trunk/ChangeLog
trunk/plugins/class-gen/plugin.c
trunk/plugins/class-gen/window.c
Modified: trunk/plugins/class-gen/plugin.c
==============================================================================
--- trunk/plugins/class-gen/plugin.c (original)
+++ trunk/plugins/class-gen/plugin.c Tue Feb 24 23:25:43 2009
@@ -179,33 +179,19 @@
GList *filenames;
GList *added_files;
GList *node;
- gchar *dirname;
- gchar *curdir;
gboolean result;
manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
IAnjutaProjectManager, NULL);
- if (manager == NULL) return FALSE;
-
- curdir = g_get_current_dir ();
+ if (manager == NULL)
+ return FALSE;
filenames = NULL;
filenames = g_list_append (filenames, g_path_get_basename (header_file));
filenames = g_list_append (filenames, g_path_get_basename (source_file));
- dirname = g_path_get_dirname (source_file);
-
- if (dirname != NULL && strcmp (dirname, ".") != 0)
- {
- added_files = ianjuta_project_manager_add_sources (manager, filenames,
- dirname, NULL);
- }
- else
- {
- added_files = ianjuta_project_manager_add_sources (manager, filenames,
- curdir, NULL);
- }
-
+ added_files = ianjuta_project_manager_add_sources (manager, filenames,
+ plugin->top_dir, NULL);
if (g_list_length (added_files) != 2)
{
for (node = added_files; node != NULL; node = g_list_next (node))
@@ -227,8 +213,6 @@
result = TRUE;
}
- g_free (curdir);
- g_free (dirname);
g_list_foreach (added_files, (GFunc)g_free, NULL);
g_list_free (added_files);
g_list_free (filenames);
@@ -238,8 +222,8 @@
static void
cg_plugin_add_to_repository (AnjutaClassGenPlugin *plugin,
- const gchar *header_file,
- const gchar *source_file)
+ GFile *header_file,
+ GFile *source_file)
{
IAnjutaVcs *vcs;
vcs = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
@@ -248,10 +232,10 @@
if(vcs != NULL)
{
GList* files = NULL;
- files = g_list_append (files, g_file_new_for_path (header_file));
- files = g_list_append (files, g_file_new_for_path (source_file));
- ianjuta_vcs_add (vcs, files, NULL, NULL);
- g_list_foreach (files, (GFunc) g_object_unref, NULL);
+ AnjutaAsyncNotify* notify = anjuta_async_notify_new ();
+ files = g_list_append (files, header_file);
+ files = g_list_append (files, source_file);
+ ianjuta_vcs_add (vcs, files, notify, NULL);
g_list_free (files);
}
}
@@ -324,18 +308,19 @@
loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
IAnjutaFileLoader, NULL);
-
- if (cg_window_get_add_to_repository (plugin->window))
- {
- cg_plugin_add_to_repository (plugin, header_file, source_file);
- }
-
+
if (cg_window_get_add_to_project (plugin->window))
{
GFile* header = g_file_new_for_path (header_file);
GFile* source = g_file_new_for_path (source_file);
ianjuta_file_loader_load (loader, header, FALSE, NULL);
ianjuta_file_loader_load (loader, source, FALSE, NULL);
+
+ if (cg_window_get_add_to_repository (plugin->window))
+ {
+ cg_plugin_add_to_repository (plugin, header, source);
+ }
+
g_object_unref (header);
g_object_unref (source);
}
Modified: trunk/plugins/class-gen/window.c
==============================================================================
--- trunk/plugins/class-gen/window.c (original)
+++ trunk/plugins/class-gen/window.c Tue Feb 24 23:25:43 2009
@@ -351,8 +351,10 @@
if (gtk_toggle_button_get_active (button) == FALSE)
{
- gtk_widget_set_sensitive (glade_xml_get_widget(
- priv->gxml, "add_repository"), FALSE);
+ GtkWidget* widget = glade_xml_get_widget(priv->gxml, "add_repository");
+ gtk_widget_set_sensitive (widget, FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget),
+ FALSE);
}
else
{
@@ -383,8 +385,8 @@
str_filebase = cg_window_class_name_to_file_name (
gtk_entry_get_text (GTK_ENTRY (entry)));
- str_fileheader = g_strconcat (str_filebase, ".hpp", NULL);
- str_filesource = g_strconcat (str_filebase, ".cpp", NULL);
+ str_fileheader = g_strconcat (str_filebase, ".h", NULL);
+ str_filesource = g_strconcat (str_filebase, ".cc", NULL);
g_free (str_filebase);
gtk_entry_set_text (GTK_ENTRY (file_header), str_fileheader);
@@ -1135,15 +1137,8 @@
cg_window_get_add_to_repository (CgWindow *window)
{
CgWindowPrivate *priv;
- GtkWidget *button;
priv = CG_WINDOW_PRIVATE (window);
- /* It can happen that the checkbox is checked and then somehow
- * disabled (for example by unchecking add to project). In this
- * case add to repository should also be FALSE. */
- button = glade_xml_get_widget (priv->gxml, "add_repository");
- if (GTK_WIDGET_IS_SENSITIVE(button) == FALSE) return FALSE;
-
return cg_window_fetch_boolean (window, "add_repository");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]