예제 #1
0
static void
on_resolve_dialog_response (GtkDialog *dialog, gint response_id, 
							GitUIData *data)
{
	GtkWidget *resolve_status_view;
	GList *selected_paths;
	GitAddCommand *add_command;
	
	if (response_id == GTK_RESPONSE_OK)
	{	
		resolve_status_view = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
		                                                          "resolve_status_view"));
		selected_paths = anjuta_vcs_status_tree_view_get_selected (ANJUTA_VCS_STATUS_TREE_VIEW (resolve_status_view));
		add_command = git_add_command_new_list (data->plugin->project_root_directory,
												selected_paths, FALSE);
		
		git_command_free_string_list (selected_paths);
		
		g_signal_connect (G_OBJECT (add_command), "command-finished",
						  G_CALLBACK (on_add_command_finished),
						  data->plugin);
		
		anjuta_command_start (ANJUTA_COMMAND (add_command));
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
	git_ui_data_free (data);
}
예제 #2
0
static void
on_data_command_finished (AnjutaCommand *command, guint return_code,
                          GitLogCommand *self)
{
	ANJUTA_COMMAND_CLASS (git_log_command_parent_class)->notify_complete (ANJUTA_COMMAND (self),
	                                                                      self->priv->return_code);
}
예제 #3
0
static void
on_ok_action_activated (GtkAction *action, GitRemoveFilesPane *self)
{
	Git *plugin;
	AnjutaFileList *remove_file_list;
	GtkToggleAction *force_action;
	GList *paths;
	GitRemoveCommand *remove_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	remove_file_list = ANJUTA_FILE_LIST (gtk_builder_get_object (self->priv->builder,
	                                                  			 "remove_file_list"));
	force_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder,
	                                                          "force_action"));
	paths = anjuta_file_list_get_paths (remove_file_list);
	remove_command = git_remove_command_new_list (plugin->project_root_directory,
	                                              paths,
	                                              gtk_toggle_action_get_active (force_action));

	anjuta_util_glist_strings_free (paths);

	g_signal_connect (G_OBJECT (remove_command), "command-finished",
	                  G_CALLBACK (git_pane_report_errors),
	                  plugin);


	g_signal_connect (G_OBJECT (remove_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

	anjuta_command_start (ANJUTA_COMMAND (remove_command));

	git_pane_remove_from_dock (GIT_PANE (self));
}
예제 #4
0
void
subversion_ivcs_add (IAnjutaVcs *obj, GList *files, AnjutaAsyncNotify *notify,
					 GError **err)
{
	GList *path_list;
	SvnAddCommand *add_command;
	
	path_list = anjuta_util_convert_gfile_list_to_path_list (files);
	add_command = svn_add_command_new_list (path_list, FALSE, TRUE);
	
	anjuta_util_glist_strings_free (path_list);
	
	g_signal_connect (G_OBJECT (add_command), "command-finished", 
					  G_CALLBACK (g_object_unref), 
					  NULL);
	
	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (add_command), "command-finished",
								  G_CALLBACK (anjuta_async_notify_notify_finished),
								  notify);
	}
	
	anjuta_command_start (ANJUTA_COMMAND (add_command));
	
}
예제 #5
0
void
git_ivcs_add (IAnjutaVcs *obj, GList *files, AnjutaAsyncNotify *notify,
			  GError **err)
{
	gchar *project_root_directory;
	GList *path_list;
	GitAddCommand *add_command;
	
	project_root_directory = ANJUTA_PLUGIN_GIT (obj)->project_root_directory;
	
	if (project_root_directory)
	{
		path_list = anjuta_util_convert_gfile_list_to_relative_path_list (files,
		                                                                  project_root_directory);
		add_command = git_add_command_new_list (project_root_directory,
		                                        path_list, FALSE);
		
		anjuta_util_glist_strings_free (path_list);
		
		g_signal_connect (G_OBJECT (add_command), "command-finished", 
		                  G_CALLBACK (g_object_unref), 
		                  NULL);
		
		if (notify)
		{
			g_signal_connect_swapped (G_OBJECT (add_command), "command-finished",
			                          G_CALLBACK (anjuta_async_notify_notify_finished),
			                          notify);
		}
		
		anjuta_command_start (ANJUTA_COMMAND (add_command));
	}
	
}
예제 #6
0
void
on_unstage_button_clicked (GtkAction *action, Git *plugin)
{
	GList *paths;
	GitResetFilesCommand *reset_command;

	paths = git_status_pane_get_checked_commit_items (GIT_STATUS_PANE (plugin->status_pane),
	                                                  ANJUTA_VCS_STATUS_ALL);

	if (paths)
	{
		reset_command = git_reset_files_command_new (plugin->project_root_directory,
		                                             GIT_RESET_FILES_HEAD,
		                                             paths);

		anjuta_util_glist_strings_free (paths);

		g_signal_connect (G_OBJECT (reset_command), "command-finished",
		                  G_CALLBACK (git_pane_report_errors),
		                  plugin);


		g_signal_connect (G_OBJECT (reset_command), "command-finished",
		                  G_CALLBACK (g_object_unref),
		                  NULL);

		anjuta_command_start (ANJUTA_COMMAND (reset_command));
	}
	else
		anjuta_util_dialog_error (NULL, _("No staged files selected."));
}
예제 #7
0
static void
on_ok_button_clicked (GtkButton *button, GitCheckoutPane *self)
{
	Git *plugin;
	GtkToggleButton *force_check;
	GList *paths;
	GitCheckoutFilesCommand *checkout_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	force_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
	                                                         "force_check"));

	paths = git_status_pane_get_selected_not_updated_items (GIT_STATUS_PANE (plugin->status_pane),
	                                                        ANJUTA_VCS_STATUS_ALL);
	checkout_command = git_checkout_files_command_new (plugin->project_root_directory,
	                                                   paths,
	                                                   gtk_toggle_button_get_active (force_check));

	anjuta_util_glist_strings_free (paths);

	g_signal_connect (G_OBJECT (checkout_command), "command-finished",
	                  G_CALLBACK (git_pane_report_errors),
	                  plugin);

	g_signal_connect (G_OBJECT (checkout_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

	anjuta_command_start (ANJUTA_COMMAND (checkout_command));

	git_pane_remove_from_dock (GIT_PANE (self));
	                            
}
예제 #8
0
void
on_git_status_unstage_activated (GtkAction *action, Git *plugin)
{
	gchar *path;
	GList *paths;
	GitResetFilesCommand *reset_command;

	path = git_status_pane_get_selected_commit_path (GIT_STATUS_PANE (plugin->status_pane));

	if (path)
	{
		paths = g_list_append (NULL, path);

		reset_command = git_reset_files_command_new (plugin->project_root_directory,
		                                             GIT_RESET_FILES_HEAD,
		                                             paths);

		g_signal_connect (G_OBJECT (reset_command), "command-finished",
		                  G_CALLBACK (git_pane_report_errors),
		                  plugin);

		g_signal_connect (G_OBJECT (reset_command), "command-finished",
		                  G_CALLBACK (g_object_unref),
		                  NULL);

		anjuta_util_glist_strings_free (paths);

		anjuta_command_start (ANJUTA_COMMAND (reset_command));
	}
}
예제 #9
0
void
on_diff_button_clicked (GtkAction *action, Git *plugin)
{
	IAnjutaDocumentManager *document_manager;
	IAnjutaEditor *editor;
	GitDiffCommand *diff_command;

	document_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
												   IAnjutaDocumentManager,
												   NULL);
	editor = ianjuta_document_manager_add_buffer (document_manager,/* Translators: default file name for git diff's output */
												  _("Uncommitted Changes.diff"),
												  "", NULL);

	diff_command = git_diff_command_new (plugin->project_root_directory);

	g_signal_connect (G_OBJECT (diff_command), "data-arrived",
					  G_CALLBACK (git_pane_send_raw_output_to_editor),
					  editor);

	g_signal_connect (G_OBJECT (diff_command), "command-finished",
					  G_CALLBACK (git_pane_report_errors),
					  plugin);

	g_signal_connect (G_OBJECT (diff_command), "command-finished",
					  G_CALLBACK (g_object_unref),
					  NULL);

	anjuta_command_start (ANJUTA_COMMAND (diff_command));
}
예제 #10
0
void
on_git_branch_delete_activated (GtkAction *action, Git *plugin)
{
	gchar *selected_branch;
	GList *branches;
	GitBranchDeleteCommand *delete_command;

	selected_branch = git_branches_pane_get_selected_branch (GIT_BRANCHES_PANE (plugin->branches_pane));

	if (anjuta_util_dialog_boolean_question (NULL, FALSE, 
	                                         _("Are you sure you want to delete branch %s?"),
	                                         selected_branch))
	{
		branches = g_list_append (NULL, selected_branch);
		delete_command = git_branch_delete_command_new (plugin->project_root_directory,
		                                                branches, 
		                                                git_branches_pane_is_selected_branch_remote (GIT_BRANCHES_PANE (plugin->branches_pane)),
		                                                FALSE);

		g_list_free (branches);

		g_signal_connect (G_OBJECT (delete_command), "command-finished",
		                  G_CALLBACK (git_pane_report_errors),
		                  plugin);

		g_signal_connect (G_OBJECT (delete_command), "command-finished",
		                  G_CALLBACK (g_object_unref),
		                  NULL);

		anjuta_command_start (ANJUTA_COMMAND (delete_command));
	}

	g_free (selected_branch);
}
예제 #11
0
AnjutaDockPane *
git_push_pane_new (Git *plugin)
{
    GitPushPane *self;
    GtkListStore *push_branch_model;
    GtkListStore *push_tag_model;
    GitBranchListCommand *branch_list_command;
    GitTagListCommand *tag_list_command;

    self = g_object_new (GIT_TYPE_PUSH_PANE, "plugin", plugin, NULL);
    push_branch_model = GTK_LIST_STORE (gtk_builder_get_object (self->priv->builder,
                                        "push_branch_model"));
    push_tag_model = GTK_LIST_STORE (gtk_builder_get_object (self->priv->builder,
                                     "push_tag_model"));
    branch_list_command = git_branch_list_command_new (plugin->project_root_directory,
                          GIT_BRANCH_TYPE_LOCAL);
    tag_list_command = git_tag_list_command_new (plugin->project_root_directory);

    g_signal_connect (G_OBJECT (plugin->remotes_pane), "single-selection-changed",
                      G_CALLBACK (on_remote_selected),
                      self->priv->repository_selector);

    g_signal_connect (G_OBJECT (branch_list_command), "data-arrived",
                      G_CALLBACK (on_branch_list_command_data_arrived),
                      push_branch_model);

    g_signal_connect (G_OBJECT (tag_list_command), "data-arrived",
                      G_CALLBACK (on_tag_list_command_data_arrived),
                      push_tag_model);

    g_signal_connect (G_OBJECT (branch_list_command), "command-finished",
                      G_CALLBACK (g_object_unref),
                      NULL);

    g_signal_connect (G_OBJECT (tag_list_command), "command-finished",
                      G_CALLBACK (g_object_unref),
                      NULL);

    /* Set the contents of the selected remote label */
    on_remote_selected (plugin->remotes_pane,
                        GIT_REPOSITORY_SELECTOR (self->priv->repository_selector));

    anjuta_command_start (ANJUTA_COMMAND (branch_list_command));
    anjuta_command_start (ANJUTA_COMMAND (tag_list_command));

    return ANJUTA_DOCK_PANE (self);
}
예제 #12
0
void
subversion_ivcs_checkout (IAnjutaVcs *obj, 
						  const gchar *repository_location, GFile *dest,
						  GCancellable *cancel,
						  AnjutaAsyncNotify *notify, GError **err)
{
	GError *error;
	gchar *path;
	SvnCheckoutCommand *checkout_command;
	Subversion *plugin;

	error = NULL;
	g_file_make_directory (dest, NULL, &error);
	if (error)
	{
		if (error->code != G_IO_ERROR_EXISTS)
		{
			g_propagate_error (err, error);
			return;
		}
		g_error_free (error);
	}
	
	path = g_file_get_path (dest);
	checkout_command = svn_checkout_command_new (repository_location, path);
	plugin = ANJUTA_PLUGIN_SUBVERSION (obj);
	
	g_free (path);
	
	create_message_view (plugin);
	
	g_signal_connect (G_OBJECT (checkout_command), "data-arrived",
					  G_CALLBACK (on_command_info_arrived),
					  plugin);

	g_signal_connect (G_OBJECT (checkout_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);
	
	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
								  G_CALLBACK (anjuta_command_cancel),
								  checkout_command);
	}
	
	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (checkout_command), 
								  "command-finished",
								  G_CALLBACK (anjuta_async_notify_notify_finished),
								  notify);
	}
	
	anjuta_command_start (ANJUTA_COMMAND (checkout_command));
}
static void
create_patch_series_dialog (Git *plugin)
{
	GtkBuilder *bxml;
	gchar *objects[] = {"patch_series_dialog", "branch_combo_model", NULL};
	GError *error;
	GtkWidget *dialog;
	GtkWidget *patch_series_origin_check;
	GtkWidget *patch_series_branch_combo;
	GtkListStore *branch_combo_model;
	GitUIData *data;
	GitBranchListCommand *list_command;
	
	bxml = gtk_builder_new ();
	error = NULL;

	if (!gtk_builder_add_objects_from_file (bxml, BUILDER_FILE, objects, 
	                                        &error))
	{
		g_warning ("Couldn't load builder file: %s", error->message);
		g_error_free (error);
	}
	
	dialog = GTK_WIDGET (gtk_builder_get_object (bxml, "patch_series_dialog"));
	patch_series_origin_check = GTK_WIDGET (gtk_builder_get_object (bxml, 
	                                              				    "patch_series_origin_check"));
	patch_series_branch_combo = GTK_WIDGET (gtk_builder_get_object (bxml, 
																    "patch_series_branch_combo"));
	branch_combo_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,
	                                                             "branch_combo_model"));
	
	data = git_ui_data_new (plugin, bxml);
	
	list_command = git_branch_list_command_new (plugin->project_root_directory,
												GIT_BRANCH_TYPE_ALL);
	
	g_signal_connect (G_OBJECT (list_command), "data-arrived", 
					  G_CALLBACK (on_git_list_branch_combo_command_data_arrived), 
					  branch_combo_model);
	
	g_signal_connect (G_OBJECT (list_command), "command-finished", 
					  G_CALLBACK (on_git_list_branch_combo_command_finished), 
					  patch_series_branch_combo);
	
	anjuta_command_start (ANJUTA_COMMAND (list_command));
	
	g_signal_connect (G_OBJECT (dialog), "response", 
					  G_CALLBACK (on_create_patch_series_dialog_response), 
					  data);

	g_signal_connect (G_OBJECT (patch_series_origin_check), "toggled",
	                  G_CALLBACK (on_git_origin_check_toggled),
	                  patch_series_branch_combo);
	
	gtk_widget_show_all (dialog);
}
예제 #14
0
static void
on_stash_list_command_data_arrived (AnjutaCommand *command, 
                                    GtkTreeStore *stash_model)
{
	GQueue *output;
	GtkTreeIter iter;
	GitStash *stash;
	guint number;
	gchar *message;
	gchar *id;
	gchar *working_directory;
	GitStashShowCommand *show_command;
	
	output = git_stash_list_command_get_output (GIT_STASH_LIST_COMMAND (command));

	while (g_queue_peek_head (output))
	{
		stash = g_queue_pop_head (output);
		number = git_stash_get_number (stash);
		message = git_stash_get_message (stash);
		id = git_stash_get_id (stash);


		gtk_tree_store_append (stash_model, &iter, NULL);
		gtk_tree_store_set (stash_model, &iter, 
		                    COL_NUMBER, number,
		                    COL_MESSAGE, message,
		                    COL_ID, id,
		                    -1);

		g_object_get (G_OBJECT (command), "working-directory", 
		              &working_directory, NULL);
		show_command = git_stash_show_command_new (working_directory, id);

		g_free (working_directory);

		g_object_set_data_full (G_OBJECT (show_command), "parent-path", 
		               			gtk_tree_model_get_path (GTK_TREE_MODEL (stash_model),
		                                        		 &iter),
		               			(GDestroyNotify) gtk_tree_path_free);

		g_signal_connect (G_OBJECT (show_command), "command-finished",
		                  G_CALLBACK (on_stash_diff_command_finished),
		                  stash_model);

		g_signal_connect (G_OBJECT (show_command), "command-finished",
		                  G_CALLBACK (g_object_unref),
		                  NULL);

		anjuta_command_start (ANJUTA_COMMAND (show_command));

		g_object_unref (stash);
		g_free (message);
		g_free (id);
	}
}
예제 #15
0
static svn_error_t *
log_callback (void *baton,
			  apr_hash_t *changed_paths,
			  svn_revnum_t revision,
			  const char *author,
			  const char *date,
			  const char *message,
			  apr_pool_t *pool)
{
	SvnLogCommand *self;
	SvnLogEntry *log_entry;
	gchar *entry_author;
	const gchar *human_date;
	gchar *entry_date;
	apr_time_t entry_time;
	gchar *entry_message;
	
	self = SVN_LOG_COMMAND (baton);
	
	/* Libsvn docs say author, date, and message might be NULL. */
	if (author)
		entry_author = g_strdup (author);
	else 
		entry_author = g_strdup ("(none)");
	
	if (date && date[0])
	{
		svn_time_from_cstring (&entry_time, date,
							   svn_command_get_pool (SVN_COMMAND (self)));
		human_date = svn_time_to_human_cstring (entry_time,
												svn_command_get_pool (SVN_COMMAND (self)));
		entry_date = g_strdup (human_date);
	}
	else
		entry_date = g_strdup ("(none)");
	
	if (message)
		entry_message = g_strdup (message);
	else
		entry_message = g_strdup ("empty log message"); /* Emulate ViewCVS */
	
	log_entry = svn_log_entry_new (entry_author, entry_date, revision, 
								   entry_message);

	g_free (entry_author);
	g_free (entry_date);
	g_free (entry_message);
	
	anjuta_async_command_lock (ANJUTA_ASYNC_COMMAND (self));
	g_queue_push_head (self->priv->log_entry_queue, log_entry);
	anjuta_async_command_unlock (ANJUTA_ASYNC_COMMAND (self));
	
	anjuta_command_notify_data_arrived (ANJUTA_COMMAND (self));
	
	return SVN_NO_ERROR;
}
예제 #16
0
static void
git_status_pane_refresh (AnjutaDockPane *pane)
{
	Git *plugin;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (pane));

	anjuta_command_start (ANJUTA_COMMAND (plugin->commit_status_command));
	
}
예제 #17
0
static void
anjuta_command_finalize (GObject *object)
{
    AnjutaCommand *self;

    self = ANJUTA_COMMAND (object);

    g_free (self->priv->error_message);
    g_free (self->priv);

    G_OBJECT_CLASS (anjuta_command_parent_class)->finalize (object);
}
예제 #18
0
void
on_commit_diff_button_clicked (GtkAction *action, Git *plugin)
{
	GitRevision *revision;
	gchar *sha;
	gchar *short_sha;
	gchar *editor_name;
	IAnjutaDocumentManager *document_manager;
	IAnjutaEditor *editor;
	GitDiffTreeCommand *diff_command;
	
	revision = git_log_pane_get_selected_revision (GIT_LOG_PANE (plugin->log_pane));
	
	if (revision)
	{
		sha = git_revision_get_sha (revision);
		short_sha = git_revision_get_short_sha (revision);
		/* Translators: file name for an existing commits diff, %s is an SHASUM of a commit */
		editor_name = g_strdup_printf (_("Commit %s.diff"), short_sha);
		
		document_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
													   IAnjutaDocumentManager, 
													   NULL);
		editor = ianjuta_document_manager_add_buffer (document_manager, 
													  editor_name,
													  "", NULL);
		
		diff_command = git_diff_tree_command_new (plugin->project_root_directory,
												  sha);
		
		g_signal_connect (G_OBJECT (diff_command), "data-arrived",
						  G_CALLBACK (git_pane_send_raw_output_to_editor),
						  editor);
		
		g_signal_connect (G_OBJECT (diff_command), "command-finished",
						  G_CALLBACK (git_pane_report_errors),
						  plugin);

		g_signal_connect (G_OBJECT (diff_command), "command-finished",
						  G_CALLBACK (g_object_unref),
						  NULL);

		
		anjuta_command_start (ANJUTA_COMMAND (diff_command));

		g_object_unref (revision);
		g_free (sha);
		g_free (short_sha);
		g_free (editor_name);
	}
	else
		anjuta_util_dialog_error (NULL, _("No revision selected"));
}
예제 #19
0
void
git_ivcs_checkout (IAnjutaVcs *obj, 
				   const gchar *repository_location, GFile *dest,
				   GCancellable *cancel,
				   AnjutaAsyncNotify *notify, GError **err)
{
	GFile *parent;
	gchar *path, *dir_name;
	GitCloneCommand *clone_command;
	Git *plugin;

	parent = g_file_get_parent (dest);
	path = g_file_get_path (parent);
	dir_name = g_file_get_basename (dest);
	
	clone_command = git_clone_command_new (path, repository_location, dir_name);
	plugin = ANJUTA_PLUGIN_GIT (obj);

	g_object_unref (parent);
	g_free (path);
	g_free (dir_name);

	git_pane_create_message_view (plugin);

	g_signal_connect (G_OBJECT (clone_command), "data-arrived",
	                  G_CALLBACK (git_pane_on_command_info_arrived),
	                  plugin);

	g_signal_connect (G_OBJECT (clone_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
		                          G_CALLBACK (anjuta_command_cancel),
		                          clone_command);
	}

	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (clone_command), 
		                          "command-finished",
		                          G_CALLBACK (anjuta_async_notify_notify_finished),
		                          notify);
	}

	anjuta_command_start (ANJUTA_COMMAND (clone_command));
}
예제 #20
0
void 
git_ivcs_diff (IAnjutaVcs *obj, GFile* file,  
			   IAnjutaVcsDiffCallback callback, gpointer user_data,  
			   GCancellable* cancel, AnjutaAsyncNotify *notify,
			   GError **err)
{
	gchar *project_root_directory;
	GitDiffCommand *diff_command;
	
	project_root_directory = ANJUTA_PLUGIN_GIT (obj)->project_root_directory;
	
	if (project_root_directory)
	{
		diff_command = git_diff_command_new (project_root_directory);
		
		g_object_set_data_full (G_OBJECT (diff_command), "file", 
		                        g_object_ref (file),
		                        (GDestroyNotify) g_object_unref);
		g_object_set_data (G_OBJECT (diff_command), "user-data", user_data);
		
		g_signal_connect (G_OBJECT (diff_command), "command-finished", 
		                  G_CALLBACK (g_object_unref),
		                  NULL);
		
		g_signal_connect (G_OBJECT (diff_command), "data-arrived",
		                  G_CALLBACK (on_diff_command_data_arrived),
		                  callback);
		
/* FIXME: Reenable when canceling is implemented. */
#if 0
		if (cancel)
		{
			g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
			                          G_CALLBACK (anjuta_command_cancel),
			                          diff_command);
		}
#endif
		
		if (notify)
		{
			g_signal_connect_swapped (G_OBJECT (diff_command), "command-finished",
			                          G_CALLBACK (anjuta_async_notify_notify_finished),
			                          notify);
		}
		
		anjuta_command_start (ANJUTA_COMMAND (diff_command));
	}
}
예제 #21
0
static void
on_ok_action_activated (GtkAction *action, GitResetPane *self)
{
	Git *plugin;
	AnjutaEntry *reset_revision_entry;
	GtkToggleButton *mixed_radio;
	GtkToggleButton *soft_radio;
	const gchar *revision;
	GitResetTreeMode mode;
	GitResetTreeCommand *reset_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	reset_revision_entry = ANJUTA_ENTRY (gtk_builder_get_object (self->priv->builder,
	                                                   			 "reset_revision_entry"));
	mixed_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
	                                                         "mixed_radio"));
	soft_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
	                                                        "soft_radio"));

	revision = anjuta_entry_get_text (reset_revision_entry);

	if (g_utf8_strlen (revision, -1) == 0)
		revision = GIT_RESET_TREE_PREVIOUS;

	if (gtk_toggle_button_get_active (mixed_radio))
		mode = GIT_RESET_TREE_MODE_MIXED;
	else if (gtk_toggle_button_get_active (soft_radio))
		mode = GIT_RESET_TREE_MODE_SOFT;
	else
		mode = GIT_RESET_TREE_MODE_HARD;

	reset_command = git_reset_tree_command_new (plugin->project_root_directory,
	                                            revision, mode);

	g_signal_connect (G_OBJECT (reset_command), "command-finished",
	                  G_CALLBACK (git_pane_report_errors),
	                  plugin);


	g_signal_connect (G_OBJECT (reset_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

	anjuta_command_start (ANJUTA_COMMAND (reset_command));


	git_pane_remove_from_dock (GIT_PANE (self));
}
예제 #22
0
static void
refresh_log (GitLogPane *self)
{
	Git *plugin;
	GtkTreeView *log_view;
	GtkTreeViewColumn *graph_column;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	log_view = GTK_TREE_VIEW (gtk_builder_get_object (self->priv->builder,
	                                                  "log_view"));
	graph_column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (self->priv->builder,
	                                                             "graph_column"));

	/* Unref the previous command if it's still running. */
	if (self->priv->log_command)
		g_object_unref (self->priv->log_command);

	gtk_tree_view_set_model (log_view, NULL);

	/* We don't support filters for now */
	self->priv->log_command = git_log_command_new (plugin->project_root_directory,
	                                               self->priv->selected_branch,
	                                               self->priv->path,
	                                               NULL,
	                                               NULL,
	                                               NULL,
	                                               NULL,
	                                               NULL,
	                                               NULL);

	/* Hide the graph column if we're looking at the log of a path. The graph
	 * won't be correct in this case. */
	if (self->priv->path)
		gtk_tree_view_column_set_visible (graph_column, FALSE);
	else
		gtk_tree_view_column_set_visible (graph_column, TRUE);

	g_signal_connect_object (G_OBJECT (self->priv->log_command), "command-finished",
	                         G_CALLBACK (on_log_command_finished),
	                         self, 0);

	gtk_list_store_clear (self->priv->log_model);

	/* Show the loading spinner */
	git_log_pane_set_view_mode (self, LOG_VIEW_LOADING);

	anjuta_command_start (ANJUTA_COMMAND (self->priv->log_command));
}
예제 #23
0
static void
git_branch_list_command_handle_output (GitCommand *git_command, 
									   const gchar *output)
{
	GitBranchListCommand *self;
	GMatchInfo *active_match_info;
	GMatchInfo *regular_match_info;
	gchar *branch_name;
	GitBranch *branch;
	gboolean active;

	self = GIT_BRANCH_LIST_COMMAND (git_command);
	
	active_match_info = NULL;
	regular_match_info = NULL;
	branch_name = NULL;
	branch = NULL;
	active = FALSE;
	
	if (g_regex_match (self->priv->active_branch_regex, output, 0, 
					   &active_match_info))
	{
		branch_name = g_match_info_fetch (active_match_info, 1);
		active = TRUE;
	}
	else if (g_regex_match (self->priv->regular_branch_regex, output, 0,
							&regular_match_info))
	{
		branch_name = g_match_info_fetch (regular_match_info, 1);
	}
	
	if (branch_name)
		branch = git_branch_new (branch_name, active);
	
	g_free (branch_name);


	if (active_match_info)
		g_match_info_free (active_match_info);

	if (regular_match_info)
		g_match_info_free (regular_match_info);
	
	g_queue_push_head (self->priv->output, branch);
	anjuta_command_notify_data_arrived (ANJUTA_COMMAND (git_command));
	
}
예제 #24
0
void 
git_ivcs_query_status (IAnjutaVcs *obj, GFile *file, 
					   IAnjutaVcsStatusCallback callback,
					   gpointer user_data, GCancellable *cancel,
					   AnjutaAsyncNotify *notify, GError **err)
{
	gchar *path;
	GitStatusCommand *status_command;

	path = g_file_get_path (file);
	status_command = git_status_command_new (path, ~0);

	g_free (path);

	g_object_set_data (G_OBJECT (status_command), "user-data", user_data);
	g_object_set_data_full (G_OBJECT (status_command), "working-directory",
	                        g_file_get_path (file),
	                        (GDestroyNotify) g_free);

	g_signal_connect (G_OBJECT (status_command), "data-arrived",
	                  G_CALLBACK (on_status_command_data_arrived),
	                  callback);

	g_signal_connect (G_OBJECT (status_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

#if 0
	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
		                          G_CALLBACK (anjuta_command_cancel),
		                          status_command);
	}
#endif

	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (status_command), "command-finished",
		                          G_CALLBACK (anjuta_async_notify_notify_finished),
		                          notify);
	}

	anjuta_command_queue_push (ANJUTA_PLUGIN_GIT (obj)->command_queue,
	                           ANJUTA_COMMAND (status_command));
}
예제 #25
0
static void
git_status_command_finalize (GObject *object)
{
	GitStatusCommand *self;
	
	self = GIT_STATUS_COMMAND (object);
	
	git_status_command_clear_output (self);
	git_status_command_stop_automatic_monitor (ANJUTA_COMMAND (self));
	
	g_queue_free (self->priv->status_queue);
	g_regex_unref (self->priv->status_regex);
	
	g_free (self->priv);

	G_OBJECT_CLASS (git_status_command_parent_class)->finalize (object);
}
예제 #26
0
static gint
do_search_prj_glb_async (SymbolDBSearchCommand *search_command, guint cmd_id, 
                         GCancellable* cancel, AnjutaAsyncNotify *notify, 
                		 IAnjutaSymbolManagerSearchCallback callback, 
						 gpointer callback_user_data)
{
	/* be sure that the cmd_id and the callback_user_data stay with us when the 
	 * data-arrived signal is raised 
	 */
	g_object_set_data (G_OBJECT (search_command), "cmd_id",
	                   GUINT_TO_POINTER (cmd_id));

	/* FIXME: why is data checked for NULL on iface layer? It should be able to 
	 * arrive here == NULL....
	 */
	if (callback_user_data != NULL)
		g_object_set_data (G_OBJECT (search_command), "callback_user_data", 
	                   callback_user_data);

	/* connect some signals */
	g_signal_connect (G_OBJECT (search_command), "data-arrived",
					  G_CALLBACK (on_sdb_search_command_data_arrived),
					  callback);
	
	g_signal_connect (G_OBJECT (search_command), "command-finished",
					  G_CALLBACK (g_object_unref),
					  NULL);
	
	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
								  G_CALLBACK (anjuta_command_cancel),
								  search_command);
	}
	
	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (search_command), "command-finished",
								  G_CALLBACK (anjuta_async_notify_notify_finished),
								  notify);
	}
	
	anjuta_command_start (ANJUTA_COMMAND (search_command));	

	return cmd_id;	
}
예제 #27
0
void 
subversion_ivcs_diff (IAnjutaVcs *obj, GFile* file,  
					  IAnjutaVcsDiffCallback callback, gpointer user_data,  
					  GCancellable* cancel, AnjutaAsyncNotify *notify,
					  GError **err)
{
	gchar *path;
	SvnDiffCommand *diff_command;
	
	path = g_file_get_path (file);
	diff_command = svn_diff_command_new (path, SVN_DIFF_REVISION_NONE,
										 SVN_DIFF_REVISION_NONE,
										 ANJUTA_PLUGIN_SUBVERSION (obj)->project_root_dir,
										 TRUE);
	
	g_free (path);
	
	g_object_set_data_full (G_OBJECT (diff_command), "file", 
							g_object_ref (file),
							(GDestroyNotify) g_object_unref);
	g_object_set_data (G_OBJECT (diff_command), "user-data", user_data);
	
	g_signal_connect (G_OBJECT (diff_command), "command-finished", 
					  G_CALLBACK (g_object_unref),
					  NULL);
	
	g_signal_connect (G_OBJECT (diff_command), "data-arrived",
					  G_CALLBACK (on_diff_command_data_arrived),
					  callback);
	
	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
								  G_CALLBACK (anjuta_command_cancel),
								  diff_command);
	}
	
	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (diff_command), "command-finished",
								  G_CALLBACK (anjuta_async_notify_notify_finished),
								  notify);
	}
	
	anjuta_command_start (ANJUTA_COMMAND (diff_command));
}
예제 #28
0
static void
on_ok_action_activated (GtkAction *action, GitStashChangesPane *self)
{
	Git *plugin;
	AnjutaColumnTextView *message_view;
	GtkToggleButton *stash_index_check;
	gchar *message;
	GitStashSaveCommand *save_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	message_view = ANJUTA_COLUMN_TEXT_VIEW (gtk_builder_get_object (self->priv->builder,
	                                                                "message_view"));
	stash_index_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
	                                                               "stash_index_check"));
	message = anjuta_column_text_view_get_text (message_view);

	/* Don't pass an empty message */
	if (!g_utf8_strlen (message, -1))
	{
		g_free (message);
		message = NULL;
	}

	save_command = git_stash_save_command_new (plugin->project_root_directory,
	                                           gtk_toggle_button_get_active (stash_index_check),
	                                           message);

	g_free (message);

	g_signal_connect (G_OBJECT (save_command), "command-finished",
	                  G_CALLBACK (git_pane_report_errors),
	                  plugin);


	g_signal_connect (G_OBJECT (save_command), "command-finished",
	                  G_CALLBACK (g_object_unref),
	                  NULL);

	anjuta_command_start (ANJUTA_COMMAND (save_command));
	

	git_pane_remove_from_dock (GIT_PANE (self));
	                            
}
예제 #29
0
static void
rebase_continue (Git *plugin, GitRebaseContinueAction action)
{
	GitRebaseContinueCommand *rebase_command;
	
	git_create_message_view (plugin);
	
	rebase_command = git_rebase_continue_command_new (plugin->project_root_directory,
													  action);
	
	g_signal_connect (G_OBJECT (rebase_command), "command-finished",
					  G_CALLBACK (on_git_command_finished),
					  plugin);
	
	g_signal_connect (G_OBJECT (rebase_command), "data-arrived",
					  G_CALLBACK (on_git_command_info_arrived),
					  plugin);
	
	anjuta_command_start (ANJUTA_COMMAND (rebase_command));
}
예제 #30
0
void 
subversion_ivcs_query_status (IAnjutaVcs *obj, GFile *file, 
							  IAnjutaVcsStatusCallback callback,
							  gpointer user_data, GCancellable *cancel,
							  AnjutaAsyncNotify *notify, GError **err)
{
	gchar *path;
	SvnStatusCommand *status_command;
	
	path = g_file_get_path (file);
	status_command = svn_status_command_new (path, FALSE, TRUE);
	
	g_free (path);
	
	g_object_set_data (G_OBJECT (status_command), "user-data", user_data);
	
	g_signal_connect (G_OBJECT (status_command), "data-arrived",
					  G_CALLBACK (on_ivcs_status_command_data_arrived),
					  callback);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (g_object_unref),
					  NULL);
	
	if (cancel)
	{
		g_signal_connect_swapped (G_OBJECT (cancel), "cancelled",
								  G_CALLBACK (anjuta_command_cancel),
								  status_command);
	}
	
	if (notify)
	{
		g_signal_connect_swapped (G_OBJECT (status_command), "command-finished",
								  G_CALLBACK (anjuta_async_notify_notify_finished),
								  notify);
	}
	
	anjuta_command_start (ANJUTA_COMMAND (status_command));
}