[geany/geany-plugins] c06898: geanydoc: Current word as initial text in interactive mode

Vasiliy Faronov git-noreply at xxxxx
Tue Jan 3 21:48:23 UTC 2017


Branch:      refs/heads/master
Author:      Vasiliy Faronov <vfaronov at gmail.com>
Committer:   Vasiliy Faronov <vfaronov at gmail.com>
Date:        Sat, 09 Jul 2016 12:26:37 UTC
Commit:      c06898de822bb6c0535a325bcbc8679f90176255
             https://github.com/geany/geany-plugins/commit/c06898de822bb6c0535a325bcbc8679f90176255

Log Message:
-----------
geanydoc: Current word as initial text in interactive mode

This makes the plugin more useful for namespaced languages
like Python, where you often want to tweak the words a bit
(e.g. "xyzzy" -> "somelib.xyzzy") before looking them up.


Modified Paths:
--------------
    geanydoc/src/geanydoc.c

Modified: geanydoc/src/geanydoc.c
11 lines changed, 7 insertions(+), 4 deletions(-)
===================================================================
@@ -58,7 +58,7 @@ enum
 	KB_COUNT
 };
 
-GtkWidget *create_Interactive(void);
+GtkWidget *create_Interactive(const gchar * default_word);
 
 static gboolean word_check_left(gchar c)
 {
@@ -221,11 +221,12 @@ kb_doc(G_GNUC_UNUSED guint key_id)
 static void
 kb_doc_ask(G_GNUC_UNUSED guint key_id)
 {
-	gchar *word = NULL;
+	gchar *word = NULL, *default_word = current_word();
 	GtkWidget *dialog, *entry;
 
 	/* example configuration dialog */
-	dialog = create_Interactive();
+	dialog = create_Interactive(default_word);
+	g_free(default_word);
 
 	/* run the dialog and check for the response code */
 	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
@@ -290,7 +291,7 @@ on_comboboxType_changed(GtkComboBox * combobox, G_GNUC_UNUSED gpointer user_data
   g_object_set_data (G_OBJECT (component), name, widget)
 
 GtkWidget *
-create_Interactive(void)
+create_Interactive(const gchar * default_word)
 {
 	GtkWidget *dialog_vbox1;
 	GtkWidget *entry_word;
@@ -306,6 +307,8 @@ create_Interactive(void)
 	dialog_vbox1 = GTK_DIALOG(dialog)->vbox;
 
 	entry_word = gtk_entry_new();
+	if (default_word)
+		gtk_entry_set_text(GTK_ENTRY(entry_word), default_word);
 	gtk_widget_show(entry_word);
 	gtk_box_pack_start(GTK_BOX(dialog_vbox1), entry_word, TRUE, TRUE, 0);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list