Exemplo n.º 1
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));
	}
}
Exemplo n.º 2
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));
}
Exemplo n.º 3
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));
}
Exemplo n.º 4
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));
}
Exemplo n.º 5
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;	
}
Exemplo n.º 6
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));
	                            
}
Exemplo n.º 7
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));
}
Exemplo n.º 8
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));
}
Exemplo n.º 9
0
static gboolean
on_log_view_row_selected (GtkTreeSelection *selection, 
                          GtkTreeModel *model,
                          GtkTreePath *path, 
                          gboolean path_currently_selected,
                          GitLogPane *self)
{
	Git *plugin;
	GtkTreeIter iter;
	GitRevision *revision;
	gchar *sha;
	
	if (!path_currently_selected)
	{
		plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));

		gtk_tree_model_get_iter (model, &iter, path);
		gtk_tree_model_get (model, &iter, LOG_COL_REVISION, &revision, -1);
		sha = git_revision_get_sha (revision);

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

		self->priv->log_message_command =
			git_log_message_command_new (plugin->project_root_directory, sha);
		
		g_free (sha);
		g_object_unref (revision);
		
		g_signal_connect_object (G_OBJECT (self->priv->log_message_command), "command-finished",
		                         G_CALLBACK (on_log_message_command_finished),
		                         self, 0);
		
		anjuta_command_start (ANJUTA_COMMAND (self->priv->log_message_command));
	}
	
	return TRUE;
}
Exemplo n.º 10
0
void
on_fetch_button_clicked (GtkAction *action, Git *plugin)
{
	GitFetchCommand *fetch_command;

	fetch_command = git_fetch_command_new (plugin->project_root_directory);

	git_pane_create_message_view (plugin);

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

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

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

	anjuta_command_start (ANJUTA_COMMAND (fetch_command));
}
Exemplo n.º 11
0
static void
on_ref_command_finished (AnjutaCommand *command, guint return_code,
                         GitLogPane *self)
{
	Git *plugin;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));

	if (self->priv->refs)
		g_hash_table_unref (self->priv->refs);

	self->priv->refs = git_ref_command_get_refs (GIT_REF_COMMAND (command));

	/* Unref the previous command if it's still running. */
	if (self->priv->branch_list_command)
		g_object_unref (self->priv->branch_list_command);
	
	/* Refresh the branch display after the refs get updated */
	self->priv->branch_list_command =
		git_branch_list_command_new (plugin->project_root_directory,
		                             GIT_BRANCH_TYPE_ALL);

	g_signal_connect_object (G_OBJECT (self->priv->branch_list_command), "command-started",
	                         G_CALLBACK (on_branch_list_command_started),
	                         self, 0);

	g_signal_connect_object (G_OBJECT (self->priv->branch_list_command), "command-finished",
	                         G_CALLBACK (on_branch_list_command_finished),
	                         self, 0);

	g_signal_connect_object (G_OBJECT (self->priv->branch_list_command), "data-arrived",
	                         G_CALLBACK (on_branch_list_command_data_arrived),
	                         self, 0);

	anjuta_command_start (ANJUTA_COMMAND (self->priv->branch_list_command));
}
Exemplo n.º 12
0
static void
on_ok_action_activated (GtkAction *action, GitMergePane *self)
{
	Git *plugin;
	GtkEditable *merge_revision_entry;
	GtkToggleAction *no_commit_action;
	GtkToggleAction *squash_action;
	GtkToggleButton *use_custom_log_check;
	gchar *revision;
	gchar *log;
	AnjutaColumnTextView *merge_log_view;
	GitMergeCommand *merge_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	merge_revision_entry = GTK_EDITABLE (gtk_builder_get_object (self->priv->builder,
	                                                   			 "merge_revision_entry"));
	no_commit_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder, 
	                                                              "no_commit_action"));
	squash_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder,
	                                                           "squash_action"));
	use_custom_log_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
	                                                                  "use_custom_log_check"));
	revision = gtk_editable_get_chars (merge_revision_entry, 0, -1);
	log = NULL;

	if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
	                           GTK_WIDGET (merge_revision_entry), revision,
	                           _("Please enter a revision.")))
	{
		g_free (revision);
		return;
	}

	if (gtk_toggle_button_get_active (use_custom_log_check))
	{
		merge_log_view = ANJUTA_COLUMN_TEXT_VIEW (gtk_builder_get_object (self->priv->builder,
		                                                        		  "merge_log_view"));
		log = anjuta_column_text_view_get_text (merge_log_view);

		if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
		                           GTK_WIDGET (merge_log_view), log,
		                           _("Please enter a log message.")))
		{
			g_free (revision);
			g_free (log);
			return;
		}
	}

	merge_command = git_merge_command_new (plugin->project_root_directory, 
	                                       revision, log,
	                                       gtk_toggle_action_get_active (no_commit_action),
	                                       gtk_toggle_action_get_active (squash_action));

	g_free (revision);
	g_free (log);

	git_pane_create_message_view (plugin);

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

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

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

	anjuta_command_start (ANJUTA_COMMAND (merge_command));
	                                       

	git_pane_remove_from_dock (GIT_PANE (self));
}
static void
on_create_patch_series_dialog_response (GtkDialog *dialog, gint response_id, 
										GitUIData *data)
{
	GtkWidget *patch_series_origin_check;
	GtkWidget *patch_series_branch_combo;
	GtkWidget *patch_series_file_chooser_button;
	GtkWidget *patch_series_signoff_check;
	GtkTreeModel *branch_combo_model;
	gchar *branch;
	gchar *output_directory;
	GtkTreeIter iter;
	GitFormatPatchCommand *format_patch_command;
	
	if (response_id == GTK_RESPONSE_OK)
	{	
		patch_series_origin_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
		                                              				    "patch_series_origin_check"));
		patch_series_branch_combo = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																	    "patch_series_branch_combo"));
		patch_series_file_chooser_button = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																			   "patch_series_file_chooser_button"));
		patch_series_signoff_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																		 "patch_series_signoff_check"));
		branch_combo_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
		                                                             "branch_combo_model"));
		
		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (patch_series_origin_check)))
		    branch = g_strdup ("origin");
		else
		{
			gtk_combo_box_get_active_iter (GTK_COMBO_BOX (patch_series_branch_combo), 
									   &iter);
			gtk_tree_model_get (branch_combo_model, &iter, 0, &branch, -1);
		}
		    
		output_directory = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (patch_series_file_chooser_button));
		
		format_patch_command = git_format_patch_command_new (data->plugin->project_root_directory,
															 output_directory,
															 branch,
															 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (patch_series_signoff_check)));
		
		g_free (branch);
		g_free (output_directory);
		
		git_create_message_view (data->plugin);
		
		g_signal_connect (G_OBJECT (format_patch_command), "command-finished",
						  G_CALLBACK (on_git_command_finished),
						  data->plugin);
		
		g_signal_connect (G_OBJECT (format_patch_command), "data-arrived",
						  G_CALLBACK (on_git_command_info_arrived),
						  data->plugin);
		
		anjuta_command_start (ANJUTA_COMMAND (format_patch_command));
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
	git_ui_data_free (data);
}
Exemplo n.º 14
0
static void
on_create_branch_dialog_response (GtkDialog *dialog, gint response_id, 
								  GitUIData *data)
{
	GtkWidget *branch_name_entry;
	GtkWidget *branch_checkout_check;
	GtkWidget *branch_revision_radio;
	GtkWidget *branch_revision_entry;
	GtkWidget *branch_branch_radio;
	GtkWidget *branch_branch_combo;
	GtkTreeModel *branch_combo_model;
	gchar *branch_name;
	gchar *revision;
	GtkTreeIter iter;
	gboolean checkout;
	GitBranchCreateCommand *create_command;
	
	if (response_id == GTK_RESPONSE_OK)
	{	
		branch_name_entry = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																"branch_name_entry"));
		branch_checkout_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																	"branch_checkout_check"));
		branch_revision_radio = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																	"branch_revision_radio"));
		branch_revision_entry = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																    "branch_revision_entry"));
		branch_branch_radio = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																  "branch_branch_radio"));
		branch_branch_combo = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																  "branch_branch_combo"));
		branch_combo_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
																	 "branch_combo_model"));
		branch_name = gtk_editable_get_chars (GTK_EDITABLE (branch_name_entry),
											  0, -1);
		revision = NULL;
		
		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (branch_revision_radio)))
		{
			revision = gtk_editable_get_chars (GTK_EDITABLE (branch_revision_entry),
											   0, -1);
			if (!git_check_input (GTK_WIDGET (dialog), branch_revision_entry, 
								  revision, _("Please enter a revision.")))
			{
				g_free (revision);
				g_free (branch_name);
				return;
			}
		}
		else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (branch_branch_radio)))
		{
			if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (branch_branch_combo), 
											   &iter))
			{
				gtk_tree_model_get (branch_combo_model, &iter, 0, &revision, 
									-1);
			}
		}
		
		if (!git_check_input (GTK_WIDGET (dialog), branch_revision_entry, 
							  branch_name, _("Please enter a branch name.")))
		{
			
			g_free (revision);
			g_free (branch_name);
			return;
		}
		
		checkout = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (branch_checkout_check));
		
		create_command = git_branch_create_command_new (data->plugin->project_root_directory,
														branch_name,
														revision,
														checkout);
		
		g_free (branch_name);
		g_free (revision);
		
		git_create_message_view (data->plugin);
		
		g_signal_connect (G_OBJECT (create_command), "command-finished",
						  G_CALLBACK (on_create_command_finished),
						  data->plugin);
		
		g_signal_connect (G_OBJECT (create_command), "data-arrived",
						  G_CALLBACK (on_git_command_info_arrived),
						  data->plugin);
		
		anjuta_command_start (ANJUTA_COMMAND (create_command));
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
	git_ui_data_free (data);
}
Exemplo n.º 15
0
static void
create_branch_dialog (Git *plugin, const gchar *revision)
{
	GtkBuilder *bxml;
	gchar *objects[] = {"create_branch_dialog", "branch_combo_model", NULL};
	GError *error;
	GtkWidget *dialog;
	GtkWidget *branch_revision_radio;
	GtkWidget *branch_revision_entry;
	GtkWidget *branch_branch_radio;
	GtkWidget *branch_branch_combo;
	GtkListStore *branch_combo_model;
	GitUIData *data;
	GitBranchListCommand *branch_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, "create_branch_dialog"));
	branch_revision_radio = GTK_WIDGET (gtk_builder_get_object (bxml, 
															    "branch_revision_radio"));
	branch_revision_entry = GTK_WIDGET (gtk_builder_get_object (bxml, 
																"branch_revision_entry"));
	branch_branch_radio = GTK_WIDGET (gtk_builder_get_object (bxml,
															  "branch_branch_radio"));
	branch_branch_combo = GTK_WIDGET (gtk_builder_get_object (bxml,
															  "branch_branch_combo"));
	branch_combo_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,
																 "branch_combo_model"));
	data = git_ui_data_new (plugin, bxml);

	branch_list_command = git_branch_list_command_new (plugin->project_root_directory,
													   GIT_BRANCH_TYPE_ALL);

	g_signal_connect (G_OBJECT (branch_list_command), "data-arrived",
					  G_CALLBACK (on_git_list_branch_combo_command_data_arrived),
					  branch_combo_model);

	g_signal_connect (G_OBJECT (branch_list_command), "command-finished",
					  G_CALLBACK (on_git_list_branch_combo_command_finished),
					  branch_branch_combo);

	anjuta_command_start (ANJUTA_COMMAND (branch_list_command));
	
	g_signal_connect (G_OBJECT (dialog), "response", 
					  G_CALLBACK (on_create_branch_dialog_response), 
					  data);
	
	g_signal_connect (G_OBJECT (branch_revision_radio), "toggled",
					  G_CALLBACK (on_branch_revision_radio_toggled),
					  branch_revision_entry);

	g_signal_connect (G_OBJECT (branch_branch_radio), "toggled",
					  G_CALLBACK (on_branch_revision_radio_toggled),
					  branch_branch_combo);
	
	if (revision)
	{
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (branch_revision_radio), 
									  TRUE);
		gtk_entry_set_text (GTK_ENTRY (branch_revision_entry), revision);
	}
	
	gtk_widget_show_all (dialog);
}
Exemplo n.º 16
0
static void
resolve_dialog (Git *plugin)
{
	GtkBuilder *bxml;
	gchar *objects[] = {"resolve_dialog", NULL};
	GError *error;
	GtkWidget *dialog;
	GtkWidget *resolve_select_all_button;
	GtkWidget *resolve_clear_button;
	GtkWidget *resolve_status_view;
	GtkWidget *resolve_status_progress_bar;
	GitStatusCommand *status_command;
	GitUIData *data;
	
	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, "resolve_dialog"));
	resolve_select_all_button = GTK_WIDGET(gtk_builder_get_object (bxml, "resolve_select_all_button"));
	resolve_clear_button = GTK_WIDGET (gtk_builder_get_object (bxml, 
	                                                           "resolve_clear_button"));
	resolve_status_view = GTK_WIDGET (gtk_builder_get_object (bxml, 
	                                                          "resolve_status_view"));
	resolve_status_progress_bar = GTK_WIDGET (gtk_builder_get_object (bxml, 
	                                                                  "resolve_status_progress_bar"));
	
	status_command = git_status_command_new (plugin->project_root_directory,
											 GIT_STATUS_SECTION_NOT_UPDATED);
	
	g_signal_connect (G_OBJECT (resolve_select_all_button), "clicked",
					  G_CALLBACK (git_select_all_status_items),
					  resolve_status_view);
	
	g_signal_connect (G_OBJECT (resolve_clear_button), "clicked",
					  G_CALLBACK (git_clear_all_status_selections),
					  resolve_status_view);
	
	git_pulse_progress_bar (GTK_PROGRESS_BAR (resolve_status_progress_bar));
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (git_cancel_data_arrived_signal_disconnect),
					  resolve_status_view);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (git_hide_pulse_progress_bar),
					  resolve_status_progress_bar);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (on_git_command_finished),
					  NULL);
	
	g_signal_connect (G_OBJECT (status_command), "data-arrived",
					  G_CALLBACK (on_git_status_command_data_arrived),
					  resolve_status_view);
	
	g_object_weak_ref (G_OBJECT (resolve_status_view),
					   (GWeakNotify) git_disconnect_data_arrived_signals,
					   status_command);
	
	anjuta_command_start (ANJUTA_COMMAND (status_command));
	
	data = git_ui_data_new (plugin, bxml);
	
	g_signal_connect(G_OBJECT (dialog), "response", 
					 G_CALLBACK (on_resolve_dialog_response), 
					 data);
	
	gtk_widget_show_all (dialog);
}
Exemplo n.º 17
0
guint
isymbol_manager_search_file_async (IAnjutaSymbolManager *sm, IAnjutaSymbolType match_types, 
				gboolean include_types,  IAnjutaSymbolField info_fields, const gchar *pattern,     			
			 	const GFile *file, gint results_limit, gint results_offset, 
                GCancellable* cancel, AnjutaAsyncNotify *notify, 
                IAnjutaSymbolManagerSearchCallback callback, 
                gpointer callback_user_data, GError **err)
{
	SymbolDBSearchCommand *search_command;
	SymbolDBPlugin *sdb_plugin;
	SymbolDBEngine *dbe;
	guint cmd_id;

	/* if the return is 0 then we'll have an error, i.e. no valid command id has 
	 * been generated
	 */
	g_return_val_if_fail (pattern != NULL, 0);
	g_return_val_if_fail (file != NULL, 0);

	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);

	/* get an unique cmd_id */
	cmd_id = get_unique_async_command_id ();
	
	/* create a new command */
	search_command = symbol_db_search_command_new (dbe, CMD_SEARCH_FILE, match_types, 
				include_types, info_fields, pattern, IANJUTA_SYMBOL_MANAGER_SEARCH_FS_IGNORE, 
	    		results_limit, 
	    		results_offset);

	/* don't forget to set the file too */
	symbol_db_search_command_set_file (search_command, file);	

	/* 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",
	                   GINT_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;
}
Exemplo n.º 18
0
static void
pull_dialog (Git *plugin)
{
	GtkBuilder *bxml;
	gchar *objects[] = {"pull_dialog", "remote_list_model", NULL};
	GError *error;
	GtkWidget *dialog;
	GtkWidget *pull_repository_vbox;
	GtkWidget *pull_remote_toggle;
	GtkWidget *pull_url_toggle;
	GtkWidget *pull_repository_notebook;
	GtkWidget *pull_origin_check;
	GtkListStore *remote_list_model;
	GitUIData *data;
	GitRemoteListCommand *remote_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, "pull_dialog"));
	pull_repository_vbox = GTK_WIDGET (gtk_builder_get_object (bxml,
	                                                           "pull_repository_vbox"));
	pull_remote_toggle = GTK_WIDGET (gtk_builder_get_object (bxml,
	                                                         "pull_remote_toggle"));
	pull_url_toggle = GTK_WIDGET (gtk_builder_get_object (bxml,
	                                                      "pull_url_toggle"));
	pull_repository_notebook = GTK_WIDGET (gtk_builder_get_object (bxml,
	                                                               "pull_repository_notebook"));
	pull_origin_check = GTK_WIDGET (gtk_builder_get_object (bxml, 
	                                                        "pull_origin_check"));
	remote_list_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,
	                                                            "remote_list_model"));
	data = git_ui_data_new (plugin, bxml);

	remote_list_command = git_remote_list_command_new (plugin->project_root_directory);

	g_object_set_data (G_OBJECT (remote_list_command), "origin-check", 
	                   pull_origin_check);

	g_signal_connect (G_OBJECT (remote_list_command), "data-arrived",
	                  G_CALLBACK (on_git_remote_list_command_data_arrived),
	                  remote_list_model);

	g_signal_connect (G_OBJECT (remote_list_command), "command-finished",
	                  G_CALLBACK (on_remote_list_command_finished),
	                  data);

	anjuta_command_start (ANJUTA_COMMAND (remote_list_command));
	
	g_signal_connect (G_OBJECT (dialog), "response", 
					  G_CALLBACK (on_pull_dialog_response), 
					  data);

	g_object_set_data (G_OBJECT (pull_remote_toggle), "tab-index",
	                   GINT_TO_POINTER (0));
	g_object_set_data (G_OBJECT (pull_url_toggle), "tab-index",
	                   GINT_TO_POINTER (1));

	g_signal_connect (G_OBJECT (pull_remote_toggle), "toggled",
	                  G_CALLBACK (on_git_notebook_button_toggled),
	                  pull_repository_notebook);

	g_signal_connect (G_OBJECT (pull_url_toggle), "toggled",
	                  G_CALLBACK (on_git_notebook_button_toggled),
	                  pull_repository_notebook);

	g_signal_connect (G_OBJECT (pull_origin_check), "toggled",
	                  G_CALLBACK (on_git_origin_check_toggled),
	                  pull_repository_vbox);
	
	gtk_widget_show_all (dialog);
}
Exemplo n.º 19
0
static void
on_pull_dialog_response (GtkDialog *dialog, gint response_id, 
						 GitUIData *data)
{
	GtkWidget *pull_remote_toggle;
	GtkWidget *pull_url_toggle;
	GtkWidget *pull_remote_view;
	GtkWidget *pull_origin_check;
	GtkWidget *pull_rebase_check;
	GtkWidget *pull_url_entry;
	GtkWidget *pull_no_commit_check;
	GtkWidget *pull_squash_check;
	GtkWidget *pull_fast_forward_commit_check;
	GtkWidget *pull_append_fetch_data_check;
	GtkWidget *pull_force_check;
	GtkWidget *pull_no_follow_tags_check;
	GtkTreeModel *remote_list_model;
	GtkWidget *input_widget;
	const gchar *input_error;
	gchar *url;
	GtkTreeSelection *selection;
	GtkTreeIter iter;
	GitPullCommand *pull_command;
	
	if (response_id == GTK_RESPONSE_OK)
	{	
		pull_remote_toggle = GTK_WIDGET (gtk_builder_get_object (data->bxml,
		                                                         "pull_remote_toggle"));
		pull_url_toggle = GTK_WIDGET (gtk_builder_get_object (data->bxml,
		                                                      "pull_url_toggle"));
		pull_remote_view = GTK_WIDGET (gtk_builder_get_object (data->bxml,
		                                                       "pull_remote_view"));
		pull_origin_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
		                                      					"pull_origin_check"));
		pull_rebase_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
		                                      					"pull_rebase_check"));
		pull_url_entry = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
		                                                     "pull_url_entry"));
		pull_no_commit_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																   "pull_no_commit_check"));
		pull_squash_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																"pull_squash_check"));
		pull_fast_forward_commit_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																			 "pull_fast_forward_commit_check"));
		pull_append_fetch_data_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																			"pull_append_fetch_data_check"));
		pull_force_check = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
															   "pull_force_check"));
		pull_no_follow_tags_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
																		"pull_no_follow_tags_check"));
		remote_list_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
		                                                            "remote_list_model"));
		
		/* The "input widget" is the widget that should receive focus if the
		 * user does not properly enter anything */
		input_error = _("Please select a remote to pull from.");
		input_widget = pull_remote_view;

		url = NULL;

		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_origin_check)))
			url = g_strdup ("origin");
		else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_remote_toggle)))
		{
			selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pull_remote_view));

			if (gtk_tree_selection_get_selected (selection, NULL, &iter))
				gtk_tree_model_get (remote_list_model, &iter, 0, &url, -1);
		}
		else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_url_toggle)))
		{
			url = gtk_editable_get_chars (GTK_EDITABLE (pull_url_entry), 0, -1);
			input_widget = pull_url_entry;
			input_error = _("Please enter the URL of the repository to pull from.");
		}
		
		if (!git_check_input (GTK_WIDGET (dialog), input_widget, url,
							  input_error))
		{
			g_free (url);
			return;
		}
		
		pull_command = git_pull_command_new (data->plugin->project_root_directory,
											 url,
		                                     gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_rebase_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_no_commit_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_squash_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_fast_forward_commit_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_append_fetch_data_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_force_check)),
											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_no_follow_tags_check)));
		
		g_free (url);
		
		git_create_message_view (data->plugin);
		
		g_signal_connect (G_OBJECT (pull_command), "command-finished",
						  G_CALLBACK (on_pull_command_finished),
						  data->plugin);
		
		g_signal_connect (G_OBJECT (pull_command), "data-arrived",
						  G_CALLBACK (on_git_command_info_arrived),
						  data->plugin);
		
		anjuta_command_start (ANJUTA_COMMAND (pull_command));
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
	git_ui_data_free (data);
}
Exemplo n.º 20
0
static void
on_ok_action_activated (GtkAction *action, GitPushPane *self)
{
    Git *plugin;
    GtkTreeModel *push_branch_model;
    GtkTreeModel *push_tag_model;
    GtkToggleButton *push_all_tags_check;
    GtkToggleButton *push_all_check;
    GtkToggleAction *force_action;
    GList *selected_items;
    gboolean push_all_tags;
    gboolean push_all;
    gchar *repository;
    GitPushCommand *push_command;

    plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
    push_branch_model = GTK_TREE_MODEL (gtk_builder_get_object (self->priv->builder,
                                        "push_branch_model"));
    push_tag_model = GTK_TREE_MODEL (gtk_builder_get_object (self->priv->builder,
                                     "push_tag_model"));
    push_all_tags_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
                          "push_all_tags_check"));
    push_all_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder,
                                        "push_all_check"));
    force_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder,
                                      "force_action"));
    selected_items = NULL;
    push_all_tags = gtk_toggle_button_get_active (push_all_tags_check);
    push_all = gtk_toggle_button_get_active (push_all_check);

    /* Check that the user has given a valid repository. In this case we only
     * care about checking if the selector widget is in URL mode, because even
     * if a remote isn't selected, it will default to origin, so we should
     * always get something when the selector is in Remote mode. */
    repository = git_repository_selector_get_repository (GIT_REPOSITORY_SELECTOR (self->priv->repository_selector));

    if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell),
                               self->priv->repository_selector, repository,
                               _("Please enter a URL.")))
    {
        g_free (repository);
        return;
    }

    if (!push_all)
    {
        /* Get selected branches */
        gtk_tree_model_foreach (push_branch_model,
                                (GtkTreeModelForeachFunc) get_selected_items,
                                &selected_items);
    }

    /* Don't bother getting selected tags if Push all tags is checked or if
     * Push all branches and tags is checked */
    if (!push_all && !push_all_tags)
    {
        /* Get selected tags */
        gtk_tree_model_foreach (push_tag_model,
                                (GtkTreeModelForeachFunc) get_selected_items,
                                &selected_items);
    }

    push_command = git_push_command_new (plugin->project_root_directory,
                                         repository, selected_items,
                                         push_all, push_all_tags,
                                         gtk_toggle_action_get_active (force_action));

    g_free (repository);
    anjuta_util_glist_strings_free (selected_items);

    git_pane_create_message_view (plugin);

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

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

    g_signal_connect (G_OBJECT (push_command), "command-finished",
                      G_CALLBACK (git_plugin_status_changed_emit),
                      plugin);

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

    anjuta_command_start (ANJUTA_COMMAND (push_command));

    git_pane_remove_from_dock (GIT_PANE (self));
}
Exemplo n.º 21
0
static void
on_rebase_dialog_response (GtkDialog *dialog, gint response_id, 
						   GitUIData *data)
{
	GtkWidget *rebase_branch_combo;
	GtkWidget *rebase_origin_check;
	GtkTreeModel *branch_combo_model;
	gchar *branch;
	GtkTreeIter iter;
	GitRebaseStartCommand *rebase_command;
	GitProgressData *progress_data;
	
	if (response_id == GTK_RESPONSE_OK)
	{	
		rebase_branch_combo = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
																  "rebase_branch_combo"));
		rebase_origin_check = GTK_WIDGET (gtk_builder_get_object (data->bxml,
		                                        				  "rebase_origin_check"));
		branch_combo_model = GTK_TREE_MODEL (gtk_builder_get_object (data->bxml,
		                                                             "branch_combo_model"));

		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rebase_origin_check)))
		    branch = g_strdup ("origin");
		else
		{
			gtk_combo_box_get_active_iter (GTK_COMBO_BOX (rebase_branch_combo), 
										   &iter);
			gtk_tree_model_get (branch_combo_model, &iter, 0, &branch, -1);
		}

		rebase_command = git_rebase_start_command_new (data->plugin->project_root_directory,
													   branch);
		progress_data = git_progress_data_new (data->plugin,
											   _("Git: Rebasing"));
		
		g_free (branch);
		
		git_create_message_view (data->plugin);
		
		g_signal_connect (G_OBJECT (rebase_command), "command-finished",
						  G_CALLBACK (on_git_command_finished),
						  data->plugin);
		
		g_signal_connect (G_OBJECT (rebase_command), "data-arrived",
						  G_CALLBACK (on_git_command_info_arrived),
						  data->plugin);
		
		g_signal_connect (G_OBJECT (rebase_command), "progress",
						  G_CALLBACK (on_git_command_progress),
						  data->plugin);
		
		g_signal_connect_swapped (G_OBJECT (rebase_command), 
								  "command-finished",
								  G_CALLBACK (git_progress_data_free),
								  progress_data);
		
		anjuta_command_start (ANJUTA_COMMAND (rebase_command));
	}
	
	gtk_widget_destroy (GTK_WIDGET (dialog));
	git_ui_data_free (data);
}
Exemplo n.º 22
0
static void
subversion_commit_dialog (GtkAction* action, Subversion* plugin, 
						  gchar *filename)
{
	GtkBuilder* bxml = gtk_builder_new ();
	GtkWidget* dialog; 
	GtkWidget *logtext; 
	GtkWidget *commit_select_all_button;
	GtkWidget *commit_clear_button;
	GtkWidget *commit_status_view;
	GtkWidget *commit_status_progress_bar;
	GtkWidget *commit_prev_msg_enable;
	GtkWidget *commit_prev_msg_combo;
	GtkCellRenderer *cell;
  	GtkListStore *store;
	SvnStatusCommand *status_command;
	SubversionData* data;
	GError* error = NULL;

	if (!gtk_builder_add_from_file (bxml, GLADE_FILE, &error))
	{
		g_warning ("Couldn't load builder file: %s", error->message);
		g_error_free (error);
	}
	
	dialog = GTK_WIDGET (gtk_builder_get_object (bxml, "subversion_commit"));
	commit_select_all_button = GTK_WIDGET (gtk_builder_get_object (bxml, 
													 "commit_select_all_button"));
	commit_clear_button = GTK_WIDGET (gtk_builder_get_object (bxml,
												"commit_clear_button"));
	commit_status_view = GTK_WIDGET (gtk_builder_get_object (bxml, "commit_status_view"));
	commit_status_progress_bar = GTK_WIDGET (gtk_builder_get_object (bxml,
													   "commit_status_progress_bar"));
	logtext = GTK_WIDGET (gtk_builder_get_object (bxml, "subversion_log_view"));
	status_command = svn_status_command_new (plugin->project_root_dir, 
											 TRUE, TRUE);
	commit_prev_msg_enable = GTK_WIDGET (gtk_builder_get_object (bxml,
													   "commit_prev_msg_enable"));
	commit_prev_msg_combo = GTK_WIDGET (gtk_builder_get_object (bxml,
													   "commit_prev_msg_combo"));
													   
	g_signal_connect (G_OBJECT (commit_select_all_button), "clicked",
					  G_CALLBACK (select_all_status_items),
					  commit_status_view);
	
	g_signal_connect (G_OBJECT (commit_clear_button), "clicked",
					  G_CALLBACK (clear_all_status_selections),
					  commit_status_view);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (select_all_files),
					  commit_status_view);
	
	g_signal_connect(G_OBJECT (commit_prev_msg_enable), "toggled",
	                 G_CALLBACK(on_prev_message_enable_clicked),
	                 logtext);

	pulse_progress_bar (GTK_PROGRESS_BAR (commit_status_progress_bar));
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (cancel_data_arrived_signal_disconnect),
					  commit_status_view);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (hide_pulse_progress_bar),
					  commit_status_progress_bar);
	
	g_signal_connect (G_OBJECT (status_command), "command-finished",
					  G_CALLBACK (on_status_command_finished),
					  NULL);
	
	g_signal_connect (G_OBJECT (status_command), "data-arrived",
					  G_CALLBACK (on_status_command_data_arrived),
					  commit_status_view);
	
	g_object_weak_ref (G_OBJECT (commit_status_view),
					   (GWeakNotify) disconnect_data_arrived_signals,
					   status_command);
	
	anjuta_command_start (ANJUTA_COMMAND (status_command));
	
	data = subversion_data_new(plugin, bxml);
	g_signal_connect(G_OBJECT(dialog), "response", 
		G_CALLBACK(on_subversion_commit_response), data);
	
	store = gtk_list_store_new (1, G_TYPE_STRING);
	cell = gtk_cell_renderer_text_new ();
  	gtk_cell_layout_clear(GTK_CELL_LAYOUT(commit_prev_msg_combo));
    gtk_combo_box_set_model(GTK_COMBO_BOX(commit_prev_msg_combo), NULL);                              
	gtk_combo_box_set_model(GTK_COMBO_BOX(commit_prev_msg_combo), GTK_TREE_MODEL(store));
	
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (commit_prev_msg_combo), cell, FALSE);
	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (commit_prev_msg_combo), cell,
                                  "text", 0,
                                  NULL);
	g_object_unref (store);
	
	gtk_widget_show_all (dialog);
	
	
	
	g_list_foreach(plugin->svn_commit_logs, subversion_commit_dialog_populate_logs, commit_prev_msg_combo);
	gtk_combo_box_set_active(GTK_COMBO_BOX(commit_prev_msg_combo), 0);
}
Exemplo n.º 23
0
static guint
git_log_command_run (AnjutaCommand *command)
{
	GitLogCommand *self;
	gchar *filter_arg;
	GString *commit_range;
	
	self = GIT_LOG_COMMAND (command);
	
	git_command_add_arg (GIT_COMMAND (command), "rev-list");
	git_command_add_arg (GIT_COMMAND (command), "--topo-order");
	git_command_add_arg (GIT_COMMAND (command), "--pretty=format:parents %P%n"
												"author %an%n"
												"time %at%n"
												"short log %s%n"
												"\x0c");
	
	if (self->priv->author)
	{
		filter_arg = g_strdup_printf ("--author=%s", self->priv->author);
		git_command_add_arg (GIT_COMMAND (command), filter_arg);
		g_free (filter_arg);
	}
	
	if (self->priv->grep)
	{
		filter_arg = g_strdup_printf ("--grep=%s", self->priv->grep);
		git_command_add_arg (GIT_COMMAND (command), filter_arg);
		g_free (filter_arg);
	}
	
	if (self->priv->since_date)
	{
		filter_arg = g_strdup_printf ("--since=%s", self->priv->since_date);
		git_command_add_arg (GIT_COMMAND (command), filter_arg);
		g_free (filter_arg);
	}
	
	if (self->priv->until_date)
	{
		filter_arg = g_strdup_printf ("--until=%s", self->priv->until_date);
		git_command_add_arg (GIT_COMMAND (command), filter_arg);
		g_free (filter_arg);
	}
	
	if (self->priv->since_commit || self->priv->until_commit)
	{
		commit_range = g_string_new ("");
		
		/* Not the most elegant way of doing it... */
		if (self->priv->since_commit)
			g_string_append (commit_range, self->priv->since_commit);
		
		g_string_append (commit_range, "..");
		
		if (self->priv->until_commit)
			g_string_append (commit_range, self->priv->until_commit);
		
		git_command_add_arg (GIT_COMMAND (command), commit_range->str);
		
		g_string_free (commit_range, TRUE);
	}

	if (self->priv->branch)
		git_command_add_arg (GIT_COMMAND (command), self->priv->branch);
	else
		git_command_add_arg (GIT_COMMAND (command), "HEAD");
	
	if (self->priv->path)
	{
		git_command_add_arg (GIT_COMMAND (command), "--");
		git_command_add_arg (GIT_COMMAND (command), self->priv->path);
	}

	/* Start the data processing task */
	anjuta_command_start (ANJUTA_COMMAND (self->priv->data_command));
	
	return 0;
}
Exemplo n.º 24
0
static void
on_subversion_commit_response(GtkDialog* dialog, gint response, 
							  SubversionData* data)
{	
	switch (response)
	{
		case GTK_RESPONSE_OK:
		{
			gchar* log;
			GtkWidget* logtext;
			GtkWidget* norecurse;
			GtkWidget* commit_prev_msg_enable;
			GtkWidget* commit_prev_msg_combo;
			GtkWidget *commit_status_view;
			GList *selected_paths;
			SvnCommitCommand *commit_command;
			guint pulse_timer_id;
			gboolean msg_enable_selected;
			
			logtext = GTK_WIDGET (gtk_builder_get_object (data->bxml, "subversion_log_view"));
			commit_prev_msg_enable = GTK_WIDGET (gtk_builder_get_object (data->bxml, "commit_prev_msg_enable"));
			
			log = get_log_from_textview(logtext);
			msg_enable_selected = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(commit_prev_msg_enable));
			
			if (!g_utf8_strlen(log, -1) && (msg_enable_selected == FALSE))
			{
				gint result;
				GtkWidget* dlg = gtk_message_dialog_new(GTK_WINDOW(dialog), 
														GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
														GTK_BUTTONS_YES_NO, 
														_("Are you sure that you want to pass an empty log message?"));
				result = gtk_dialog_run(GTK_DIALOG(dlg));
				gtk_widget_destroy(dlg);
				if (result == GTK_RESPONSE_NO)
					break;
			}
			
			commit_prev_msg_combo = GTK_WIDGET (gtk_builder_get_object (data->bxml, "commit_prev_msg_combo"));
													   
			norecurse = GTK_WIDGET (gtk_builder_get_object (data->bxml, "subversion_commit_norecurse"));
			
			commit_status_view = GTK_WIDGET (gtk_builder_get_object (data->bxml, 
													   "commit_status_view"));
			
			selected_paths = anjuta_vcs_status_tree_view_get_selected (ANJUTA_VCS_STATUS_TREE_VIEW (commit_status_view));

			
			if (msg_enable_selected == TRUE)
			{
				commit_command = svn_commit_command_new (selected_paths, 
													 gtk_combo_box_get_active_text(GTK_COMBO_BOX(commit_prev_msg_combo)),
													 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(norecurse)));
			}
			else
			{
				commit_command = svn_commit_command_new (selected_paths, 
													 (gchar *) log,
													 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(norecurse)));
			}
			
			svn_command_free_path_list (selected_paths);
			
			create_message_view (data->plugin);
		
			pulse_timer_id = status_bar_progress_pulse (data->plugin,
														_("Subversion: " 
														  "Committing changes "
														  "to the "
														  "repository…"));
			
			g_signal_connect (G_OBJECT (commit_command), "command-finished",
							  G_CALLBACK (stop_status_bar_progress_pulse),
							  GUINT_TO_POINTER (pulse_timer_id));
			
			g_signal_connect (G_OBJECT (commit_command), "command-finished",
							  G_CALLBACK (on_commit_command_finished),
							  data->plugin);
			
			g_signal_connect (G_OBJECT (commit_command), "data-arrived",
							  G_CALLBACK (on_command_info_arrived),
							  data->plugin);
			
			anjuta_command_start (ANJUTA_COMMAND (commit_command));
			
			if (g_utf8_strlen(log, -1) && msg_enable_selected == FALSE)
				data->plugin->svn_commit_logs = subversion_commit_prepend_log(data->plugin->svn_commit_logs, log);
				
			subversion_data_free(data);
			gtk_widget_destroy (GTK_WIDGET(dialog));
			break;
		}
		default:
		{
			subversion_data_free(data);
			gtk_widget_destroy(GTK_WIDGET(dialog));
			break;
		}
	}
}
Exemplo n.º 25
0
static void
on_status_view_drag_data_received (GtkWidget *widget,
                            	   GdkDragContext *context, gint x, gint y,
                                   GtkSelectionData *data, guint target_type,
                                   guint time, GitStatusPane *self)
{
	Git *plugin;
	gboolean success;
	gchar **uri_list;
	int i;
	GFile *file;
	gchar *path;
	GList *paths;
	GitAddCommand *add_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	success = FALSE;
	path = NULL;
	paths = NULL;

	if ((data != NULL) && 
	    (gtk_selection_data_get_length (data) >= 0))
	{
		if (target_type == 0)
		{
			uri_list = gtk_selection_data_get_uris (data);

			for (i = 0; uri_list[i]; i++)
			{
				file = g_file_new_for_uri (uri_list[i]);
				path = g_file_get_path (file);

				if (path && !g_file_test (path, G_FILE_TEST_IS_DIR))
				{
					paths = g_list_append (paths, 
					                       g_strdup (path +
					                                 strlen (plugin->project_root_directory) + 1));
				}

				g_free (path);
				g_object_unref (file);
			}


			add_command = git_add_command_new_list (plugin->project_root_directory,
			                                        paths, FALSE);

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

			anjuta_command_start (ANJUTA_COMMAND (add_command));
			success = TRUE;

			anjuta_util_glist_strings_free (paths);
			g_strfreev (uri_list);
		}
	}

	/* Do not delete source data */
	gtk_drag_finish (context, success, FALSE, time);
}