void on_diff_button_clicked (GtkAction *action, Git *plugin) { IAnjutaDocumentManager *document_manager; IAnjutaEditor *editor; GitDiffCommand *diff_command; document_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell, IAnjutaDocumentManager, NULL); editor = ianjuta_document_manager_add_buffer (document_manager,/* Translators: default file name for git diff's output */ _("Uncommitted Changes.diff"), "", NULL); diff_command = git_diff_command_new (plugin->project_root_directory); g_signal_connect (G_OBJECT (diff_command), "data-arrived", G_CALLBACK (git_pane_send_raw_output_to_editor), editor); g_signal_connect (G_OBJECT (diff_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (diff_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (diff_command)); }
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)); } }