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-create-branch-dialog.h"
28 on_checkout_command_finished (AnjutaCommand
*command
, guint return_code
,
33 gchar
*status_message
;
37 status
= anjuta_shell_get_status (ANJUTA_PLUGIN (plugin
)->shell
,
40 branch_name
= git_branch_create_command_get_branch_name (GIT_BRANCH_CREATE_COMMAND (command
));
41 status_message
= g_strdup_printf (_("Git: Created branch \"%s\"."),
43 anjuta_status (status
, status_message
, 5);
46 g_free (status_message
);
51 report_errors (command
, return_code
);
53 g_object_unref (command
);
58 on_create_branch_dialog_response (GtkDialog
*dialog
, gint response_id
,
61 GtkWidget
*branch_name_entry
;
62 GtkWidget
*checkout_check
;
65 GitBranchCreateCommand
*create_command
;
67 if (response_id
== GTK_RESPONSE_OK
)
69 branch_name_entry
= glade_xml_get_widget (data
->gxml
,
71 checkout_check
= glade_xml_get_widget (data
->gxml
, "checkout_check");
72 branch_name
= gtk_editable_get_chars (GTK_EDITABLE (branch_name_entry
),
74 checkout
= gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkout_check
));
76 create_command
= git_branch_create_command_new (data
->plugin
->project_root_directory
,
82 create_message_view (data
->plugin
);
84 g_signal_connect (G_OBJECT (create_command
), "command-finished",
85 G_CALLBACK (on_checkout_command_finished
),
88 g_signal_connect (G_OBJECT (create_command
), "data-arrived",
89 G_CALLBACK (on_command_info_arrived
),
92 anjuta_command_start (ANJUTA_COMMAND (create_command
));
95 gtk_widget_destroy (GTK_WIDGET (dialog
));
96 git_ui_data_free (data
);
100 create_branch_dialog (Git
*plugin
)
106 gxml
= glade_xml_new (GLADE_FILE
, "create_branch_dialog", NULL
);
107 dialog
= glade_xml_get_widget (gxml
, "create_branch_dialog");
108 data
= git_ui_data_new (plugin
, gxml
);
110 g_signal_connect (G_OBJECT (dialog
), "response",
111 G_CALLBACK (on_create_branch_dialog_response
),
114 gtk_widget_show_all (dialog
);
118 on_menu_git_create_branch (GtkAction
*action
, Git
*plugin
)
120 create_branch_dialog (plugin
);