SF.net SVN: geany: [1971] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Oct 24 10:52:49 UTC 2007


Revision: 1971
          http://geany.svn.sourceforge.net/geany/?rev=1971&view=rev
Author:   ntrel
Date:     2007-10-24 03:52:48 -0700 (Wed, 24 Oct 2007)

Log Message:
-----------
Make msgwin_status_add() only log a message, not display it on the
status bar.
Make ui_set_statusbar() take a log argument for whether to record the
message in the Status window.
(Plugin API functions already do this).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c
    trunk/src/callbacks.c
    trunk/src/document.c
    trunk/src/geany.h
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/msgwindow.c
    trunk/src/plugins.c
    trunk/src/project.c
    trunk/src/search.c
    trunk/src/symbols.c
    trunk/src/tools.c
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/ChangeLog	2007-10-24 10:52:48 UTC (rev 1971)
@@ -1,3 +1,16 @@
+2007-10-24  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/build.c, src/ui_utils.h, src/tools.c, src/project.c, src/geany.h,
+   src/msgwindow.c, src/callbacks.c, src/keyfile.c, src/search.c,
+   src/document.c, src/plugins.c, src/main.c, src/symbols.c,
+   src/ui_utils.c:
+   Make msgwin_status_add() only log a message, not display it on the
+   status bar.
+   Make ui_set_statusbar() take a log argument for whether to record the
+   message in the Status window.
+   (Plugin API functions already do this).
+
+
 2007-10-23  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * plugins/svndiff.c:

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/build.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -175,7 +175,7 @@
 	// check wether view_file exists
 	if (g_stat(locale_filename, &st) != 0)
 	{
-		msgwin_status_add(_("Failed to view %s (make sure it is already compiled)"), view_file);
+		ui_set_statusbar(TRUE, _("Failed to view %s (make sure it is already compiled)"), view_file);
 		utils_free_pointers(executable, view_file, locale_filename, NULL);
 
 		return (GPid) 1;
@@ -207,7 +207,7 @@
 	}
 	if (term_argv[0] == NULL)
 	{
-		msgwin_status_add(
+		ui_set_statusbar(TRUE,
 			_("Could not find terminal \"%s\" "
 				"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
 
@@ -220,7 +220,7 @@
 	// (RUN_SCRIPT_CMD should be ok in UTF8 without converting in locale because it contains no umlauts)
 	if (! build_create_shellscript(RUN_SCRIPT_CMD, locale_cmd_string, TRUE))
 	{
-		msgwin_status_add(_("Failed to execute \"%s\" (start-script could not be created)"),
+		ui_set_statusbar(TRUE, _("Failed to execute \"%s\" (start-script could not be created)"),
 													executable);
 		utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string,
 										locale_term_cmd, NULL);
@@ -248,7 +248,7 @@
 						NULL, NULL, &(run_info.pid), NULL, NULL, NULL, &error))
 	{
 		geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
-		msgwin_status_add(_("Process failed (%s)"), error->message);
+		ui_set_statusbar(TRUE, _("Process failed (%s)"), error->message);
 
 		utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string,
 										locale_term_cmd, NULL);
@@ -365,7 +365,7 @@
 	// check for filename extension and abort if filename doesn't have one
 	if (utils_str_equal(locale_filename, executable))
 	{
-		msgwin_status_add(_("Command stopped because the current file has no extension."));
+		ui_set_statusbar(TRUE, _("Command stopped because the current file has no extension."));
 		utils_beep();
 		utils_free_pointers(locale_filename, executable, NULL);
 		return (GPid) 1;
@@ -514,7 +514,7 @@
 						NULL, NULL, &(build_info.pid), NULL, &stdout_fd, &stderr_fd, &error))
 	{
 		geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
-		msgwin_status_add(_("Process failed (%s)"), error->message);
+		ui_set_statusbar(TRUE, _("Process failed (%s)"), error->message);
 		g_strfreev(argv);
 		g_error_free(error);
 		g_free(working_dir);
@@ -580,7 +580,7 @@
 		// check for filename extension and abort if filename doesn't have one
 		if (utils_str_equal(locale_filename, check_executable))
 		{
-			msgwin_status_add(_("Command stopped because the current file has no extension."));
+			ui_set_statusbar(TRUE, _("Command stopped because the current file has no extension."));
 			utils_beep();
 			g_free(check_executable);
 			return NULL;
@@ -591,7 +591,7 @@
 		{
 			gchar *utf8_check_executable = utils_get_utf8_from_locale(check_executable);
 
-			msgwin_status_add(_("Failed to execute \"%s\" (make sure it is already built)"),
+			ui_set_statusbar(TRUE, _("Failed to execute \"%s\" (make sure it is already built)"),
 														utf8_check_executable);
 			g_free(utf8_check_executable);
 			g_free(check_executable);
@@ -645,7 +645,7 @@
 		gchar *utf8_working_dir =
 			utils_get_utf8_from_locale(working_dir);
 
-		msgwin_status_add(_("Failed to change the working directory to \"%s\""), utf8_working_dir);
+		ui_set_statusbar(TRUE, _("Failed to change the working directory to \"%s\""), utf8_working_dir);
 		g_free(utf8_working_dir);
 		g_free(working_dir);
 		g_free(executable);
@@ -671,7 +671,7 @@
 	{
 		gchar *utf8_cmd = utils_get_utf8_from_locale(cmd);
 
-		msgwin_status_add(_("Failed to execute \"%s\" (start-script could not be created)"),
+		ui_set_statusbar(TRUE, _("Failed to execute \"%s\" (start-script could not be created)"),
 			utf8_cmd);
 		g_free(utf8_cmd);
 	}
@@ -745,7 +745,7 @@
 		}
 		if (term_argv[0] == NULL)
 		{
-			msgwin_status_add(
+			ui_set_statusbar(TRUE,
 				_("Could not find terminal \"%s\" "
 					"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
 			run_info.pid = (GPid) 1;
@@ -771,7 +771,7 @@
 							NULL, NULL, &(run_info.pid), NULL, NULL, NULL, &error))
 		{
 			geany_debug("g_spawn_async_with_pipes() failed: %s", error->message);
-			msgwin_status_add(_("Process failed (%s)"), error->message);
+			ui_set_statusbar(TRUE, _("Process failed (%s)"), error->message);
 			unlink(RUN_SCRIPT_CMD);
 			g_error_free(error);
 			error = NULL;
@@ -895,7 +895,7 @@
 		}
 		else
 		if (gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
-			ui_set_statusbar("%s", msg);
+			ui_set_statusbar(FALSE, "%s", msg);
 	}
 	else
 	{
@@ -903,7 +903,7 @@
 		msgwin_compiler_add(COLOR_BLUE, msg);
 		if (! ui_prefs.msgwindow_visible ||
 			gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
-				ui_set_statusbar("%s", msg);
+				ui_set_statusbar(FALSE, "%s", msg);
 	}
 }
 #endif
@@ -1893,7 +1893,7 @@
 	{	// run LaTeX file
 		if (build_view_tex_file(idx, GPOINTER_TO_INT(user_data)) == (GPid) 0)
 		{
-			msgwin_status_add(_("Failed to execute the view program"));
+			ui_set_statusbar(TRUE, _("Failed to execute the view program"));
 		}
 	}
 	else if (doc_list[idx].file_type->id == GEANY_FILETYPES_HTML)
@@ -1912,7 +1912,7 @@
 
 		if (build_run_cmd(idx) == (GPid) 0)
 		{
-			msgwin_status_add(_("Failed to execute the terminal program"));
+			ui_set_statusbar(TRUE, _("Failed to execute the terminal program"));
 		}
 	}
 }
@@ -1960,7 +1960,7 @@
 	result = kill(*pid, SIGQUIT);
 
 	if (result != 0)
-		msgwin_status_add(_("Process could not be stopped (%s)."), g_strerror(errno));
+		ui_set_statusbar(TRUE, _("Process could not be stopped (%s)."), g_strerror(errno));
 	else
 	{
 		*pid = 0;
@@ -1980,7 +1980,7 @@
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
 	}
 	else
-		ui_set_statusbar(_("No more build errors."));
+		ui_set_statusbar(FALSE, _("No more build errors."));
 }
 
 

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/callbacks.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -1312,7 +1312,7 @@
 
 	if (doc_list[idx].file_type == NULL)
 	{
-		ui_set_statusbar(_("Please set the filetype for the current file before using this function."));
+		ui_set_statusbar(FALSE, _("Please set the filetype for the current file before using this function."));
 		return;
 	}
 
@@ -1336,7 +1336,7 @@
 
 	if (! DOC_IDX_VALID(idx) || doc_list[idx].file_type == NULL)
 	{
-		ui_set_statusbar(_("Please set the filetype for the current file before using this function."));
+		ui_set_statusbar(FALSE, _("Please set the filetype for the current file before using this function."));
 		return;
 	}
 
@@ -1497,7 +1497,7 @@
 	else
 	{
 		utils_beep();
-		msgwin_status_add(
+		ui_set_statusbar(TRUE,
 				_("Date format string could not be converted (possibly too long)."));
 	}
 }
@@ -1797,7 +1797,7 @@
 {
 	if (! ui_tree_view_find_next(GTK_TREE_VIEW(msgwindow.tree_msg),
 		msgwin_goto_messages_file_line))
-		ui_set_statusbar(_("No more message items."));
+		ui_set_statusbar(FALSE, _("No more message items."));
 }
 
 
@@ -2012,7 +2012,7 @@
 
 		if (! g_spawn_command_line_async(command, &error))
 		{
-			msgwin_status_add("Context action command failed: %s", error->message);
+			ui_set_statusbar(TRUE, "Context action command failed: %s", error->message);
 			g_error_free(error);
 		}
 	}

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/document.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -80,8 +80,6 @@
 static gboolean delay_colourise = FALSE;
 
 
-void msgwin_status_add_new(const gchar *format, ...) G_GNUC_PRINTF(1, 2);	// temporary for v0.12
-
 static void document_undo_clear(gint idx);
 static void document_redo_add(gint idx, guint type, gpointer data);
 
@@ -476,7 +474,7 @@
 		}
 		notebook_remove_page(page_num);
 		treeviews_remove_document(idx);
-		msgwin_status_add_new(_("File %s closed."), DOC_FILENAME(idx));
+		msgwin_status_add(_("File %s closed."), DOC_FILENAME(idx));
 		g_free(doc_list[idx].encoding);
 		g_free(doc_list[idx].saved_encoding.encoding);
 		g_free(doc_list[idx].file_name);
@@ -575,7 +573,7 @@
 		g_signal_emit_by_name(geany_object, "document-new", idx);
 	}
 
-	msgwin_status_add_new(_("New file \"%s\" opened."),
+	msgwin_status_add(_("New file \"%s\" opened."),
 		(doc_list[idx].file_name != NULL) ? doc_list[idx].file_name : GEANY_STRING_UNTITLED);
 
 	return idx;
@@ -741,7 +739,7 @@
 
 	if (g_stat(locale_filename, &st) != 0)
 	{
-		msgwin_status_add(_("Could not open file %s (%s)"), utf8_filename, g_strerror(errno));
+		ui_set_statusbar(TRUE, _("Could not open file %s (%s)"), utf8_filename, g_strerror(errno));
 		return FALSE;
 	}
 
@@ -749,7 +747,7 @@
 
 	if (! g_file_get_contents(locale_filename, &filedata->data, NULL, &err))
 	{
-		msgwin_status_add(err->message);
+		ui_set_statusbar(TRUE, err->message);
 		g_error_free(err);
 		return FALSE;
 	}
@@ -775,7 +773,7 @@
 		if (main_status.main_window_realized)
 			dialogs_show_msgbox(GTK_MESSAGE_WARNING, warn_msg, utf8_filename);
 
-		msgwin_status_add(warn_msg, utf8_filename);
+		ui_set_statusbar(TRUE, warn_msg, utf8_filename);
 
 		// set the file to read-only mode because saving it is probably dangerous
 		filedata->readonly = TRUE;
@@ -792,7 +790,7 @@
 		}
 		else if (! handle_forced_encoding(filedata, forced_enc))
 		{
-			msgwin_status_add(_("The file \"%s\" is not valid %s."), utf8_filename, forced_enc);
+			ui_set_statusbar(TRUE, _("The file \"%s\" is not valid %s."), utf8_filename, forced_enc);
 			utils_beep();
 			g_free(filedata->data);
 			return FALSE;
@@ -800,7 +798,7 @@
 	}
 	else if (! handle_encoding(filedata))
 	{
-		msgwin_status_add(
+		ui_set_statusbar(TRUE,
 			_("The file \"%s\" does not look like a text file or the file encoding is not supported."),
 			utf8_filename);
 		utils_beep();
@@ -910,7 +908,7 @@
 		// filename must not be NULL when opening a file
 		if (filename == NULL)
 		{
-			ui_set_statusbar(_("Invalid filename"));
+			ui_set_statusbar(FALSE, _("Invalid filename"));
 			return -1;
 		}
 
@@ -970,7 +968,7 @@
 		gboolean use_tabs = detect_use_tabs(doc_list[idx].sci);
 
 		if (use_tabs != editor_prefs.use_tabs)
-			msgwin_status_add(_("Setting %s indentation mode."),
+			ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
 				(use_tabs) ? _("Tabs") : _("Spaces"));
 		document_set_use_tabs(idx, use_tabs);
 	}
@@ -1020,9 +1018,9 @@
 		g_signal_emit_by_name(geany_object, "document-open", idx);
 
 	if (reload)
-		msgwin_status_add(_("File %s reloaded."), utf8_filename);
+		ui_set_statusbar(TRUE, _("File %s reloaded."), utf8_filename);
 	else
-		msgwin_status_add_new(_("File %s opened(%d%s)."),
+		msgwin_status_add(_("File %s opened(%d%s)."),
 				utf8_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)),
 				(readonly) ? _(", read-only") : "");
 
@@ -1122,7 +1120,7 @@
 #endif
 	if (g_stat(locale_filename, &st) != 0)
 	{
-		msgwin_status_add(_("Could not open file %s (%s)"), doc_list[idx].file_name,
+		ui_set_statusbar(TRUE, _("Could not open file %s (%s)"), doc_list[idx].file_name,
 			g_strerror(errno));
 		g_free(locale_filename);
 		return FALSE;
@@ -1152,7 +1150,7 @@
 
 	if (doc_list[idx].file_name == NULL)
 	{
-		msgwin_status_add(_("Error saving file."));
+		ui_set_statusbar(TRUE, _("Error saving file."));
 		utils_beep();
 		return FALSE;
 	}
@@ -1227,7 +1225,7 @@
 #endif
 	if (fp == NULL)
 	{
-		msgwin_status_add(_("Error saving file (%s)."), g_strerror(errno));
+		ui_set_statusbar(TRUE, _("Error saving file (%s)."), g_strerror(errno));
 		utils_beep();
 		g_free(data);
 		return FALSE;
@@ -1239,7 +1237,7 @@
 
 	if (len != bytes_written)
 	{
-		msgwin_status_add(_("Error saving file."));
+		ui_set_statusbar(TRUE, _("Error saving file."));
 		utils_beep();
 		return FALSE;
 	}
@@ -1278,7 +1276,7 @@
 		tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
 		gtk_label_set_text(GTK_LABEL(doc_list[idx].tab_label), base_name);
 		gtk_label_set_text(GTK_LABEL(doc_list[idx].tabmenu_label), base_name);
-		msgwin_status_add_new(_("File %s saved."), doc_list[idx].file_name);
+		msgwin_status_add(_("File %s saved."), doc_list[idx].file_name);
 		ui_update_statusbar(idx, -1);
 		g_free(base_name);
 #ifdef HAVE_VTE
@@ -1342,7 +1340,7 @@
 	{
 		if (! inc)
 		{
-			ui_set_statusbar(_("\"%s\" was not found."), text);
+			ui_set_statusbar(FALSE, _("\"%s\" was not found."), text);
 		}
 		utils_beep();
 		sci_goto_pos(doc_list[idx].sci, start_pos, FALSE);	// clear selection
@@ -1396,7 +1394,7 @@
 		if ((selection_end == 0 && ! search_backwards) ||
 			(selection_end == sci_len && search_backwards))
 		{
-			ui_set_statusbar(_("\"%s\" was not found."), text);
+			ui_set_statusbar(FALSE, _("\"%s\" was not found."), text);
 			utils_beep();
 			return -1;
 		}
@@ -1479,7 +1477,7 @@
 
 	if (count == 0)
 	{
-		ui_set_statusbar(_("No matches found for \"%s\"."), find_text);
+		ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), find_text);
 		return;
 	}
 
@@ -1489,14 +1487,14 @@
 	{	// escape special characters for showing
 		escaped_find_text = g_strescape(find_text, NULL);
 		escaped_replace_text = g_strescape(replace_text, NULL);
-		msgwin_status_add(_("%s: replaced %d occurrence(s) of \"%s\" with \"%s\"."),
+		ui_set_statusbar(TRUE, _("%s: replaced %d occurrence(s) of \"%s\" with \"%s\"."),
 						filename, count, escaped_find_text, escaped_replace_text);
 		g_free(escaped_find_text);
 		g_free(escaped_replace_text);
 	}
 	else
 	{
-		msgwin_status_add(_("%s: replaced %d occurrence(s) of \"%s\" with \"%s\"."),
+		ui_set_statusbar(TRUE, _("%s: replaced %d occurrence(s) of \"%s\" with \"%s\"."),
 						filename, count, find_text, replace_text);
 	}
 	g_free(filename);
@@ -2029,7 +2027,7 @@
 		}
 		else
 		{
-			msgwin_status_add(_("File %s printed."), doc_list[idx].file_name);
+			ui_set_statusbar(TRUE, _("File %s printed."), doc_list[idx].file_name);
 		}
 #ifndef G_OS_WIN32
 		g_free(tmp_cmdline);

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/geany.h	2007-10-24 10:52:48 UTC (rev 1971)
@@ -100,7 +100,7 @@
 	GtkWidget			*toolbar;
 	GtkWidget			*treeview_notebook;
 	GtkWidget			*notebook;
-	GtkWidget			*statusbar;	// use ui_set_statusbar() or msgwin_status_add() to set
+	GtkWidget			*statusbar;	// use ui_set_statusbar() to set
 	GtkWidget			*popup_menu;
 }
 GeanyApp;

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/keyfile.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -759,7 +759,7 @@
 	g_ptr_array_free(session_files, TRUE);
 
 	if (failure)
-		msgwin_status_add(_("Failed to load one or more session files."));
+		ui_set_statusbar(TRUE, _("Failed to load one or more session files."));
 	else if (session_notebook_page >= 0)
 	{
 		// exlicitly allow notebook switch page callback to be called for window title,

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/main.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -561,7 +561,7 @@
 
 			g_printerr(msg, filename);	// also print to the terminal
 			g_printerr("\n");
-			msgwin_status_add(msg, filename);
+			ui_set_statusbar(TRUE, msg, filename);
 		}
 		g_free(filename);
 	}
@@ -705,9 +705,9 @@
 #endif
 	ui_create_recent_menu();
 
-	msgwin_status_add(_("This is Geany %s."), VERSION);
+	ui_set_statusbar(TRUE, _("This is Geany %s."), VERSION);
 	if (config_dir_result != 0)
-		msgwin_status_add(_("Configuration directory could not be created (%s)."),
+		ui_set_statusbar(TRUE, _("Configuration directory could not be created (%s)."),
 			g_strerror(config_dir_result));
 
 	// apply all configuration options

Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/msgwindow.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -291,27 +291,7 @@
 
 
 /* Log a status message *without* setting the status bar.
- * This is a temporary function for the plugin API for Geany 0.12.
- * In future, msgwin_status_add() will act like this. */
-void msgwin_status_add_new(const gchar *format, ...)
-{
-	gchar string[512];
-	va_list args;
-	gboolean suppress;
-
-	va_start(args, format);
-	g_vsnprintf(string, 512, format, args);
-	va_end(args);
-
-	// hack to prevent setting the status bar
-	suppress = prefs.suppress_status_messages;
-	prefs.suppress_status_messages = TRUE;
-	msgwin_status_add("%s", string);
-	prefs.suppress_status_messages = suppress;
-}
-
-
-// logs a status message (use ui_set_statusbar() to just display text on the statusbar)
+ * (Use ui_set_statusbar() to display text on the statusbar) */
 void msgwin_status_add(const gchar *format, ...)
 {
 	GtkTreeIter iter;
@@ -324,10 +304,6 @@
 	g_vsnprintf(string, 512, format, args);
 	va_end(args);
 
-	// display status message in status bar
-	if (! prefs.suppress_status_messages)
-		ui_set_statusbar("%s", string);
-
 	// add a timestamp to status messages
 	time_str = utils_get_current_time_string();
 	if (time_str == NULL)

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/plugins.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -139,28 +139,10 @@
 	&utils_remove_ext_from_filename
 };
 
-
-/* This is a temporary function for the plugin API for Geany 0.12.
- * In future, ui_set_statusbar() will act like this. */
-static void plugin_ui_set_statusbar(gboolean log, const gchar *format, ...)
-{
-	gchar string[512];
-	va_list args;
-
-	va_start(args, format);
-	g_vsnprintf(string, 512, format, args);
-	va_end(args);
-
-	if (log)
-		msgwin_status_add("%s", string);	// currently does both
-	else
-		ui_set_statusbar("%s", string);
-}
-
 static UIUtilsFuncs uiutils_funcs = {
 	&ui_dialog_vbox_new,
 	&ui_frame_new_with_alignment,
-	&plugin_ui_set_statusbar
+	&ui_set_statusbar
 };
 
 static DialogFuncs dialog_funcs = {
@@ -173,15 +155,11 @@
 	&lookup_widget
 };
 
-
-void msgwin_status_add_new(const gchar *format, ...) G_GNUC_PRINTF(1, 2);	// temporary for v0.12
-
 static MsgWinFuncs msgwin_funcs = {
-	&msgwin_status_add_new,
+	&msgwin_status_add,
 	&msgwin_compiler_add_fmt
 };
 
-
 static EncodingFuncs encoding_funcs = {
 	&encodings_convert_to_utf8,
 	&encodings_convert_to_utf8_from_charset

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/project.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -280,7 +280,7 @@
 	/// TODO handle open project files
 
 	write_config();
-	msgwin_status_add(_("Project \"%s\" closed."), app->project->name);
+	ui_set_statusbar(TRUE, _("Project \"%s\" closed."), app->project->name);
 
 	g_free(app->project->name);
 	g_free(app->project->description);
@@ -610,9 +610,9 @@
 	}
 	write_config();
 	if (new_project)
-		msgwin_status_add(_("Project \"%s\" created."), p->name);
+		ui_set_statusbar(TRUE, _("Project \"%s\" created."), p->name);
 	else
-		msgwin_status_add(_("Project \"%s\" saved."), p->name);
+		ui_set_statusbar(TRUE, _("Project \"%s\" saved."), p->name);
 
 	return TRUE;
 }
@@ -759,14 +759,14 @@
 
 	if (load_config(locale_file_name))
 	{
-		msgwin_status_add(_("Project \"%s\" opened."), app->project->name);
+		ui_set_statusbar(TRUE, _("Project \"%s\" opened."), app->project->name);
 		return TRUE;
 	}
 	else
 	{
 		gchar *utf8_filename = utils_get_utf8_from_locale(locale_file_name);
 
-		msgwin_status_add(_("Project file \"%s\" could not be loaded."), utf8_filename);
+		ui_set_statusbar(TRUE, _("Project file \"%s\" could not be loaded."), utf8_filename);
 		g_free(utf8_filename);
 	}
 	return FALSE;

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/search.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -873,9 +873,9 @@
 					gint count = search_mark(idx, search_data.text, search_data.flags);
 
 					if (count == 0)
-						ui_set_statusbar(_("No matches found for \"%s\"."), search_data.text);
+						ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_data.text);
 					else
-						ui_set_statusbar(_("Found %d matches for \"%s\"."), count,
+						ui_set_statusbar(FALSE, _("Found %d matches for \"%s\"."), count,
 							search_data.text);
 				}
 				break;
@@ -994,7 +994,7 @@
 				if (document_replace_all(ix, find, replace, search_flags_re,
 					search_replace_escape_re)) count++;
 			}
-			ui_set_statusbar(_("Replaced text in %u files."), count);
+			ui_set_statusbar(FALSE, _("Replaced text in %u files."), count);
 			// show which docs had replacements:
 			gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_STATUS);
 
@@ -1095,7 +1095,7 @@
 					lookup_widget(widgets.find_in_files_dialog, "entry_extra"))));
 
 		if (utf8_dir == NULL || utils_str_equal(utf8_dir, ""))
-			ui_set_statusbar(_("Invalid directory for find in files."));
+			ui_set_statusbar(FALSE, _("Invalid directory for find in files."));
 		else if (search_text && *search_text)
 		{
 			gchar *locale_dir;
@@ -1113,7 +1113,7 @@
 			g_string_free(opts, TRUE);
 		}
 		else
-			ui_set_statusbar(_("No text to find."));
+			ui_set_statusbar(FALSE, _("No text to find."));
 	}
 	else
 		gtk_widget_hide(widgets.find_in_files_dialog);
@@ -1134,7 +1134,7 @@
 
 	if (! g_file_test(prefs.tools_grep_cmd, G_FILE_TEST_IS_EXECUTABLE))
 	{
-		msgwin_status_add(_("Cannot execute grep tool '%s';"
+		ui_set_statusbar(TRUE, _("Cannot execute grep tool '%s';"
 			" check the path setting in Preferences."), prefs.tools_grep_cmd);
 		return FALSE;
 	}
@@ -1185,7 +1185,7 @@
 		NULL, &stdout_fd, NULL, &error))
 	{
 		geany_debug("%s: g_spawn_async_with_pipes() failed: %s", __func__, error->message);
-		msgwin_status_add(_("Process failed (%s)"), error->message);
+		ui_set_statusbar(TRUE, _("Process failed (%s)"), error->message);
 		g_error_free(error);
 		ret = FALSE;
 	}
@@ -1227,7 +1227,7 @@
 	list = utils_get_file_list(dir, &list_len, &error);
 	if (error)
 	{
-		msgwin_status_add(_("Could not open directory (%s)"), error->message);
+		ui_set_statusbar(TRUE, _("Could not open directory (%s)"), error->message);
 		g_error_free(error);
 		return NULL;
 	}
@@ -1289,7 +1289,7 @@
 
 				msgwin_msg_add_fmt(COLOR_BLUE, -1, -1,
 					_("Search completed with %d matches."), count);
-				ui_set_statusbar(_("Search completed with %d matches."), count);
+				ui_set_statusbar(FALSE, _("Search completed with %d matches."), count);
 				break;
 			}
 			case 1:
@@ -1297,7 +1297,7 @@
 				color = COLOR_BLUE;
 			default:
 				msgwin_msg_add(color, -1, -1, msg);
-				ui_set_statusbar("%s", msg);
+				ui_set_statusbar(FALSE, "%s", msg);
 				break;
 		}
 	}
@@ -1374,14 +1374,14 @@
 
 	if (! found) // no matches were found
 	{
-		ui_set_statusbar(_("No matches found for \"%s\"."), search_text);
+		ui_set_statusbar(FALSE, _("No matches found for \"%s\"."), search_text);
 		msgwin_msg_add_fmt(COLOR_BLUE, -1, -1, _("No matches found for \"%s\"."), search_text);
 	}
 	else
 	{
 		gint count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_msg), NULL);
 
-		ui_set_statusbar(_("Found %d matches for \"%s\"."), count, search_text);
+		ui_set_statusbar(FALSE, _("Found %d matches for \"%s\"."), count, search_text);
 		msgwin_msg_add_fmt(COLOR_BLUE, -1, -1, _("Found %d matches for \"%s\"."), count,
 			search_text);
 	}

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/symbols.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -950,9 +950,9 @@
 			ft = detect_global_tags_filetype(utf8_fname);
 
 			if (ft != NULL && tm_workspace_load_global_tags(fname, ft->lang))
-				msgwin_status_add(_("Loaded %s tags file '%s'."), ft->name, utf8_fname);
+				ui_set_statusbar(TRUE, _("Loaded %s tags file '%s'."), ft->name, utf8_fname);
 			else
-				msgwin_status_add(_("Could not load tags file '%s'."), utf8_fname);
+				ui_set_statusbar(TRUE, _("Could not load tags file '%s'."), utf8_fname);
 
 			g_free(utf8_fname);
 			g_free(fname);
@@ -1068,9 +1068,9 @@
 	// if we are here, there was no match and we are beeping ;-)
 	utils_beep();
 	if (type == forward_types)
-		ui_set_statusbar(_("Forward declaration \"%s\" not found."), name);
+		ui_set_statusbar(FALSE, _("Forward declaration \"%s\" not found."), name);
 	else
-		ui_set_statusbar(_("Definition of \"%s\" not found."), name);
+		ui_set_statusbar(FALSE, _("Definition of \"%s\" not found."), name);
 	return FALSE;
 }
 

Modified: trunk/src/tools.c
===================================================================
--- trunk/src/tools.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/tools.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -163,7 +163,7 @@
 		return;
 
 	argv = g_strsplit(command, " ", -1);
-	msgwin_status_add(_("Passing data and executing custom command: %s"), command);
+	ui_set_statusbar(TRUE, _("Passing data and executing custom command: %s"), command);
 
 	if (g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
 						NULL, NULL, &pid, &stdin_fd, &stdout_fd, &stderr_fd, &error))

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/ui_utils.c	2007-10-24 10:52:48 UTC (rev 1971)
@@ -74,6 +74,9 @@
 	GTimeVal timeval;
 	const gint GEANY_STATUS_TIMEOUT = 1;
 
+	if (! prefs.statusbar_visible)
+		return; // just do nothing if statusbar is not visible
+
 	g_get_current_time(&timeval);
 
 	if (! allow_override)
@@ -91,24 +94,22 @@
 }
 
 
-/* Display text on the statusbar or log it to the Status window if
- * prefs.suppress_status_messages is set */
-void ui_set_statusbar(const gchar *format, ...)
+/* Display text on the statusbar.
+ * log is whether the message should be recorded in the Status window. */
+void ui_set_statusbar(gboolean log, const gchar *format, ...)
 {
 	gchar string[512];
 	va_list args;
 
-	if (! prefs.statusbar_visible)
-		return; // just do nothing if statusbar is not visible
-
 	va_start(args, format);
 	g_vsnprintf(string, 512, format, args);
 	va_end(args);
 
-	if (prefs.suppress_status_messages)
+	if (! prefs.suppress_status_messages)
+		set_statusbar(string, FALSE);
+
+	if (log || prefs.suppress_status_messages)
 		msgwin_status_add("%s", string);
-	else
-		set_statusbar(string, FALSE);
 }
 
 
@@ -256,7 +257,7 @@
 	}
 	pango_font_description_free(font_desc);
 
-	msgwin_status_add(_("Font updated (%s)."), prefs.editor_font);
+	ui_set_statusbar(TRUE, _("Font updated (%s)."), prefs.editor_font);
 	g_free(fname);
 }
 

Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h	2007-10-23 15:23:08 UTC (rev 1970)
+++ trunk/src/ui_utils.h	2007-10-24 10:52:48 UTC (rev 1971)
@@ -102,8 +102,7 @@
 void ui_init();
 
 
-// Display text on the statusbar without logging it to the Status window.
-void ui_set_statusbar(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
+void ui_set_statusbar(gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
 
 void ui_update_statusbar(gint idx, gint pos);
 


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