Example #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);
}
Example #2
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));
	}
	
}
Example #3
0
static void
on_ok_action_activated (GtkAction *action, GitAddFilesPane *self)
{
	Git *plugin;
	AnjutaFileList *add_file_list;
	GtkToggleAction *force_action;
	GList *paths;
	GitAddCommand *add_command;

	plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
	add_file_list = ANJUTA_FILE_LIST (gtk_builder_get_object (self->priv->builder,
	                                                  		  "add_file_list"));
	force_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder,
	                                                          "force_action"));
	paths = anjuta_file_list_get_paths (add_file_list);
	add_command = git_add_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 (add_command), "command-finished",
	                  G_CALLBACK (git_pane_report_errors),
	                  plugin);


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

	anjuta_command_start (ANJUTA_COMMAND (add_command));

	git_pane_remove_from_dock (GIT_PANE (self));
}
Example #4
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);
}