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). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1971 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
90f19ceb3f
commit
601dfd69f7
13
ChangeLog
13
ChangeLog
@ -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:
|
||||
|
36
src/build.c
36
src/build.c
@ -175,7 +175,7 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
// 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 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
}
|
||||
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 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
// (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 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
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 @@ static GPid build_link_file(gint idx)
|
||||
// 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 @@ static GPid build_spawn_cmd(gint idx, const gchar *cmd, const gchar *dir)
|
||||
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 @@ static gchar *get_build_executable(const gchar *locale_filename, gboolean check_
|
||||
// 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 @@ static gchar *get_build_executable(const gchar *locale_filename, gboolean check_
|
||||
{
|
||||
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 @@ static gchar *prepare_run_script(gint idx)
|
||||
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 @@ static gchar *prepare_run_script(gint idx)
|
||||
{
|
||||
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 @@ static GPid build_run_cmd(gint idx)
|
||||
}
|
||||
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 @@ static GPid build_run_cmd(gint idx)
|
||||
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 @@ static void show_build_result_message(gboolean failure)
|
||||
}
|
||||
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 @@ static void show_build_result_message(gboolean failure)
|
||||
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 @@ on_build_execute_activate (GtkMenuItem *menuitem,
|
||||
{ // 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 @@ on_build_execute_activate (GtkMenuItem *menuitem,
|
||||
|
||||
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 @@ static void kill_process(GPid *pid)
|
||||
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 @@ on_build_next_error (GtkMenuItem *menuitem,
|
||||
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."));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ on_comments_function_activate (GtkMenuItem *menuitem,
|
||||
|
||||
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 @@ on_comments_multiline_activate (GtkMenuItem *menuitem,
|
||||
|
||||
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 @@ on_insert_date_activate (GtkMenuItem *menuitem,
|
||||
else
|
||||
{
|
||||
utils_beep();
|
||||
msgwin_status_add(
|
||||
ui_set_statusbar(TRUE,
|
||||
_("Date format string could not be converted (possibly too long)."));
|
||||
}
|
||||
}
|
||||
@ -1797,7 +1797,7 @@ on_next_message1_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
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 @@ on_context_action1_activate (GtkMenuItem *menuitem,
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,6 @@ GArray *doc_array;
|
||||
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 @@ gboolean document_remove(guint page_num)
|
||||
}
|
||||
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 @@ gint document_new_file(const gchar *filename, filetype *ft, const gchar *text)
|
||||
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 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
|
||||
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 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
|
||||
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 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
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 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
}
|
||||
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 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
}
|
||||
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 @@ gint document_open_file_full(gint idx, const gchar *filename, gint pos, gboolean
|
||||
// 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 @@ gint document_open_file_full(gint idx, const gchar *filename, gint pos, gboolean
|
||||
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 @@ gint document_open_file_full(gint idx, const gchar *filename, gint pos, gboolean
|
||||
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 @@ static gboolean document_update_timestamp(gint idx)
|
||||
#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 @@ gboolean document_save_file(gint idx, gboolean force)
|
||||
|
||||
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 @@ gboolean document_save_file(gint idx, gboolean force)
|
||||
#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 @@ gboolean document_save_file(gint idx, gboolean force)
|
||||
|
||||
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 @@ gboolean document_save_file(gint idx, gboolean force)
|
||||
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 @@ gboolean document_search_bar_find(gint idx, const gchar *text, gint flags, gbool
|
||||
{
|
||||
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 @@ gint document_find_text(gint idx, const gchar *text, gint flags, gboolean search
|
||||
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 @@ static void show_replace_summary(gint idx, gint count, const gchar *find_text,
|
||||
|
||||
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 @@ static void show_replace_summary(gint idx, gint count, const gchar *find_text,
|
||||
{ // 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 @@ void document_print(gint idx)
|
||||
}
|
||||
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);
|
||||
|
@ -100,7 +100,7 @@ typedef struct GeanyApp
|
||||
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;
|
||||
|
@ -759,7 +759,7 @@ gboolean configuration_open_files()
|
||||
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,
|
||||
|
@ -561,7 +561,7 @@ static gboolean open_cl_files(gint argc, gchar **argv)
|
||||
|
||||
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 @@ gint main(gint argc, gchar **argv)
|
||||
#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
|
||||
|
@ -291,27 +291,7 @@ void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string)
|
||||
|
||||
|
||||
/* 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 @@ void msgwin_status_add(const gchar *format, ...)
|
||||
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)
|
||||
|
@ -139,28 +139,10 @@ static UtilsFuncs utils_funcs = {
|
||||
&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 @@ static SupportFuncs support_funcs = {
|
||||
&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
|
||||
|
@ -280,7 +280,7 @@ void project_close()
|
||||
/// 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 @@ static gboolean update_config(const PropertyDialogElements *e)
|
||||
}
|
||||
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 @@ gboolean project_load_file(const gchar *locale_file_name)
|
||||
|
||||
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;
|
||||
|
24
src/search.c
24
src/search.c
@ -873,9 +873,9 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
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 @@ on_replace_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
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 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response, gpointer user
|
||||
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 @@ on_find_in_files_dialog_response(GtkDialog *dialog, gint response, gpointer user
|
||||
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 @@ search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *op
|
||||
|
||||
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 @@ search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *op
|
||||
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 @@ static gchar **search_get_argv(const gchar **argv_prefix, const gchar *dir)
|
||||
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 @@ static void search_close_pid(GPid child_pid, gint status, gpointer user_data)
|
||||
|
||||
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 @@ static void search_close_pid(GPid child_pid, gint status, gpointer user_data)
|
||||
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 @@ void search_find_usage(const gchar *search_text, gint flags, gboolean in_session
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -950,9 +950,9 @@ void symbols_show_load_tags_dialog()
|
||||
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 @@ gboolean symbols_goto_tag(const gchar *name, gboolean definition)
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ void tools_execute_custom_command(gint idx, const gchar *command)
|
||||
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))
|
||||
|
@ -74,6 +74,9 @@ static void set_statusbar(const gchar *text, gboolean allow_override)
|
||||
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 @@ static void set_statusbar(const gchar *text, gboolean allow_override)
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
msgwin_status_add("%s", string);
|
||||
else
|
||||
if (! prefs.suppress_status_messages)
|
||||
set_statusbar(string, FALSE);
|
||||
|
||||
if (log || prefs.suppress_status_messages)
|
||||
msgwin_status_add("%s", string);
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +257,7 @@ void ui_set_editor_font(const gchar *font_name)
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,7 @@ void ui_table_add_row(GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user