[anjuta/git-shell: 2/12] git: Add a method to check input in dialogs
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/git-shell: 2/12] git: Add a method to check input in dialogs
- Date: Mon, 14 Jun 2010 23:53:32 +0000 (UTC)
commit 2a4b07f0bb6a0e96b4b3a1221be72cb31fdd08ad
Author: James Liggett <jrliggett cox net>
Date: Thu Jun 10 15:23:42 2010 -0700
git: Add a method to check input in dialogs
plugins/git/git-pane.c | 37 ++++++++++++++++++++++++++++++++++++-
plugins/git/git-pane.h | 3 +++
2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/plugins/git/git-pane.c b/plugins/git/git-pane.c
index 86f7f81..f1b4472 100644
--- a/plugins/git/git-pane.c
+++ b/plugins/git/git-pane.c
@@ -132,4 +132,39 @@ git_pane_get_log_from_text_view (GtkTextView *text_view)
log = gtk_text_buffer_get_text(log_buffer, &start_iter, &end_iter, FALSE);
return log;
-}
\ No newline at end of file
+}
+
+gboolean
+git_pane_check_input (GtkWidget *parent, GtkWidget *widget, const gchar *input,
+ const gchar *error_message)
+{
+ gboolean ret;
+ GtkWidget *dialog;
+
+ ret = FALSE;
+
+ if (input)
+ {
+ if (strlen (input) > 0)
+ ret = TRUE;
+ }
+
+ if (!ret)
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "%s",
+ error_message);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ gtk_window_set_focus (GTK_WINDOW (parent), widget);
+ }
+
+
+ return ret;
+}
+
diff --git a/plugins/git/git-pane.h b/plugins/git/git-pane.h
index 3d8e771..60ed5ca 100644
--- a/plugins/git/git-pane.h
+++ b/plugins/git/git-pane.h
@@ -57,6 +57,9 @@ void git_pane_set_log_view_column_label (GtkTextBuffer *buffer,
GtkTextMark *mark,
GtkLabel *column_label);
gchar *git_pane_get_log_from_text_view (GtkTextView *text_view);
+gboolean git_pane_check_input (GtkWidget *parent, GtkWidget *widget,
+ const gchar *input, const gchar *error_message);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]