SF.net SVN: geany:[5414] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Nov 18 16:15:11 UTC 2010


Revision: 5414
          http://geany.svn.sourceforge.net/geany/?rev=5414&view=rev
Author:   ntrel
Date:     2010-11-18 16:15:10 +0000 (Thu, 18 Nov 2010)

Log Message:
-----------
Re-focus Set Build Commands/Project dialogs after editing a build
command label.
Add 'parent' argument to some dialogs_show_input*() functions because
the dialog parent may not always be the main window.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c
    trunk/src/callbacks.c
    trunk/src/dialogs.c
    trunk/src/dialogs.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-11-17 17:45:45 UTC (rev 5413)
+++ trunk/ChangeLog	2010-11-18 16:15:10 UTC (rev 5414)
@@ -1,3 +1,12 @@
+2010-11-18  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/build.c, src/dialogs.c, src/dialogs.h, src/callbacks.c:
+   Re-focus Set Build Commands/Project dialogs after editing a build
+   command label.
+   Add 'parent' argument to some dialogs_show_input*() functions because
+   the dialog parent may not always be the main window.
+
+
 2010-11-17  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/build.c, doc/geany.txt, doc/geany.html:

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2010-11-17 17:45:45 UTC (rev 5413)
+++ trunk/src/build.c	2010-11-18 16:15:10 UTC (rev 5414)
@@ -1274,7 +1274,7 @@
 
 		if (! dialog)
 		{
-			dialog = dialogs_show_input_persistent(_("Custom Text"),
+			dialog = dialogs_show_input_persistent(_("Custom Text"), GTK_WINDOW(main_widgets.window),
 				_("Enter custom text here, all entered text is appended to the command."),
 				build_info.custom_target, &on_make_custom_input_response);
 		}
@@ -1816,9 +1816,11 @@
 
 static void on_label_button_clicked(GtkWidget *wid, gpointer user_data)
 {
-	RowWidgets *r = (RowWidgets*)user_data;
+	RowWidgets *r = user_data;
 	const gchar *old = gtk_button_get_label(GTK_BUTTON(wid));
-	gchar *str = dialogs_show_input(_("Set menu item label"), NULL, old);
+	/* FIXME: we should pass either build dialog or project dialog instead of NULL for parent */
+	gchar *str = dialogs_show_input(_("Set menu item label"),
+		NULL, NULL, old);
 
 	gtk_button_set_label(GTK_BUTTON(wid), str);
 	g_free(str);

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2010-11-17 17:45:45 UTC (rev 5413)
+++ trunk/src/callbacks.c	2010-11-18 16:15:10 UTC (rev 5414)
@@ -1193,7 +1193,8 @@
 	gchar *result;
 
 	result = dialogs_show_input_goto_line(
-		_("Go to Line"), _("Enter the line you want to go to:"), value);
+		_("Go to Line"), GTK_WINDOW(main_widgets.window),
+		_("Enter the line you want to go to:"), value);
 	if (result != NULL)
 	{
 		GeanyDocument *doc = document_get_current();
@@ -1437,7 +1438,7 @@
 	else
 	{
 		setptr(ui_prefs.custom_date_format,
-			dialogs_show_input(_("Custom Date Format"),
+			dialogs_show_input(_("Custom Date Format"), GTK_WINDOW(main_widgets.window),
 				_("Enter here a custom date and time format. "
 				"You can use any conversion specifiers which can be used with the ANSI C strftime function."),
 				ui_prefs.custom_date_format));

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2010-11-17 17:45:45 UTC (rev 5413)
+++ trunk/src/dialogs.c	2010-11-18 16:15:10 UTC (rev 5414)
@@ -980,12 +980,13 @@
  * 	and can be reshown.
  * Returns: the dialog widget. */
 static GtkWidget *
-dialogs_show_input_full(const gchar *title, const gchar *label_text, const gchar *default_text,
+dialogs_show_input_full(const gchar *title, GtkWindow *parent,
+						const gchar *label_text, const gchar *default_text,
 						gboolean persistent, GeanyInputCallback input_cb, GCallback insert_text_cb)
 {
 	GtkWidget *dialog, *vbox;
 
-	dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
+	dialog = gtk_dialog_new_with_buttons(title, parent,
 		GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 		GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
 	vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
@@ -1014,10 +1015,11 @@
 /* Remember previous entry text in a combo box.
  * Returns: the dialog widget. */
 GtkWidget *
-dialogs_show_input_persistent(const gchar *title, const gchar *label_text, const gchar *default_text,
+dialogs_show_input_persistent(const gchar *title, GtkWindow *parent,
+		const gchar *label_text, const gchar *default_text,
 		GeanyInputCallback input_cb)
 {
-	return dialogs_show_input_full(title, label_text, default_text, TRUE, input_cb, NULL);
+	return dialogs_show_input_full(title, parent, label_text, default_text, TRUE, input_cb, NULL);
 }
 
 
@@ -1031,23 +1033,23 @@
 
 
 /* Returns: newly allocated string - a copy of either the entry text or default_text. */
-gchar *dialogs_show_input(const gchar *title, const gchar *label_text,
+gchar *dialogs_show_input(const gchar *title, GtkWindow *parent, const gchar *label_text,
 	const gchar *default_text)
 {
 	dialog_input = NULL;
-	dialogs_show_input_full(title, label_text, default_text, FALSE, on_dialog_input, NULL);
+	dialogs_show_input_full(title, parent, label_text, default_text, FALSE, on_dialog_input, NULL);
 	return NVL(dialog_input, g_strdup(default_text));
 }
 
 
 /* Returns: newly allocated copy of the entry text or NULL on cancel.
  * Specialised variant for Goto Line dialog. */
-gchar *dialogs_show_input_goto_line(const gchar *title, const gchar *label_text,
+gchar *dialogs_show_input_goto_line(const gchar *title, GtkWindow *parent, const gchar *label_text,
 	const gchar *default_text)
 {
 	dialog_input = NULL;
 	dialogs_show_input_full(
-		title, label_text, default_text, FALSE, on_dialog_input,
+		title, parent, label_text, default_text, FALSE, on_dialog_input,
 		G_CALLBACK(ui_editable_insert_text_callback));
 	return dialog_input;
 }

Modified: trunk/src/dialogs.h
===================================================================
--- trunk/src/dialogs.h	2010-11-17 17:45:45 UTC (rev 5413)
+++ trunk/src/dialogs.h	2010-11-18 16:15:10 UTC (rev 5414)
@@ -45,17 +45,17 @@
 
 void dialogs_show_color(gchar *colour);
 
-gchar *dialogs_show_input(const gchar *title, const gchar *label_text,
-	const gchar *default_text);
+gchar *dialogs_show_input(const gchar *title, GtkWindow *parent,
+	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);
+gchar *dialogs_show_input_goto_line(const gchar *title, GtkWindow *parent,
+	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);
+GtkWidget *dialogs_show_input_persistent(const gchar *title, GtkWindow *parent,
+	const gchar *label_text, const gchar *default_text, GeanyInputCallback input_cb);
 
 gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text,
-									gdouble *value, gdouble min, gdouble max, gdouble step);
+	gdouble *value, gdouble min, gdouble max, gdouble step);
 
 void dialogs_show_file_properties(GeanyDocument *doc);
 


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