Esempio n. 1
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));
}
Esempio n. 2
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);
}