[anjuta/git-shell: 31/34] git: Add a helper method to get log messages from text views
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/git-shell: 31/34] git: Add a helper method to get log messages from text views
- Date: Thu, 10 Jun 2010 06:53:47 +0000 (UTC)
commit ca1886976a6e548fa0edbd358bcb9646ccba9bde
Author: James Liggett <jrliggett cox net>
Date: Wed Jun 9 16:25:31 2010 -0700
git: Add a helper method to get log messages from text views
plugins/git/anjuta-git.ui | 2 +-
plugins/git/git-merge-pane.c | 17 ++++-------------
plugins/git/git-pane.c | 18 ++++++++++++++++++
plugins/git/git-pane.h | 1 +
4 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/plugins/git/anjuta-git.ui b/plugins/git/anjuta-git.ui
index 861677b..12dede2 100644
--- a/plugins/git/anjuta-git.ui
+++ b/plugins/git/anjuta-git.ui
@@ -1010,7 +1010,7 @@
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="log_text_view">
+ <object class="GtkTextView" id="log_view">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
diff --git a/plugins/git/git-merge-pane.c b/plugins/git/git-merge-pane.c
index 6fe09d4..cf22c48 100644
--- a/plugins/git/git-merge-pane.c
+++ b/plugins/git/git-merge-pane.c
@@ -36,10 +36,7 @@ on_ok_button_clicked (GtkButton *button, GitMergePane *self)
GtkToggleButton *use_custom_log_check;
gchar *revision;
gchar *log;
- GtkTextView *log_text_view;
- GtkTextBuffer *log_buffer;
- GtkTextIter start_iter;
- GtkTextIter end_iter;
+ GtkTextView *log_view;
GitMergeCommand *merge_command;
plugin = ANJUTA_PLUGIN_GIT (anjuta_dock_pane_get_plugin (ANJUTA_DOCK_PANE (self)));
@@ -56,15 +53,9 @@ on_ok_button_clicked (GtkButton *button, GitMergePane *self)
if (gtk_toggle_button_get_active (use_custom_log_check))
{
- log_text_view = GTK_TEXT_VIEW (gtk_builder_get_object (self->priv->builder,
- "log_text_view"));
- log_buffer = gtk_text_view_get_buffer (log_text_view);
-
- gtk_text_buffer_get_start_iter (log_buffer, &start_iter);
- gtk_text_buffer_get_end_iter (log_buffer, &end_iter);
-
- log = gtk_text_buffer_get_text (log_buffer, &start_iter, &end_iter,
- FALSE);
+ log_view = GTK_TEXT_VIEW (gtk_builder_get_object (self->priv->builder,
+ "log_view"));
+ log = git_pane_get_log_from_text_view (log_view);
}
merge_command = git_merge_command_new (plugin->project_root_directory,
diff --git a/plugins/git/git-pane.c b/plugins/git/git-pane.c
index d60e8f6..86f7f81 100644
--- a/plugins/git/git-pane.c
+++ b/plugins/git/git-pane.c
@@ -114,4 +114,22 @@ git_pane_set_log_view_column_label (GtkTextBuffer *buffer,
gtk_label_set_text (column_label, text);
g_free (text);
+}
+
+gchar *
+git_pane_get_log_from_text_view (GtkTextView *text_view)
+{
+ GtkTextBuffer *log_buffer;
+ GtkTextIter start_iter;
+ GtkTextIter end_iter;
+ gchar *log;
+
+ log_buffer = gtk_text_view_get_buffer(text_view);
+
+ gtk_text_buffer_get_start_iter(log_buffer, &start_iter);
+ gtk_text_buffer_get_end_iter(log_buffer, &end_iter) ;
+
+ log = gtk_text_buffer_get_text(log_buffer, &start_iter, &end_iter, FALSE);
+
+ return log;
}
\ No newline at end of file
diff --git a/plugins/git/git-pane.h b/plugins/git/git-pane.h
index 452e71b..3d8e771 100644
--- a/plugins/git/git-pane.h
+++ b/plugins/git/git-pane.h
@@ -56,6 +56,7 @@ void git_pane_set_log_view_column_label (GtkTextBuffer *buffer,
GtkTextIter *location,
GtkTextMark *mark,
GtkLabel *column_label);
+gchar *git_pane_get_log_from_text_view (GtkTextView *text_view);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]