1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) James Liggett 2008 <jrliggett@cox.net>
6 * anjuta is free software.
8 * You may redistribute it and/or modify it under the terms of the
9 * GNU General Public License, as published by the Free Software
10 * Foundation; either version 2 of the License, or (at your option)
13 * anjuta is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with anjuta. If not, write to:
20 * The Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02110-1301, USA.
25 #include "git-rebase-dialog.h"
28 on_rebase_dialog_response (GtkDialog
*dialog
, gint response_id
,
29 GitBranchComboData
*data
)
31 GtkWidget
*rebase_branch_combo
;
34 GitRebaseStartCommand
*rebase_command
;
35 GitProgressData
*progress_data
;
37 if (response_id
== GTK_RESPONSE_OK
)
39 rebase_branch_combo
= glade_xml_get_widget (data
->gxml
,
40 "rebase_branch_combo");
42 gtk_combo_box_get_active_iter (GTK_COMBO_BOX (rebase_branch_combo
),
44 branch
= git_branch_combo_model_get_branch (data
->model
, &iter
);
46 rebase_command
= git_rebase_start_command_new (data
->plugin
->project_root_directory
,
48 progress_data
= git_progress_data_new (data
->plugin
,
53 git_create_message_view (data
->plugin
);
55 g_signal_connect (G_OBJECT (rebase_command
), "command-finished",
56 G_CALLBACK (on_git_command_finished
),
59 g_signal_connect (G_OBJECT (rebase_command
), "data-arrived",
60 G_CALLBACK (on_git_command_info_arrived
),
63 g_signal_connect (G_OBJECT (rebase_command
), "progress",
64 G_CALLBACK (on_git_command_progress
),
67 g_signal_connect_swapped (G_OBJECT (rebase_command
),
69 G_CALLBACK (git_progress_data_free
),
72 anjuta_command_start (ANJUTA_COMMAND (rebase_command
));
75 gtk_widget_destroy (GTK_WIDGET (dialog
));
76 git_branch_combo_data_free (data
);
80 rebase_dialog (Git
*plugin
)
84 GtkWidget
*rebase_branch_combo
;
85 GtkListStore
*branch_list_store
;
86 GitBranchComboData
*data
;
87 GitBranchListCommand
*list_command
;
89 gxml
= glade_xml_new (GLADE_FILE
, "rebase_dialog", NULL
);
91 dialog
= glade_xml_get_widget (gxml
, "rebase_dialog");
92 rebase_branch_combo
= glade_xml_get_widget (gxml
, "rebase_branch_combo");
93 branch_list_store
= git_branch_combo_model_new ();
95 gtk_combo_box_set_model (GTK_COMBO_BOX (rebase_branch_combo
),
96 GTK_TREE_MODEL (branch_list_store
));
97 git_branch_combo_model_setup_widget (rebase_branch_combo
);
99 data
= git_branch_combo_data_new (branch_list_store
,
100 GTK_COMBO_BOX (rebase_branch_combo
), gxml
,
103 list_command
= git_branch_list_command_new (plugin
->project_root_directory
,
104 GIT_BRANCH_TYPE_REMOTE
);
106 g_signal_connect (G_OBJECT (list_command
), "data-arrived",
107 G_CALLBACK (on_git_list_branch_command_data_arrived
),
110 g_signal_connect (G_OBJECT (list_command
), "command-finished",
111 G_CALLBACK (on_git_list_branch_command_finished
),
114 anjuta_command_start (ANJUTA_COMMAND (list_command
));
116 g_signal_connect (G_OBJECT (dialog
), "response",
117 G_CALLBACK (on_rebase_dialog_response
),
120 gtk_widget_show_all (dialog
);
124 rebase_continue (Git
*plugin
, GitRebaseContinueAction action
)
126 GitRebaseContinueCommand
*rebase_command
;
128 git_create_message_view (plugin
);
130 rebase_command
= git_rebase_continue_command_new (plugin
->project_root_directory
,
133 g_signal_connect (G_OBJECT (rebase_command
), "command-finished",
134 G_CALLBACK (on_git_command_finished
),
137 g_signal_connect (G_OBJECT (rebase_command
), "data-arrived",
138 G_CALLBACK (on_git_command_info_arrived
),
141 anjuta_command_start (ANJUTA_COMMAND (rebase_command
));
145 on_menu_git_rebase_start (GtkAction
*action
, Git
*plugin
)
147 rebase_dialog (plugin
);
151 on_menu_git_rebase_continue (GtkAction
*action
, Git
*plugin
)
153 rebase_continue (plugin
, GIT_REBASE_CONTINUE_ACTION_CONTINUE
);
157 on_menu_git_rebase_skip (GtkAction
*action
, Git
*plugin
)
159 rebase_continue (plugin
, GIT_REBASE_CONTINUE_ACTION_SKIP
);
163 on_menu_git_rebase_abort (GtkAction
*action
, Git
*plugin
)
165 rebase_continue (plugin
, GIT_REBASE_CONTINUE_ACTION_ABORT
);