SF.net SVN: geany:[4893] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun May 9 15:48:43 UTC 2010
Revision: 4893
http://geany.svn.sourceforge.net/geany/?rev=4893&view=rev
Author: eht16
Date: 2010-05-09 15:48:42 +0000 (Sun, 09 May 2010)
Log Message:
-----------
Add special variant dialogs_show_input_goto_line() to use a normal GtkEntry together with dialogs_show_input_goto_line() for text input.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/dialogs.c
trunk/src/dialogs.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-05-09 15:48:29 UTC (rev 4892)
+++ trunk/ChangeLog 2010-05-09 15:48:42 UTC (rev 4893)
@@ -5,6 +5,9 @@
* src/ui_utils.h, src/ui_utils.c:
Add public, generic callback ui_editable_insert_text_callback()
to restrict GtkEntry text inputs to +/- and numeric values only.
+ * src/dialogsh, src/dialogs.c:
+ Add special variant dialogs_show_input_goto_line() to use a normal
+ GtkEntry together with dialogs_show_input_goto_line() for text input.
2010-05-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2010-05-09 15:48:29 UTC (rev 4892)
+++ trunk/src/dialogs.c 2010-05-09 15:48:42 UTC (rev 4893)
@@ -838,7 +838,8 @@
static void add_input_widgets(GtkWidget *dialog, GtkWidget *vbox,
- const gchar *label_text, const gchar *default_text, gboolean persistent)
+ const gchar *label_text, const gchar *default_text, gboolean persistent,
+ GCallback insert_text_cb)
{
GtkWidget *entry;
@@ -873,6 +874,8 @@
gtk_entry_set_max_length(GTK_ENTRY(entry), 255);
gtk_entry_set_width_chars(GTK_ENTRY(entry), 30);
+ if (insert_text_cb != NULL)
+ g_signal_connect(entry, "insert-text", insert_text_cb, NULL);
g_signal_connect(entry, "activate", G_CALLBACK(on_input_entry_activate), dialog);
g_signal_connect(dialog, "show", G_CALLBACK(on_input_dialog_show), entry);
g_signal_connect(dialog, "response", G_CALLBACK(on_input_dialog_response), entry);
@@ -886,7 +889,7 @@
* Returns: the dialog widget. */
static GtkWidget *
dialogs_show_input_full(const gchar *title, const gchar *label_text, const gchar *default_text,
- gboolean persistent, GeanyInputCallback input_cb)
+ gboolean persistent, GeanyInputCallback input_cb, GCallback insert_text_cb)
{
GtkWidget *dialog, *vbox;
@@ -900,7 +903,7 @@
g_object_set_data(G_OBJECT(dialog), "has_combo", GINT_TO_POINTER(persistent));
g_object_set_data(G_OBJECT(dialog), "input_cb", (gpointer) input_cb);
- add_input_widgets(dialog, vbox, label_text, default_text, persistent);
+ add_input_widgets(dialog, vbox, label_text, default_text, persistent, insert_text_cb);
if (persistent)
{
@@ -922,7 +925,7 @@
dialogs_show_input_persistent(const gchar *title, const gchar *label_text, const gchar *default_text,
GeanyInputCallback input_cb)
{
- return dialogs_show_input_full(title, label_text, default_text, TRUE, input_cb);
+ return dialogs_show_input_full(title, label_text, default_text, TRUE, input_cb, NULL);
}
@@ -940,11 +943,24 @@
const gchar *default_text)
{
dialog_input = NULL;
- dialogs_show_input_full(title, label_text, default_text, FALSE, on_dialog_input);
+ dialogs_show_input_full(title, label_text, default_text, FALSE, on_dialog_input, NULL);
return NVL(dialog_input, g_strdup(default_text));
}
+/* Returns: newly allocated string - a copy of either the entry text or default_text.
+ * Specialised variant for Goto Line dialog. */
+gchar *dialogs_show_input_goto_line(const gchar *title, const gchar *label_text,
+ const gchar *default_text)
+{
+ dialog_input = NULL;
+ dialogs_show_input_full(
+ title, label_text, default_text, FALSE, on_dialog_input,
+ G_CALLBACK(ui_editable_insert_text_callback));
+ return NVL(dialog_input, g_strdup(default_text));
+}
+
+
/**
* Shows an input box to enter a numerical value using a GtkSpinButton.
* If the dialog is aborted, @a value remains untouched.
Modified: trunk/src/dialogs.h
===================================================================
--- trunk/src/dialogs.h 2010-05-09 15:48:29 UTC (rev 4892)
+++ trunk/src/dialogs.h 2010-05-09 15:48:42 UTC (rev 4893)
@@ -48,6 +48,9 @@
gchar *dialogs_show_input(const gchar *title, const gchar *label_text,
const gchar *default_text);
+gchar *dialogs_show_input_goto_line(const gchar *title, const gchar *label_text,
+ const gchar *default_text);
+
GtkWidget *dialogs_show_input_persistent(const gchar *title, const gchar *label_text,
const gchar *default_text, GeanyInputCallback input_cb);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list