66#ifdef HAVE_SYS_TYPES_H
67# include <sys/types.h>
73#include <glib/gstdio.h>
80#include <gdk/gdkkeysyms.h>
83#define USE_GIO_FILE_OPERATIONS (!file_prefs.use_safe_file_saving && file_prefs.use_gio_unsafe_file_saving)
116 void (*response_cb)(GtkWidget *info_bar, gint response_id,
GeanyDocument *doc),
117 const gchar *btn_1, GtkResponseType response_1,
118 const gchar *btn_2, GtkResponseType response_2,
119 const gchar *btn_3, GtkResponseType response_3,
120 const gchar *extra_text,
const gchar *
format, ...) G_GNUC_PRINTF(11, 12);
189 g_return_val_if_fail(utf8_filename !=
NULL,
NULL);
269 g_return_val_if_fail(doc !=
NULL,
NULL);
272 parent = gtk_widget_get_parent(child);
274 while (parent && ! GTK_IS_NOTEBOOK(parent))
277 parent = gtk_widget_get_parent(child);
304 GList *children, *iter;
306 g_return_val_if_fail(GTK_IS_CONTAINER(container),
NULL);
308 children = gtk_container_get_children(GTK_CONTAINER(container));
309 for (iter = children; iter !=
NULL; iter = g_list_next(iter))
311 if (IS_SCINTILLA(iter->data))
313 sci = SCINTILLA(iter->data);
316 else if (GTK_IS_CONTAINER(iter->data))
319 if (IS_SCINTILLA(
sci))
324 g_list_free(children);
333 ScintillaObject *
sci;
335 g_return_val_if_fail(GTK_IS_BOX(page),
NULL);
338 g_return_val_if_fail(IS_SCINTILLA(
sci),
NULL);
414 gchar *base_name, *short_name;
416 g_return_val_if_fail(doc !=
NULL,
NULL);
435 g_return_if_fail(doc !=
NULL);
441 parent = gtk_widget_get_parent(parent);
443 gtk_label_set_text(GTK_LABEL(doc->
priv->
tab_label), short_name);
462 g_return_if_fail(doc !=
NULL);
505 gtk_widget_queue_draw(GTK_WIDGET(doc->
editor->
sci));
509#ifdef USE_GIO_FILEMON
510static void monitor_file_changed_cb(G_GNUC_UNUSED GFileMonitor *monitor, G_GNUC_UNUSED GFile *file,
511 G_GNUC_UNUSED GFile *other_file, GFileMonitorEvent event,
514 g_return_if_fail(doc !=
NULL);
519 geany_debug(
"%s: event: %d previous file status: %d",
523 case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
529 g_message(
"%s: FILE_CHANGED", G_STRFUNC);
532 case G_FILE_MONITOR_EVENT_DELETED:
535 g_message(
"%s: FILE_MISSING", G_STRFUNC);
551 g_return_if_fail(doc !=
NULL);
563 g_return_if_fail(doc !=
NULL);
568#ifdef USE_GIO_FILEMON
569 gchar *locale_filename;
575 if (locale_filename !=
NULL && g_file_test(locale_filename, G_FILE_TEST_EXISTS))
578 GFile *file = g_file_new_for_path(locale_filename);
581 G_CALLBACK(monitor_file_changed_cb), doc);
586 g_object_unref(file);
588 g_free(locale_filename);
603 if (source_widget ==
NULL)
606 if (focusw == source_widget)
607 gtk_widget_grab_focus(
sci);
651 doc->
index = new_idx;
652 doc->
file_name = g_strdup(utf8_filename);
654#ifndef USE_GIO_FILEMON
666 GtkTreeSelection *sel;
669 gtk_tree_selection_select_iter(sel, &doc->
priv->
iter);
691 g_return_val_if_fail(doc, FALSE);
703 g_return_val_if_fail(doc !=
NULL, FALSE);
710 g_signal_emit_by_name(
geany_object,
"document-close", doc);
786 if (done &&
ui_prefs.new_document_after_close)
828 if (utf8_filename && g_path_is_absolute(utf8_filename))
837 g_assert(doc !=
NULL);
842 GString *
template = g_string_new(
text);
846 g_string_free(
template, TRUE);
860 if (ft ==
NULL && utf8_filename !=
NULL)
878#ifdef USE_GIO_FILEMON
887 g_signal_emit_by_name(
geany_object,
"document-new", doc);
926static gboolean
get_mtime(
const gchar *locale_filename, time_t *time)
929 const gchar *err_msg =
NULL;
933 GFile *file = g_file_new_for_path(locale_filename);
934 GFileInfo *info = g_file_query_info(file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE,
NULL, &
error);
940 g_file_info_get_modification_time(info, &timeval);
941 g_object_unref(info);
942 *time = timeval.tv_sec;
945 err_msg =
error->message;
947 g_object_unref(file);
953 if (g_stat(locale_filename, &st) == 0)
956 err_msg = g_strerror(
errno);
964 utf8_filename, err_msg);
965 g_free(utf8_filename);
971 return err_msg ==
NULL;
976static gboolean
load_text_file(
const gchar *locale_filename,
const gchar *display_filename,
977 FileData *filedata,
const gchar *forced_enc)
984 filedata->
bom = FALSE;
992 GFile *file = g_file_new_for_path(locale_filename);
994 g_file_load_contents(file,
NULL, &filedata->
data, &filedata->
len,
NULL, &err);
995 g_object_unref(file);
998 g_file_get_contents(locale_filename, &filedata->
data, &filedata->
len, &err);
1013 display_filename, forced_enc);
1018 _(
"The file \"%s\" does not look like a text file or the file encoding is not supported."),
1021 g_free(filedata->
data);
1027 const gchar *warn_msg =
_(
1028 "The file \"%s\" could not be opened properly and has been truncated. " \
1029 "This can occur if the file contains a NULL byte. " \
1030 "Be aware that saving it can cause data loss.\nThe file was set to read-only.");
1078 ScintillaObject *
sci = editor->
sci;
1081 gchar *soft_tab = g_strnfill((gsize)iprefs->
width,
' ');
1082 gchar *regex = g_strconcat(
"^\t+", soft_tab,
"[^ ]",
NULL);
1110 ScintillaObject *
sci = editor->
sci;
1111 gint
line, line_count;
1112 gsize
tabs = 0, spaces = 0;
1138 if (spaces == 0 &&
tabs == 0)
1142 if (spaces >
tabs * 4)
1144 else if (
tabs > spaces * 4)
1158 ScintillaObject *
sci = editor->
sci;
1159 gint
line, line_count;
1160 gint widths[7] = { 0 };
1161 gint
count, width, i;
1192 for (i = G_N_ELEMENTS(widths) - 1; i >= 0; i--)
1194 if ((width % (i + 2)) == 0)
1199 width = iprefs->
width;
1200 for (i = G_N_ELEMENTS(widths) - 1; i >= 0; i--)
1203 if (widths[i] >=
count * 1.5)
1229 gint width = iprefs->
width;
1233 if (type != iprefs->
type)
1246 name =
_(
"Tabs and Spaces");
1260 if (width != iprefs->
width)
1286 gboolean readonly,
GeanyFiletype *ft,
const gchar *forced_enc)
1289 gboolean
reload = (doc ==
NULL) ? FALSE : TRUE;
1290 gchar *utf8_filename =
NULL;
1291 gchar *display_filename =
NULL;
1292 gchar *locale_filename =
NULL;
1296 gboolean add_undo_reload_action;
1302 utf8_filename = g_strdup(doc->
file_name);
1312 locale_filename = win32_get_shortcut_target(
filename);
1314 locale_filename = g_strdup(
filename);
1336 if (!
load_text_file(locale_filename, display_filename, &filedata, forced_enc))
1338 g_free(display_filename);
1339 g_free(utf8_filename);
1340 g_free(locale_filename);
1347 g_return_val_if_fail(doc !=
NULL,
NULL);
1360 undo_reload_data =
NULL;
1379 add_undo_reload_action = FALSE;
1389 if (undo_reload_data)
1393 if (editor_mode != undo_reload_data->
eol_mode)
1394 add_undo_reload_action = TRUE;
1397 g_free(filedata.
data);
1403 if (undo_reload_data)
1436 if (undo_reload_data)
1451 if (undo_reload_data->
actions_count > 0 || add_undo_reload_action)
1454 g_free(undo_reload_data);
1485 g_signal_emit_by_name(
geany_object,
"document-reload", doc);
1490 g_signal_emit_by_name(
geany_object,
"document-open", doc);
1496 (readonly) ?
_(
", read-only") :
"");
1503 g_free(display_filename);
1504 g_free(utf8_filename);
1505 g_free(locale_filename);
1526 g_return_if_fail(data !=
NULL);
1531 for (i = 0;
list[i] !=
NULL &&
list[i][0] !=
'\0'; i++)
1556 const gchar *forced_enc)
1560 for (item = filenames; item !=
NULL; item = g_slist_next(item))
1569 if (response_id == GTK_RESPONSE_NO)
1574 else if (response_id == GTK_RESPONSE_CANCEL)
1581 gtk_widget_destroy(bar);
1601 g_return_val_if_fail(doc !=
NULL, FALSE);
1619 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
1620 _(
"Discard history"), GTK_RESPONSE_NO,
1621 NULL, 0,
_(
"The buffer's previous state is stored in the history and "
1622 "undoing restores it. You can disable this by discarding the history upon "
1623 "reload. This message will not be displayed again but "
1624 "your choice can be changed in the various preferences."),
1625 _(
"The file has been reloaded."));
1630 return (new_doc !=
NULL);
1638 gboolean prompt, result = FALSE;
1640 g_return_val_if_fail(doc !=
NULL, FALSE);
1646 if (forced_enc ==
NULL)
1649 base_name = g_path_get_basename(doc->
file_name);
1655 doc->
changed ?
_(
"Any unsaved changes will be lost.") :
1656 _(
"Undo history will be lost."),
1657 _(
"Are you sure you want to reload '%s'?"), base_name))
1660 if (forced_enc !=
NULL)
1670#ifndef USE_GIO_FILEMON
1671 g_return_if_fail(doc !=
NULL);
1689 *column = byte_pos - line_start;
1693 for (i = line_start; i < (line_start + *column); i++)
1710 g_return_if_fail(doc !=
NULL);
1715 SETPTR(filebase, g_strconcat(
"\\b", filebase,
"\\.\\w+",
NULL));
1717 SETPTR(filebase, g_strconcat(
"\\b", filebase,
"\\b",
NULL));
1759 result = g_rename(old_locale_filename, new_locale_filename);
1763 _(
"Error renaming file."), g_strerror(
errno));
1765 g_free(old_locale_filename);
1766 g_free(new_locale_filename);
1797 g_return_val_if_fail(doc !=
NULL, FALSE);
1820 g_return_val_if_fail(doc !=
NULL, FALSE);
1823 if (utf8_fname !=
NULL)
1869 GError *conv_error =
NULL;
1870 gchar* conv_file_contents =
NULL;
1874 g_return_val_if_fail(data !=
NULL && *data !=
NULL, FALSE);
1875 g_return_val_if_fail(len !=
NULL, FALSE);
1878 conv_file_contents = g_convert(*data, *len - 1, doc->
encoding,
"UTF-8",
1879 &bytes_read, &conv_len, &conv_error);
1881 if (conv_error !=
NULL)
1883 gchar *
text = g_strdup_printf(
1884_(
"An error occurred while converting the file from UTF-8 in \"%s\". The file remains unsaved."),
1888 if (conv_error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
1894 gint max_len = MIN((gint)bytes_read + 6, (gint)*len - 1);
1899 unic = g_utf8_get_char_validated(context, -1);
1900 context_len = g_unichar_to_utf8(unic, context);
1901 context[context_len] =
'\0';
1904 error_text = g_strdup_printf(
1905 _(
"Error message: %s\nThe error occurred at \"%s\" (line: %d, column: %d)."),
1906 conv_error->message, context,
line + 1, column);
1909 error_text = g_strdup_printf(
_(
"Error message: %s."), conv_error->message);
1911 geany_debug(
"encoding error: %s", conv_error->message);
1913 g_error_free(conv_error);
1921 *data = conv_file_contents;
1929 const gchar *data, gsize len)
1937 if (g_file_set_contents(locale_filename, data, len, &
error))
1938 geany_debug(
"Wrote %s with g_file_set_contents().", locale_filename);
1947 fp = g_file_new_for_path(locale_filename);
1956 gchar *display_name = g_filename_display_name(locale_filename);
1961 fp = g_fopen(locale_filename,
"wb");
1968 g_file_error_from_errno(save_errno),
1969 _(
"Failed to open file '%s' for writing: fopen() failed: %s"),
1971 g_strerror(save_errno));
1975 gsize bytes_written;
1978 bytes_written = fwrite(data,
sizeof(gchar), len, fp);
1980 if (len != bytes_written)
1986 g_file_error_from_errno(save_errno),
1987 _(
"Failed to write file '%s': fwrite() failed: %s"),
1989 g_strerror(save_errno));
2000 g_file_error_from_errno(save_errno),
2001 _(
"Failed to close file '%s': fclose() failed: %s"),
2003 g_strerror(save_errno));
2007 g_free(display_name);
2011 gchar *msg = g_strdup(
error->message);
2012 g_error_free(
error);
2021 const gchar *data, gsize len)
2025 g_return_val_if_fail(doc !=
NULL, g_strdup(g_strerror(EINVAL)));
2026 g_return_val_if_fail(data !=
NULL, g_strdup(g_strerror(EINVAL)));
2045 GtkWidget *bar =
NULL;
2053 _(
"The file '%s' on the disk is more recent than the current buffer."),
2061 _(
"Try to resave the file?"),
2062 _(
"File \"%s\" was not found on disk!"),
2069 g_assert_not_reached();
2108 gchar *locale_filename;
2111 g_return_val_if_fail(doc !=
NULL, FALSE);
2125 _(
"Cannot save read-only document '%s'!"),
DOC_FILENAME(doc));
2147 g_signal_emit_by_name(
geany_object,
"document-before-save", doc);
2154 data = (gchar*) g_malloc(len + 3);
2155 data[0] = (gchar) 0xef;
2156 data[1] = (gchar) 0xbb;
2157 data[2] = (gchar) 0xbf;
2163 data = (gchar*) g_malloc(len);
2188 errmsg =
save_doc(doc, locale_filename, data, len);
2198 g_strdup_printf(
_(
"%s\n\nThe file on disk may now be truncated!"), errmsg));
2203 g_free(locale_filename);
2230 g_free(locale_filename);
2232 g_signal_emit_by_name(
geany_object,
"document-save", doc);
2244 gint start_pos, search_pos;
2247 g_return_val_if_fail(
text !=
NULL, FALSE);
2248 g_return_val_if_fail(doc !=
NULL, FALSE);
2262 if (search_pos == -1)
2277 if (search_pos != -1)
2319 gboolean scroll, GtkWidget *parent)
2321 gint selection_end, selection_start, search_pos;
2329 search_backwards = FALSE;
2332 original_text =
text;
2336 if ((selection_end - selection_start) > 0)
2338 if (search_backwards)
2345 if (search_backwards)
2350 if (search_pos != -1)
2363 if ((selection_end == 0 && ! search_backwards) ||
2364 (selection_end == sci_len && search_backwards))
2374 _(
"Wrap search and find again?"),
_(
"\"%s\" was not found."), original_text))
2398 const gchar *replace_text,
GeanyFindFlags flags, gboolean search_backwards)
2400 gint selection_end, selection_start, search_pos;
2403 g_return_val_if_fail(doc !=
NULL && find_text !=
NULL && replace_text !=
NULL, -1);
2410 search_backwards = FALSE;
2412 if (!original_find_text)
2413 original_find_text = find_text;
2417 if (selection_end == selection_start)
2425 if (search_backwards)
2432 if (search_pos != selection_start)
2434 if (search_pos != -1)
2439 if (search_pos != -1)
2457 const gchar *original_replace_text)
2469 "%s: replaced %d occurrence of \"%s\" with \"%s\".",
2470 "%s: replaced %d occurrences of \"%s\" with \"%s\".",
2484 GeanyFindFlags flags, gint start, gint end, gboolean scroll_to_match, gint *new_range_end)
2488 ScintillaObject *
sci;
2490 if (new_range_end !=
NULL)
2491 *new_range_end = -1;
2493 g_return_val_if_fail(doc !=
NULL && find_text !=
NULL && replace_text !=
NULL, 0);
2510 if (scroll_to_match)
2513 if (new_range_end !=
NULL)
2521 const gchar *original_find_text,
const gchar *original_replace_text,
GeanyFindFlags flags)
2523 gint selection_end, selection_start, selection_mode, selected_lines, last_line = 0;
2524 gint max_column = 0,
count = 0;
2525 gboolean replaced = FALSE;
2527 g_return_if_fail(doc !=
NULL && find_text !=
NULL && replace_text !=
NULL);
2535 if ((selection_end - selection_start) == 0)
2546 gint first_line,
line;
2554 last_line =
MAX(first_line, last_line);
2555 for (
line = first_line;
line < (first_line + selected_lines);
line++)
2567 line_start, line_end, FALSE, &new_sel_end);
2568 if (new_sel_end != -1)
2572 max_column =
MAX(max_column,
2582 selection_start, selection_end, TRUE, &selection_end);
2583 if (selection_end != -1)
2624 const gchar *original_find_text,
const gchar *original_replace_text,
GeanyFindFlags flags)
2627 g_return_val_if_fail(doc !=
NULL && find_text !=
NULL && replace_text !=
NULL, FALSE);
2634 doc, find_text, replace_text, flags, 0, len, TRUE,
NULL);
2674 g_free(locale_filename);
2704 GString *keywords_str;
2741 gchar *keywords = g_string_free(keywords_str, FALSE);
2742 guint hash = g_str_hash(keywords);
2787 gboolean filetype_changed)
2789 g_return_if_fail(doc);
2793 if (filetype_changed)
2828 gboolean ft_changed;
2831 g_return_if_fail(doc);
2859 g_signal_emit_by_name(
geany_object,
"document-filetype-set", doc, old_ft);
2881 if (doc ==
NULL || new_encoding ==
NULL ||
2886 doc->
encoding = g_strdup(new_encoding);
2901 while (g_trash_stack_height(stack) > 0)
2905 if (G_LIKELY(a !=
NULL))
2911 g_free(a->
data);
break;
2939 g_return_if_fail(doc !=
NULL);
2942 action->
type = type;
2943 action->
data = data;
2966 g_return_val_if_fail(doc !=
NULL, FALSE);
2989 g_return_if_fail(doc !=
NULL);
2993 if (G_UNLIKELY(action ==
NULL))
3001 switch (action->
type)
3025 g_free(action->
data);
3085 g_return_val_if_fail(doc !=
NULL, FALSE);
3098 g_return_if_fail(doc !=
NULL);
3102 if (G_UNLIKELY(action ==
NULL))
3110 switch (action->
type)
3142 g_free(action->
data);
3195 g_return_if_fail(doc !=
NULL);
3198 action->
type = type;
3199 action->
data = data;
3223 {
"geany-document-status-changed", {0}, FALSE },
3224 {
"geany-document-status-disk-changed", {0}, FALSE },
3225 {
"geany-document-status-readonly", {0}, FALSE }
3233#ifdef USE_GIO_FILEMON
3253 g_return_val_if_fail(doc !=
NULL,
NULL);
3280 g_return_val_if_fail(doc !=
NULL,
NULL);
3288 GtkWidgetPath *path = gtk_widget_path_new();
3289 GtkStyleContext *ctx = gtk_style_context_new();
3290 gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
3291 gtk_widget_path_append_type(path, GTK_TYPE_BOX);
3292 gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
3293 gtk_widget_path_append_type(path, GTK_TYPE_LABEL);
3295 gtk_style_context_set_screen(ctx, gtk_widget_get_screen(GTK_WIDGET(doc->
editor->
sci)));
3296 gtk_style_context_set_path(ctx, path);
3297 gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &
color);
3302 gtk_widget_path_unref(path);
3303 g_object_unref(ctx);
3327 ScintillaObject *old_sci;
3329 g_return_val_if_fail(old_doc,
NULL);
3362 guint p, page_count;
3366 for (p = 0; p < page_count; p++)
3433 void (*response_cb)(GtkWidget *info_bar, gint response_id,
GeanyDocument *doc),
3434 const gchar *btn_1, GtkResponseType response_1,
3435 const gchar *btn_2, GtkResponseType response_2,
3436 const gchar *btn_3, GtkResponseType response_3,
3437 const gchar *extra_text,
const gchar *
format, ...)
3440 gchar *
text, *markup;
3441 GtkWidget *hbox, *icon, *
label, *content_area;
3442 GtkWidget *info_widget, *parent;
3449 markup = g_markup_printf_escaped(
"<span size=\"larger\">%s</span>",
text);
3452 info_widget = gtk_info_bar_new();
3454 gtk_box_pack_start(GTK_BOX(parent), info_widget, FALSE, TRUE, 0);
3456 gtk_info_bar_set_message_type(GTK_INFO_BAR(info_widget), msgtype);
3459 gtk_info_bar_add_button(GTK_INFO_BAR(info_widget), btn_1, response_1);
3461 gtk_info_bar_add_button(GTK_INFO_BAR(info_widget), btn_2, response_2);
3463 gtk_info_bar_add_button(GTK_INFO_BAR(info_widget), btn_3, response_3);
3465 content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_widget));
3468 gtk_label_set_markup(GTK_LABEL(
label), markup);
3471 g_signal_connect(info_widget,
"response", G_CALLBACK(response_cb), doc);
3473 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
3474 gtk_box_pack_start(GTK_BOX(content_area), hbox, TRUE, TRUE, 0);
3478 case GTK_MESSAGE_INFO:
3479 icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
3481 case GTK_MESSAGE_WARNING:
3482 icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
3484 case GTK_MESSAGE_QUESTION:
3485 icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
3487 case GTK_MESSAGE_ERROR:
3488 icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
3496 gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, TRUE, 0);
3500 GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
3503 gtk_box_pack_start(GTK_BOX(vbox),
label, TRUE, TRUE, 0);
3504 gtk_box_pack_start(GTK_BOX(vbox), extra_label, TRUE, TRUE, 0);
3505 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
3508 gtk_box_pack_start(GTK_BOX(hbox),
label, TRUE, TRUE, 0);
3510 gtk_box_reorder_child(GTK_BOX(parent), info_widget, 0);
3520 gboolean
close = FALSE;
3536 else if (response_id == GTK_RESPONSE_CANCEL)
3547 gtk_widget_destroy(bar);
3551static gboolean
on_sci_key(GtkWidget *widget, GdkEventKey *event, gpointer data)
3553 GtkInfoBar *bar = GTK_INFO_BAR(data);
3555 g_return_val_if_fail(event->type == GDK_KEY_PRESS, FALSE);
3557 switch (event->keyval)
3560 case GDK_KEY_ISO_Left_Tab:
3562 GtkWidget *action_area = gtk_info_bar_get_action_area(bar);
3563 GtkDirectionType dir =
event->keyval == GDK_KEY_Tab ? GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD;
3564 gtk_widget_child_focus(action_area, dir);
3567 case GDK_KEY_Escape:
3569 gtk_info_bar_response(bar, GTK_RESPONSE_CANCEL);
3582 g_signal_connect_object(bar,
"destroy", G_CALLBACK(gtk_widget_grab_focus), doc->
editor->
sci,
3584 g_signal_connect_object(doc->
editor->
sci,
"key-press-event", G_CALLBACK(
on_sci_key), bar, 0);
3596 gchar *base_name = g_path_get_basename(doc->
file_name);
3606 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
3607 _(
"Do you want to reload it?"),
3608 _(
"The file '%s' on the disk is more recent than the current buffer."),
3623 gboolean
close = TRUE;
3633 gtk_widget_destroy(bar);
3650 gtk_info_bar_response(GTK_INFO_BAR(bar), GTK_RESPONSE_CANCEL);
3655 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
3656 NULL, GTK_RESPONSE_NONE,
3657 _(
"Try to resave the file?"),
3658 _(
"File \"%s\" was not found on disk!"),
3676 gboolean ret = FALSE;
3677 gboolean use_gio_filemon;
3679 gchar *locale_filename;
3682 g_return_val_if_fail(doc !=
NULL, FALSE);
3691 if (use_gio_filemon)
3698 time_t cur_time = time(
NULL);
3707 if (!
get_mtime(locale_filename, &mtime))
3721 g_free(locale_filename);
3750 gchar *base_name_a, *base_name_b;
3753 base_name_a = g_path_get_basename(
DOC_FILENAME(doc_a));
3754 base_name_b = g_path_get_basename(
DOC_FILENAME(doc_b));
3756 result = strcmp(base_name_a, base_name_b);
3758 g_free(base_name_a);
3759 g_free(base_name_b);
3780 gint notebook_position_doc_a;
3781 gint notebook_position_doc_b;
3786 if (notebook_position_doc_a < notebook_position_doc_b)
3788 if (notebook_position_doc_a > notebook_position_doc_b)
3814 g_return_if_fail(doc !=
NULL);
3816 gtk_widget_grab_focus(GTK_WIDGET(doc->
editor->
sci));
3819static void *
copy_(
void *src) {
return src; }
3834 return g_datalist_get_data(&doc->
priv->
data, key);
3840 g_datalist_set_data(&doc->
priv->
data, key, data);
3845 gpointer data, GDestroyNotify free_func)
3847 g_datalist_set_data_full(&doc->
priv->
data, key, data, free_func);
#define SCI_GETCHARACTERPOINTER
void build_menu_update(GeanyDocument *doc)
gboolean dialogs_show_question_full(GtkWidget *parent, const gchar *yes_btn, const gchar *no_btn, const gchar *extra_text, const gchar *main_text,...)
gboolean dialogs_show_save_as(void)
Shows the Save As dialog for the current notebook page.
gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
void dialogs_show_msgbox(GtkMessageType type, const gchar *text,...)
Shows a message box of the type type with text.
void dialogs_show_msgbox_with_secondary(GtkMessageType type, const gchar *text, const gchar *secondary)
File related dialogs, miscellaneous dialogs, font dialog.
static void on_keep_edit_history_on_reload_response(GtkWidget *bar, gint response_id, GeanyDocument *doc)
GeanyDocument * document_index(gint idx)
Accessor function for GeanyData::documents_array items.
static void show_replace_summary(GeanyDocument *doc, gint count, const gchar *original_find_text, const gchar *original_replace_text)
GType document_get_type(void)
GeanyDocument * document_get_current(void)
Finds the current document.
void document_init_doclist(void)
static gboolean on_document_update_tag_list_idle(gpointer data)
static gboolean detect_tabs_and_spaces(GeanyEditor *editor)
void document_update_tags(GeanyDocument *doc)
GeanyDocument * document_open_file_full(GeanyDocument *doc, const gchar *filename, gint pos, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
static gboolean save_file_handle_infobars(GeanyDocument *doc, gboolean force)
static GtkWidget * document_show_message(GeanyDocument *doc, GtkMessageType msgtype, void(*response_cb)(GtkWidget *info_bar, gint response_id, GeanyDocument *doc), const gchar *btn_1, GtkResponseType response_1, const gchar *btn_2, GtkResponseType response_2, const gchar *btn_3, GtkResponseType response_3, const gchar *extra_text, const gchar *format,...)
void document_redo(GeanyDocument *doc)
static void get_line_column_from_pos(GeanyDocument *doc, guint byte_pos, gint *line, gint *column)
gboolean document_close_all(void)
static void force_close_all(void)
static GtkWidget * document_get_notebook_child(GeanyDocument *doc)
static void monitor_file_setup(GeanyDocument *doc)
GeanyDocument * document_clone(GeanyDocument *old_doc)
gint document_find_text(GeanyDocument *doc, const gchar *text, const gchar *original_text, GeanyFindFlags flags, gboolean search_backwards, GeanyMatchInfo **match_, gboolean scroll, GtkWidget *parent)
gboolean document_can_redo(GeanyDocument *doc)
GeanyDocument * document_new_file_if_non_open(void)
void document_grab_focus(GeanyDocument *doc)
void document_undo_add(GeanyDocument *doc, guint type, gpointer data)
void document_set_encoding(GeanyDocument *doc, const gchar *new_encoding)
Sets the encoding of a document.
static void store_saved_encoding(GeanyDocument *doc)
static void unprotect_document(GeanyDocument *doc)
void document_set_data_full(GeanyDocument *doc, const gchar *key, gpointer data, GDestroyNotify free_func)
static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar)
static void monitor_reload_file(GeanyDocument *doc)
const GdkColor * document_get_status_color(GeanyDocument *doc)
Gets the status color of the document, or NULL if default widget coloring should be used.
gboolean document_save_file_as(GeanyDocument *doc, const gchar *utf8_fname)
Saves the document, detecting the filetype.
static gsize save_convert_to_encoding(GeanyDocument *doc, gchar **data, gsize *len)
static guint doc_id_counter
GeanyDocument * document_get_from_notebook_child(GtkWidget *page)
static gchar * save_doc(GeanyDocument *doc, const gchar *locale_filename, const gchar *data, gsize len)
static void * copy_(void *src)
GeanyDocument * document_get_from_page(guint page_num)
Finds the document for the given notebook page page_num.
gint document_get_notebook_page(GeanyDocument *doc)
Gets the notebook page index for a document.
static void protect_document(GeanyDocument *doc)
G_DEFINE_BOXED_TYPE(GeanyDocument, document, copy_, free_)
gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gboolean inc, gboolean backwards)
void document_highlight_tags(GeanyDocument *doc)
void document_show_tab(GeanyDocument *doc)
@ RESPONSE_DOCUMENT_RELOAD
gboolean document_reload_force(GeanyDocument *doc, const gchar *forced_enc)
Reloads the document with the specified file encoding.
gboolean document_check_disk_status(GeanyDocument *doc, gboolean force)
static void queue_colourise(GeanyDocument *doc)
static void free_(void *doc)
static guint document_replace_range(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, GeanyFindFlags flags, gint start, gint end, gboolean scroll_to_match, gint *new_range_end)
GeanyDocument * document_find_by_sci(ScintillaObject *sci)
gboolean document_detect_indent_type(GeanyDocument *doc, GeanyIndentType *type_)
gboolean document_save_file(GeanyDocument *doc, gboolean force)
Saves the document.
void document_try_focus(GeanyDocument *doc, GtkWidget *source_widget)
gpointer document_get_data(const GeanyDocument *doc, const gchar *key)
void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type)
Sets the filetype of the document (which controls syntax highlighting and tags)
void document_rename_file(GeanyDocument *doc, const gchar *new_filename)
Renames the file in doc to new_filename.
gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gchar *original_find_text, const gchar *replace_text, GeanyFindFlags flags, gboolean search_backwards)
static void on_monitor_resave_missing_file_response(GtkWidget *bar, gint response_id, GeanyDocument *doc)
gint document_compare_by_display_name(gconstpointer a, gconstpointer b)
Compares documents by their display names.
static void document_redo_add(GeanyDocument *doc, guint type, gpointer data)
static gchar * write_data_to_disk(const gchar *locale_filename, const gchar *data, gsize len)
void document_update_tag_list_in_idle(GeanyDocument *doc)
void document_apply_indent_settings(GeanyDocument *doc)
static gboolean get_mtime(const gchar *locale_filename, time_t *time)
static void replace_header_filename(GeanyDocument *doc)
gint document_compare_by_tab_order(gconstpointer a, gconstpointer b)
Compares documents by their tab order.
static ScintillaObject * locate_sci_in_container(GtkWidget *container)
gboolean document_need_save_as(GeanyDocument *doc)
static gint set_cursor_position(GeanyEditor *editor, gint pos)
const gchar * document_get_status_widget_class(GeanyDocument *doc)
static void monitor_resave_missing_file(GeanyDocument *doc)
gboolean document_account_for_unsaved(void)
static gint document_get_status_id(GeanyDocument *doc)
static void document_stop_file_monitoring(GeanyDocument *doc)
static void document_update_timestamp(GeanyDocument *doc, const gchar *locale_filename)
static gint document_get_new_idx(void)
GeanyDocument * document_find_by_filename(const gchar *utf8_filename)
Finds a document with the given filename.
static GeanyDocument * document_create(const gchar *utf8_filename)
GeanyFilePrefs file_prefs
static gboolean load_text_file(const gchar *locale_filename, const gchar *display_filename, FileData *filedata, const gchar *forced_enc)
void document_reload_config(GeanyDocument *doc)
static gboolean on_idle_focus(gpointer doc)
static gboolean on_sci_key(GtkWidget *widget, GdkEventKey *event, gpointer data)
static void document_undo_clear(GeanyDocument *doc)
static void update_changed_state(GeanyDocument *doc)
void document_open_files(const GSList *filenames, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens each file in the list filenames.
static void document_undo_add_internal(GeanyDocument *doc, guint type, gpointer data)
void document_undo(GeanyDocument *doc)
void document_set_data(GeanyDocument *doc, const gchar *key, gpointer data)
gboolean document_can_undo(GeanyDocument *doc)
#define USE_GIO_FILE_OPERATIONS
gchar * document_get_basename_for_display(GeanyDocument *doc, gint length)
Returns the last part of the filename of the given GeanyDocument.
GeanyDocument * document_open_file(const gchar *locale_filename, gboolean readonly, GeanyFiletype *ft, const gchar *forced_enc)
Opens a document specified by locale_filename.
static gchar * get_real_path_from_utf8(const gchar *utf8_filename)
GPtrArray * documents_array
gboolean document_detect_indent_width(GeanyDocument *doc, gint *width_)
static gboolean remove_page(guint page_num)
void document_open_file_list(const gchar *data, gsize length)
static void document_load_config(GeanyDocument *doc, GeanyFiletype *type, gboolean filetype_changed)
static struct @86 document_status_styles[]
static void document_undo_clear_stack(GTrashStack **stack)
GeanyDocument * document_find_by_id(guint id)
Lookup an old document by its ID.
gboolean document_reload_prompt(GeanyDocument *doc, const gchar *forced_enc)
gboolean document_remove_page(guint page_num)
Removes the given notebook tab at page_num and clears all related information in the document list.
void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
gboolean document_close(GeanyDocument *doc)
Closes the given document.
GeanyDocument * document_find_by_real_path(const gchar *realname)
Finds a document whose real_path field matches the given filename.
static void on_monitor_reload_file_response(GtkWidget *bar, gint response_id, GeanyDocument *doc)
gint document_compare_by_tab_order_reverse(gconstpointer a, gconstpointer b)
Compares documents by their tab order, in reverse order.
void document_update_tab_label(GeanyDocument *doc)
gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gchar *replace_text, const gchar *original_find_text, const gchar *original_replace_text, GeanyFindFlags flags)
void document_set_text_changed(GeanyDocument *doc, gboolean changed)
Updates the tab labels, the status bar, the window title and some save-sensitive buttons according to...
static gboolean detect_indent_width(GeanyEditor *editor, GeanyIndentType type, gint *width_)
GeanyDocument * document_new_file(const gchar *utf8_filename, GeanyFiletype *ft, const gchar *text)
Creates a new document.
void document_finalize(void)
Document related actions: new, save, open, etc.
#define DOC_VALID(doc_ptr)
Null-safe way to check GeanyDocument::is_valid.
#define DOC_FILENAME(doc)
Returns the filename of the document passed or GEANY_STRING_UNTITLED (e.g.
#define documents
Wraps GeanyData::documents_array so it can be used with C array syntax.
#define foreach_document(i)
Iterates all valid document indexes.
gint editor_get_eol_char_mode(GeanyEditor *editor)
Retrieves the end of line characters mode (LF, CR/LF, CR) in the given editor.
gboolean editor_line_in_view(GeanyEditor *editor, gint line)
GeanyEditor * editor_create(GeanyDocument *doc)
const GeanyIndentPrefs * editor_get_indent_prefs(GeanyEditor *editor)
Gets the indentation prefs for the editor.
void editor_replace_tabs(GeanyEditor *editor, gboolean ignore_selection)
void editor_scroll_to_line(GeanyEditor *editor, gint line, gfloat percent_of_view)
void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width)
void editor_sci_notify_cb(G_GNUC_UNUSED GtkWidget *widget, G_GNUC_UNUSED gint scn, gpointer scnt, gpointer data)
gint editor_get_eol_char_len(GeanyEditor *editor)
Retrieves the length of the used end of line characters (LF, CR/LF, CR) in the given editor.
void editor_ensure_final_newline(GeanyEditor *editor)
void editor_strip_trailing_spaces(GeanyEditor *editor, gboolean ignore_selection)
void editor_set_indentation_guides(GeanyEditor *editor)
void editor_destroy(GeanyEditor *editor)
GeanyEditorPrefs editor_prefs
gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark)
Moves to position pos, switching to the document if necessary, setting a marker if mark is set.
GeanyIndentType
Whether to use tabs, spaces or both to indent.
@ GEANY_INDENT_TYPE_BOTH
Both.
@ GEANY_INDENT_TYPE_TABS
Tabs.
@ GEANY_INDENT_TYPE_SPACES
Spaces.
gboolean encodings_convert_to_utf8_auto(gchar **buf, gsize *size, const gchar *forced_enc, gchar **used_encoding, gboolean *has_bom, gboolean *partial)
GeanyEncoding encodings[GEANY_ENCODINGS_MAX]
gboolean encodings_is_unicode_charset(const gchar *string)
Encoding conversion and Byte Order Mark (BOM) handling.
void error(const errorSelection selection, const char *const format,...)
currently not working see documentation true uses any is tabs
@ GEANY_FILETYPES_OBJECTIVEC
#define filetypes
Wraps GeanyData::filetypes_array so it can be used with C array syntax.
#define GEANY_STRING_UNTITLED
static bool match(const unsigned char *line, const char *word)
GtkWidget * geany_wrap_label_new(const gchar *text)
void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft)
Sets up highlighting and other visual settings.
Syntax highlighting for the different filetypes, using the Scintilla lexers.
CommandLineOptions cl_options
void geany_debug(gchar const *format,...)
Main program-related commands.
void msgwin_status_add(const gchar *format,...)
Logs a formatted status message without setting the status bar.
Message window functions (status, compiler, messages windows).
void navqueue_remove_file(const gchar *filename)
gboolean notebook_switch_in_progress(void)
void notebook_remove_page(gint page_num)
gint notebook_new_tab(GeanyDocument *this)
const GeanyFilePrefs * project_get_file_prefs(void)
void sci_set_savepoint(ScintillaObject *sci)
void sci_set_selection_mode(ScintillaObject *sci, gint mode)
Sets selection mode.
void sci_set_keywords(ScintillaObject *sci, guint k, const gchar *text)
void sci_undo(ScintillaObject *sci)
gint sci_get_eol_mode(ScintillaObject *sci)
gint sci_get_line_count(ScintillaObject *sci)
Gets the total number of lines.
gint sci_replace_target(ScintillaObject *sci, const gchar *text, gboolean regex)
gboolean sci_is_modified(ScintillaObject *sci)
void sci_set_tab_width(ScintillaObject *sci, gint width)
void sci_get_text(ScintillaObject *sci, gint len, gchar *text)
Gets all text.
void sci_set_target_start(ScintillaObject *sci, gint start)
void sci_goto_pos(ScintillaObject *sci, gint pos, gboolean unfold)
gchar * sci_get_selection_contents(ScintillaObject *sci)
Gets selected text.
void sci_ensure_line_is_visible(ScintillaObject *sci, gint line)
Makes line visible (folding may have hidden it).
gint sci_get_pos_at_line_sel_start(ScintillaObject *sci, gint line)
gint sci_get_length(ScintillaObject *sci)
Gets the length of all text.
gint sci_get_current_position(ScintillaObject *sci)
Gets the cursor position.
void sci_set_undo_collection(ScintillaObject *sci, gboolean set)
void sci_set_eol_mode(ScintillaObject *sci, gint eolmode)
void sci_set_selection_start(ScintillaObject *sci, gint position)
Sets the selection start position.
gint sci_get_selection_mode(ScintillaObject *sci)
Gets selection mode.
gint sci_get_line_length(ScintillaObject *sci, gint line)
Gets line length.
void sci_set_text(ScintillaObject *sci, const gchar *text)
Sets all text.
void sci_set_lines_wrapped(ScintillaObject *sci, gboolean set)
void sci_get_text_range(ScintillaObject *sci, gint start, gint end, gchar *text)
Gets text between start and end.
void sci_scroll_caret(ScintillaObject *sci)
Scrolls the cursor in view.
void sci_set_readonly(ScintillaObject *sci, gboolean readonly)
void sci_set_line_numbers(ScintillaObject *sci, gboolean set)
gint sci_get_lines_selected(ScintillaObject *sci)
void sci_set_search_anchor(ScintillaObject *sci)
gint sci_get_line_indentation(ScintillaObject *sci, gint line)
Gets the indentation width of a line.
gint sci_get_selection_end(ScintillaObject *sci)
Gets the selection end position.
gint sci_get_pos_at_line_sel_end(ScintillaObject *sci, gint line)
gint sci_get_line_indent_position(ScintillaObject *sci, gint line)
void sci_clear_all(ScintillaObject *sci)
gint sci_find_text(ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf)
Finds text in the document.
void sci_convert_eols(ScintillaObject *sci, gint eolmode)
void sci_set_current_position(ScintillaObject *sci, gint position, gboolean scroll_to_caret)
Sets the cursor position.
gboolean sci_can_redo(ScintillaObject *sci)
gchar sci_get_char_at(ScintillaObject *sci, gint pos)
Gets a character.
gboolean sci_has_selection(ScintillaObject *sci)
Checks if there's a selection.
void sci_start_undo_action(ScintillaObject *sci)
Begins grouping a set of edits together as one Undo action.
void sci_end_undo_action(ScintillaObject *sci)
Ends grouping a set of edits together as one Undo action.
void sci_set_target_end(ScintillaObject *sci, gint end)
void sci_empty_undo_buffer(ScintillaObject *sci)
gchar * sci_get_contents(ScintillaObject *sci, gint buffer_len)
Allocates and fills a buffer with text from the start of the document.
gint sci_get_selection_start(ScintillaObject *sci)
Gets the selection start position.
gint sci_get_line_from_position(ScintillaObject *sci, gint position)
Gets the line number from position.
gint sci_get_position_from_line(ScintillaObject *sci, gint line)
Gets the position for the start of line.
void sci_goto_line(ScintillaObject *sci, gint line, gboolean unfold)
Jumps to the specified line in the document.
void sci_redo(ScintillaObject *sci)
void sci_set_selection_end(ScintillaObject *sci, gint position)
Sets the selection end position.
gboolean sci_can_undo(ScintillaObject *sci)
Wrapper functions for the Scintilla editor widget SCI_* messages.
void geany_match_info_free(GeanyMatchInfo *info)
gint search_find_text(ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_)
guint search_replace_range(ScintillaObject *sci, struct Sci_TextToFind *ttf, GeanyFindFlags flags, const gchar *replace_text)
gint search_replace_match(ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text)
gint search_find_next(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
GeanySearchPrefs search_prefs
gint search_find_prev(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
void filetypes_select_radio_item(const GeanyFiletype *ft)
gboolean filetype_has_tags(GeanyFiletype *ft)
GeanyFiletype * filetypes_detect_from_document(GeanyDocument *doc)
gtk_widget_show_all(dialog)
const TMWorkspace * tm_workspace
TagManager workspace/session tags.
GTrashStack * redo_actions
FileDiskStatus file_disk_status
gint symbol_list_sort_mode
FileEncoding saved_encoding
GTrashStack * undo_actions
gboolean colourise_needed
GtkWidget * info_bars[NUM_MSG_TYPES]
guint tag_list_update_source
Structure for representing an open tab with all its properties.
gchar * file_name
The UTF-8 encoded file name.
gboolean changed
Whether this document has been changed since it was last saved.
GeanyFiletype * file_type
The filetype for this document, it's only a reference to one of the elements of the global filetypes ...
struct GeanyDocumentPrivate * priv
gboolean has_bom
Internally used flag to indicate whether the file of this document has a byte-order-mark.
gchar * real_path
The link-dereferenced, locale-encoded file name.
gchar * encoding
The encoding of the document, must be a valid string representation of an encoding,...
gboolean readonly
Whether this document is read-only.
gboolean is_valid
Flag used to check if this document is valid when iterating GeanyData::documents_array.
gint index
Index in the documents array.
GeanyEditor * editor
The editor associated with the document.
guint id
A pseudo-unique ID for this document.
TMSourceFile * tm_file
TMSourceFile object for this document, or NULL.
gint autocompletion_update_freq
gboolean show_linenumber_margin
Editor-owned fields for each document.
GeanyIndentType indent_type
gboolean line_breaking
Whether to split long lines as you type.
gboolean auto_indent
TRUE if auto-indentation is enabled.
ScintillaObject * sci
The Scintilla editor GtkWidget.
gboolean line_wrapping
TRUE if line wrapping is enabled.
gfloat scroll_percent
Percentage to scroll view by on paint, if positive.
gboolean reload_clean_doc_on_file_change
gboolean use_safe_file_saving
gboolean keep_edit_history_on_reload
gint default_new_encoding
gboolean show_keep_edit_history_on_reload_msg
gboolean gio_unsafe_save_backup
gboolean strip_trailing_spaces
gint default_eol_character
gboolean ensure_convert_new_lines
gint symbol_list_sort_mode
gchar * name
Untranslated short name, such as "C", "None".
GeanyFiletypeID id
Index in filetypes.
struct GeanyFiletypePrivate * priv
gchar * extension
Default file extension for new files, or NULL.
Indentation prefs that might be different according to project or filetype.
GeanyIndentType type
Whether to use tabs, spaces or both to indent.
gint symbols_sort_mode
symbol list sorting mode
GtkWidget * window
Main window.
GtkWidget * notebook
Document notebook.
struct Sci_CharacterRange chrg
struct Sci_CharacterRange chrgText
GPtrArray * tags_array
Sorted tags from all source files (just pointers to source file tags, the tag objects are owned by th...
Defines internationalization macros.
#define ngettext(String, PluralString, Number)
GString * symbols_find_typenames_as_string(TMParserType lang, gboolean global)
void symbols_global_tags_loaded(guint file_type_idx)
void tm_source_file_free(TMSourceFile *source_file)
Decrements the reference count of source_file.
TMSourceFile * tm_source_file_new(const char *file_name, const char *name)
Initializes a TMSourceFile structure and returns a pointer to it.
const gchar * tm_source_file_get_lang_name(TMParserType lang)
void tm_workspace_add_source_file_noupdate(TMSourceFile *source_file)
void tm_workspace_remove_source_file(TMSourceFile *source_file)
Removes a source file from the workspace if it exists.
void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar *text_buf, gsize buf_size)
void ui_update_statusbar(GeanyDocument *doc, gint pos)
void ui_update_tab_status(GeanyDocument *doc)
void ui_save_buttons_toggle(gboolean enable)
void ui_set_window_title(GeanyDocument *doc)
GeanyMainWidgets main_widgets
void ui_set_statusbar(gboolean log, const gchar *format,...)
Displays text on the statusbar.
void ui_document_show_hide(GeanyDocument *doc)
void ui_add_recent_document(GeanyDocument *doc)
void ui_document_buttons_update(void)
GtkWidget * ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
Returns a widget from a name in a component, usually created by Glade.
void ui_update_popup_reundo_items(GeanyDocument *doc)
GeanyInterfacePrefs interface_prefs
User Interface general utility functions.
gchar * utils_get_path_from_uri(const gchar *uri)
gchar * utils_str_middle_truncate(const gchar *string, guint truncate_length)
Truncates the input string to a given length.
gchar * utils_get_utf8_from_locale(const gchar *locale_text)
Converts the given string (in locale encoding) into UTF-8 encoding.
void utils_tidy_path(gchar *filename)
void utils_ensure_same_eol_characters(GString *string, gint target_eol_mode)
gint utils_get_line_endings(const gchar *buffer, gsize size)
const gchar * utils_get_eol_char(gint eol_mode)
gboolean utils_str_equal(const gchar *a, const gchar *b)
NULL-safe string comparison.
gboolean utils_is_remote_path(const gchar *path)
gchar * utils_get_real_path(const gchar *file_name)
Get a link-dereferenced, absolute version of a file name.
gchar * utils_get_locale_from_utf8(const gchar *utf8_text)
Converts the given UTF-8 encoded string into locale encoding.
General utility functions, non-GTK related.
#define SETPTR(ptr, result)
Assigns result to ptr, then frees the old value.
#define utils_strdupa(str)
Duplicates a string on the stack using g_alloca().
#define utils_filenamecmp(a, b)