示例#1
0
static void
add_status_items (GQueue *output, GtkTreeStore *status_model, 
                  GtkTreeIter *parent_iter, StatusType type)
{
	GitStatus *status_object;
	AnjutaVcsStatus status;
	gchar *path;
	GtkTreeIter iter;

	while (g_queue_peek_head (output))
	{
		status_object = g_queue_pop_head (output);
		status = git_status_get_vcs_status (status_object);
		path = git_status_get_path (status_object);

		gtk_tree_store_append (status_model, &iter, parent_iter);
		gtk_tree_store_set (status_model, &iter,
		                    COL_SELECTED, FALSE,
		                    COL_STATUS, status,
		                    COL_PATH, path,
		                    COL_TYPE, type,
		                    -1);

		g_free (path);
		g_object_unref (status_object);
	}
}
示例#2
0
static void
on_status_command_data_arrived (AnjutaCommand *command, 
								IAnjutaVcsStatusCallback callback)
{
	GQueue *status_queue;
	GitStatus *status;
	gchar *path;
	gchar *full_path;
	GFile *file;
	
	status_queue = git_status_command_get_status_queue (GIT_STATUS_COMMAND (command));
	
	while (g_queue_peek_head (status_queue))
	{
		status = g_queue_pop_head (status_queue);

		if (git_status_is_working_directory_descendant (status))
		{
			path = git_status_get_path (status);
			full_path = g_strconcat (g_object_get_data (G_OBJECT (command), "working-directory"),
			                         G_DIR_SEPARATOR_S, path, NULL);
			file = g_file_new_for_path (full_path);

			DEBUG_PRINT ("Working directory: %s\n", (gchar *) g_object_get_data (G_OBJECT (command), "working-directory"));
			DEBUG_PRINT ("File %s Status %i\n", full_path, git_status_get_vcs_status (status));

			if (file)
			{
				callback (file, 
				          git_status_get_vcs_status (status),
				          g_object_get_data (G_OBJECT (command), "user-data"));

				g_object_unref (file);
			}

			g_free (path);
			g_free (full_path);
		}
		
		g_object_unref (status);
		
	}
}