30
#include "bazaar-list-command-removed.h"
30
#include "bzr-removed-cmd.h"
32
struct _BazaarListRemovedCommandPriv
32
struct _BzrRemovedCmdPriv
36
G_DEFINE_TYPE (BazaarListRemovedCommand, bazaar_list_removed_command, BAZAAR_TYPE_LIST_COMMAND);
38
G_DEFINE_TYPE (BzrRemovedCmd, bzr_removed_cmd, BZR_TYPE_CMD);
39
bazaar_list_removed_command_init (BazaarListRemovedCommand *self)
41
bzr_removed_cmd_init (BzrRemovedCmd *self)
41
self->priv = g_new0 (BazaarListRemovedCommandPriv, 1);
43
self->priv = g_new0 (BzrRemovedCmdPriv, 1);
44
BazaarListRemovedCommand*
45
bazaar_list_removed_command_new (const gchar *working_dir)
47
bzr_removed_cmd_new (const gchar *working_dir, GFunc user_func, gpointer user_data)
47
BazaarListRemovedCommand *command;
49
BzrRemovedCmd *command;
49
command = g_object_new (BAZAAR_TYPE_LIST_REMOVED_COMMAND,
51
command = g_object_new (BZR_TYPE_REMOVED_CMD,
50
52
"working-directory", working_dir,
51
53
"single-line-output", TRUE,
56
command->priv->user_func = user_func;
57
command->priv->user_data = user_data;
58
bazaar_list_removed_command_finalize (GObject *object)
63
bzr_removed_cmd_finalize (GObject *object)
60
BazaarListRemovedCommand *command = NULL;
65
BzrRemovedCmd *command = NULL;
62
command = BAZAAR_LIST_REMOVED_COMMAND (object);
67
command = BZR_REMOVED_CMD (object);
64
69
g_free (command->priv);
66
G_OBJECT_CLASS (bazaar_list_removed_command_parent_class)->finalize (object);
71
G_OBJECT_CLASS (bzr_removed_cmd_parent_class)->finalize (object);
70
bazaar_list_removed_command_run (AnjutaCommand *command)
75
bzr_removed_cmd_run (AnjutaCommand *command)
72
BazaarListRemovedCommand *self = NULL;
77
BzrRemovedCmd *self = NULL;
74
self = BAZAAR_LIST_REMOVED_COMMAND (command);
79
self = BZR_REMOVED_CMD (command);
76
bazaar_command_add_arg (BAZAAR_COMMAND (self), "status");
77
bazaar_command_add_arg (BAZAAR_COMMAND (self), "-S");
78
bazaar_command_add_arg (BAZAAR_COMMAND (self), "|");
79
bazaar_command_add_arg (BAZAAR_COMMAND (self), "awk");
80
bazaar_command_add_arg (BAZAAR_COMMAND (self), "'/^-D/ {print $2}'");
81
bzr_cmd_add_arg (BZR_CMD (self), "status");
82
bzr_cmd_add_arg (BZR_CMD (self), "-S");
83
bzr_cmd_add_arg (BZR_CMD (self), "|");
84
bzr_cmd_add_arg (BZR_CMD (self), "awk");
85
bzr_cmd_add_arg (BZR_CMD (self), "'/^-D/ {print $2}'");
90
void removed_output_handler (BzrCmd *cmd, const gchar *filename)
92
if (strcmp (filename, "") != 0)
94
BZR_REMOVED_CMD (cmd)->priv->user_func (filename, BZR_REMOVED_CMD (cmd)->priv->user_data);
86
bazaar_list_removed_command_class_init (BazaarListRemovedCommandClass *klass)
99
bzr_removed_cmd_class_init (BzrRemovedCmdClass *klass)
88
101
GObjectClass *object_class = NULL;
102
BzrCmdClass *parent_class = NULL;
89
103
AnjutaCommandClass *command_class = NULL;
91
105
object_class = G_OBJECT_CLASS (klass);
106
parent_class = BZR_CMD_CLASS (klass);
92
107
command_class = ANJUTA_COMMAND_CLASS (klass);
94
object_class->finalize = bazaar_list_removed_command_finalize;
95
command_class->run = bazaar_list_removed_command_run;
109
object_class->finalize = bzr_removed_cmd_finalize;
110
command_class->run = bzr_removed_cmd_run;
111
parent_class->output_handler = removed_output_handler;
99
bazaar_list_removed_command_destroy (BazaarListRemovedCommand *self)
115
bzr_removed_cmd_destroy (BzrRemovedCmd *self)
101
117
g_object_unref (self);
121
bzr_removed_cmd_finished (AnjutaCommand *command, guint return_code,
124
g_object_unref (command);
127
void bzr_removed_cmd_execute (const gchar *working_dir, GFunc user_func, gpointer user_data)
129
BzrRemovedCmd *cmd = NULL;
131
cmd = bzr_removed_cmd_new (working_dir, user_func, user_data);
133
g_signal_connect (G_OBJECT (cmd), "command-finished",
134
G_CALLBACK (bzr_removed_cmd_finished), NULL);
136
anjuta_command_start (ANJUTA_COMMAND (cmd));