static void on_ok_button_clicked (GtkButton *button, GitCheckoutPane *self) { Git *plugin; GtkToggleButton *force_check; GList *paths; GitCheckoutFilesCommand *checkout_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); force_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "force_check")); paths = git_status_pane_get_selected_not_updated_items (GIT_STATUS_PANE (plugin->status_pane), ANJUTA_VCS_STATUS_ALL); checkout_command = git_checkout_files_command_new (plugin->project_root_directory, paths, gtk_toggle_button_get_active (force_check)); anjuta_util_glist_strings_free (paths); g_signal_connect (G_OBJECT (checkout_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (checkout_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (checkout_command)); git_pane_remove_from_dock (GIT_PANE (self)); }
static void on_ok_action_activated (GtkAction *action, GitRemoveFilesPane *self) { Git *plugin; AnjutaFileList *remove_file_list; GtkToggleAction *force_action; GList *paths; GitRemoveCommand *remove_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); remove_file_list = ANJUTA_FILE_LIST (gtk_builder_get_object (self->priv->builder, "remove_file_list")); force_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder, "force_action")); paths = anjuta_file_list_get_paths (remove_file_list); remove_command = git_remove_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 (remove_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (remove_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (remove_command)); git_pane_remove_from_dock (GIT_PANE (self)); }
static gboolean on_stash_view_button_press_event (GtkWidget *stash_view, GdkEventButton *event, GitStashPane *self) { gboolean path_valid; GtkTreePath *path; gboolean ret = FALSE; path_valid = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (stash_view), event->x, event->y, &path, NULL, NULL, NULL); if (event->type == GDK_BUTTON_PRESS && event->button == 3) { if (path_valid && gtk_tree_path_get_depth (path) == 1) { git_pane_popup_menu (GIT_PANE (self), "GitStashPopup", event->button, event->time); } } /* Don't forward button presses to diff renderers */ if (path_valid) { ret = gtk_tree_path_get_depth (path) == 2; gtk_tree_path_free (path); } return ret; }
static void on_ok_action_activated (GtkAction *action, GitResetPane *self) { Git *plugin; AnjutaEntry *reset_revision_entry; GtkToggleButton *mixed_radio; GtkToggleButton *soft_radio; const gchar *revision; GitResetTreeMode mode; GitResetTreeCommand *reset_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); reset_revision_entry = ANJUTA_ENTRY (gtk_builder_get_object (self->priv->builder, "reset_revision_entry")); mixed_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "mixed_radio")); soft_radio = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "soft_radio")); revision = anjuta_entry_get_text (reset_revision_entry); if (g_utf8_strlen (revision, -1) == 0) revision = GIT_RESET_TREE_PREVIOUS; if (gtk_toggle_button_get_active (mixed_radio)) mode = GIT_RESET_TREE_MODE_MIXED; else if (gtk_toggle_button_get_active (soft_radio)) mode = GIT_RESET_TREE_MODE_SOFT; else mode = GIT_RESET_TREE_MODE_HARD; reset_command = git_reset_tree_command_new (plugin->project_root_directory, revision, mode); g_signal_connect (G_OBJECT (reset_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (reset_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (reset_command)); git_pane_remove_from_dock (GIT_PANE (self)); }
static void on_ok_action_activated (GtkAction *action, GitStashChangesPane *self) { Git *plugin; AnjutaColumnTextView *message_view; GtkToggleButton *stash_index_check; gchar *message; GitStashSaveCommand *save_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); message_view = ANJUTA_COLUMN_TEXT_VIEW (gtk_builder_get_object (self->priv->builder, "message_view")); stash_index_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "stash_index_check")); message = anjuta_column_text_view_get_text (message_view); /* Don't pass an empty message */ if (!g_utf8_strlen (message, -1)) { g_free (message); message = NULL; } save_command = git_stash_save_command_new (plugin->project_root_directory, gtk_toggle_button_get_active (stash_index_check), message); g_free (message); g_signal_connect (G_OBJECT (save_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (save_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (save_command)); git_pane_remove_from_dock (GIT_PANE (self)); }
static gboolean on_stash_view_button_press_event (GtkWidget *stash_view, GdkEventButton *event, GitStashPane *self) { GtkTreeSelection *selection; if (event->type == GDK_BUTTON_PRESS && event->button == 3) { selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (stash_view)); if (gtk_tree_selection_count_selected_rows (selection) > 0) { git_pane_popup_menu (GIT_PANE (self), "GitStashPopup", event->button, event->time); } } return FALSE; }
static void on_ok_action_activated (GtkAction *action, GitDeleteBranchesPane *self) { Git *plugin; GtkToggleButton *require_merged_check; GList *selected_local_branches; GList *selected_remote_branches; GitBranchDeleteCommand *local_delete_command; GitBranchDeleteCommand *remote_delete_command; AnjutaCommandQueue *queue; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); require_merged_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "require_merged_check")); selected_local_branches = git_branches_pane_get_selected_local_branches (GIT_BRANCHES_PANE (plugin->branches_pane)); selected_remote_branches = git_branches_pane_get_selected_remote_branches (GIT_BRANCHES_PANE (plugin->branches_pane)); /* The user might not have selected anything */ if (git_branches_pane_count_selected_items (GIT_BRANCHES_PANE (plugin->branches_pane)) > 0) { queue = anjuta_command_queue_new (ANJUTA_COMMAND_QUEUE_EXECUTE_MANUAL); if (selected_local_branches) { local_delete_command = git_branch_delete_command_new (plugin->project_root_directory, selected_local_branches, FALSE, gtk_toggle_button_get_active (require_merged_check)); anjuta_util_glist_strings_free (selected_local_branches); g_signal_connect (G_OBJECT (local_delete_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (local_delete_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_push (queue, ANJUTA_COMMAND (local_delete_command)); } if (selected_remote_branches) { remote_delete_command = git_branch_delete_command_new (plugin->project_root_directory, selected_remote_branches, TRUE, gtk_toggle_button_get_active (require_merged_check)); anjuta_util_glist_strings_free (selected_remote_branches); g_signal_connect (G_OBJECT (remote_delete_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (remote_delete_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_push (queue, ANJUTA_COMMAND (remote_delete_command)); } /* Run the commands */ g_signal_connect (G_OBJECT (queue), "finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_queue_start (queue); } git_pane_remove_from_dock (GIT_PANE (self)); }
static void on_ok_action_activated (GtkAction *action, GitMergePane *self) { Git *plugin; GtkEditable *merge_revision_entry; GtkToggleAction *no_commit_action; GtkToggleAction *squash_action; GtkToggleButton *use_custom_log_check; gchar *revision; gchar *log; AnjutaColumnTextView *merge_log_view; GitMergeCommand *merge_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); merge_revision_entry = GTK_EDITABLE (gtk_builder_get_object (self->priv->builder, "merge_revision_entry")); no_commit_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder, "no_commit_action")); squash_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder, "squash_action")); use_custom_log_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "use_custom_log_check")); revision = gtk_editable_get_chars (merge_revision_entry, 0, -1); log = NULL; if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell), GTK_WIDGET (merge_revision_entry), revision, _("Please enter a revision."))) { g_free (revision); return; } if (gtk_toggle_button_get_active (use_custom_log_check)) { merge_log_view = ANJUTA_COLUMN_TEXT_VIEW (gtk_builder_get_object (self->priv->builder, "merge_log_view")); log = anjuta_column_text_view_get_text (merge_log_view); if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell), GTK_WIDGET (merge_log_view), log, _("Please enter a log message."))) { g_free (revision); g_free (log); return; } } merge_command = git_merge_command_new (plugin->project_root_directory, revision, log, gtk_toggle_action_get_active (no_commit_action), gtk_toggle_action_get_active (squash_action)); g_free (revision); g_free (log); git_pane_create_message_view (plugin); g_signal_connect (G_OBJECT (merge_command), "data-arrived", G_CALLBACK (git_pane_on_command_info_arrived), plugin); g_signal_connect (G_OBJECT (merge_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (merge_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (merge_command)); git_pane_remove_from_dock (GIT_PANE (self)); }
static void on_ok_action_activated (GtkAction *action, GitPushPane *self) { Git *plugin; GtkTreeModel *push_branch_model; GtkTreeModel *push_tag_model; GtkToggleButton *push_all_tags_check; GtkToggleButton *push_all_check; GtkToggleAction *force_action; GList *selected_items; gboolean push_all_tags; gboolean push_all; gchar *repository; GitPushCommand *push_command; plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self))); push_branch_model = GTK_TREE_MODEL (gtk_builder_get_object (self->priv->builder, "push_branch_model")); push_tag_model = GTK_TREE_MODEL (gtk_builder_get_object (self->priv->builder, "push_tag_model")); push_all_tags_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "push_all_tags_check")); push_all_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (self->priv->builder, "push_all_check")); force_action = GTK_TOGGLE_ACTION (gtk_builder_get_object (self->priv->builder, "force_action")); selected_items = NULL; push_all_tags = gtk_toggle_button_get_active (push_all_tags_check); push_all = gtk_toggle_button_get_active (push_all_check); /* Check that the user has given a valid repository. In this case we only * care about checking if the selector widget is in URL mode, because even * if a remote isn't selected, it will default to origin, so we should * always get something when the selector is in Remote mode. */ repository = git_repository_selector_get_repository (GIT_REPOSITORY_SELECTOR (self->priv->repository_selector)); if (!git_pane_check_input (GTK_WIDGET (ANJUTA_PLUGIN (plugin)->shell), self->priv->repository_selector, repository, _("Please enter a URL."))) { g_free (repository); return; } if (!push_all) { /* Get selected branches */ gtk_tree_model_foreach (push_branch_model, (GtkTreeModelForeachFunc) get_selected_items, &selected_items); } /* Don't bother getting selected tags if Push all tags is checked or if * Push all branches and tags is checked */ if (!push_all && !push_all_tags) { /* Get selected tags */ gtk_tree_model_foreach (push_tag_model, (GtkTreeModelForeachFunc) get_selected_items, &selected_items); } push_command = git_push_command_new (plugin->project_root_directory, repository, selected_items, push_all, push_all_tags, gtk_toggle_action_get_active (force_action)); g_free (repository); anjuta_util_glist_strings_free (selected_items); git_pane_create_message_view (plugin); g_signal_connect (G_OBJECT (push_command), "data-arrived", G_CALLBACK (git_pane_on_command_info_arrived), plugin); g_signal_connect (G_OBJECT (push_command), "command-finished", G_CALLBACK (git_pane_report_errors), plugin); g_signal_connect (G_OBJECT (push_command), "command-finished", G_CALLBACK (git_plugin_status_changed_emit), plugin); g_signal_connect (G_OBJECT (push_command), "command-finished", G_CALLBACK (g_object_unref), NULL); anjuta_command_start (ANJUTA_COMMAND (push_command)); git_pane_remove_from_dock (GIT_PANE (self)); }