Esempio n. 1
0
static void
on_stash_list_command_data_arrived (AnjutaCommand *command, 
                                    GtkListStore *stash_list_model)
{
	GQueue *output;
	GtkTreeIter iter;
	GitStash *stash;
	guint number;
	gchar *message;
	gchar *id;
	
	output = git_stash_list_command_get_output (GIT_STASH_LIST_COMMAND (command));

	while (g_queue_peek_head (output))
	{
		gtk_list_store_append (stash_list_model, &iter);

		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_list_store_set (stash_list_model, &iter, 
		                    COL_NUMBER, number,
		                    COL_MESSAGE, message,
		                    COL_ID, id,
		                    -1);

		g_object_unref (stash);
		g_free (message);
		g_free (id);
	}
}
Esempio n. 2
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);
	}
}