Rename MyApp -> GeanyApp.
Move most GeanyApp fields into: GeanyPrefs for (most) Preferences dialog fields; UIPrefs for non-Prefs dialog visual settings; UIWidgets for less commonly used widgets such as menuitems and dialogs; GeanyStatus for various states the application can be in. Move some GeanyApp fields into EditorPrefs (and one into each of CommandLineOptions and SidebarTreeviews). Add plugin API prefs field. Move disabling build widgets on Windows to build_init(). Make build callbacks static. Add treeviews_init() to prepare popup menus and open files treeview. Replace treeviews_find_node() with treeviews_select_openfiles_item(). Make utils_isbrace() and utils_is_opening_brace() take an 'include_angles' argument (to separate from editor_prefs). Make 'Goto matching brace' keybinding include <> angle brackets. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1815 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
2425b99e42
commit
ef1399e000
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2007-08-23 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* plugins/export.c, src/templates.c, src/build.c, src/utils.c,
|
||||
src/ui_utils.h, src/build.h, src/utils.h, src/highlighting.c,
|
||||
src/keybindings.c, src/tools.c, src/prefs.c, src/dialogs.c,
|
||||
src/prefs.h, src/navqueue.c, src/plugindata.h, src/geany.h,
|
||||
src/treeviews.c, src/msgwindow.c, src/callbacks.c, src/notebook.c,
|
||||
src/treeviews.h, src/keyfile.c, src/vte.c, src/search.c,
|
||||
src/document.c, src/plugins.c, src/main.c, src/editor.c,
|
||||
src/symbols.c, src/main.h, src/editor.h, src/ui_utils.c:
|
||||
Rename MyApp -> GeanyApp.
|
||||
Move most GeanyApp fields into:
|
||||
GeanyPrefs for (most) Preferences dialog fields;
|
||||
UIPrefs for non-Prefs dialog visual settings;
|
||||
UIWidgets for less commonly used widgets such as menuitems and
|
||||
dialogs;
|
||||
GeanyStatus for various states the application can be in.
|
||||
Move some GeanyApp fields into EditorPrefs (and one into each of
|
||||
CommandLineOptions and SidebarTreeviews).
|
||||
Add plugin API prefs field.
|
||||
Move disabling build widgets on Windows to build_init().
|
||||
Make build callbacks static.
|
||||
Add treeviews_init() to prepare popup menus and open files treeview.
|
||||
Replace treeviews_find_node() with treeviews_select_openfiles_item().
|
||||
Make utils_isbrace() and utils_is_opening_brace() take an
|
||||
'include_angles' argument (to separate from editor_prefs).
|
||||
Make 'Goto matching brace' keybinding include <> angle brackets.
|
||||
|
||||
|
||||
2007-08-22 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* plugins/export.c:
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "plugindata.h"
|
||||
#include "editor.h"
|
||||
#include "document.h"
|
||||
#include "prefs.h"
|
||||
#include "utils.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@ -226,21 +228,18 @@ static void create_file_save_as_dialog(const gchar *extension, ExportFunc func,
|
||||
}
|
||||
else
|
||||
{
|
||||
const gchar *default_open_path = geany_data->prefs->default_open_path;
|
||||
gchar *fname = g_strconcat(GEANY_STRING_UNTITLED, extension, NULL);
|
||||
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog));
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fname);
|
||||
|
||||
// use default startup directory(if set) if no files are open
|
||||
if (geany_data->app->default_open_path != NULL &&
|
||||
*(geany_data->app->default_open_path) != '\0')
|
||||
if (NZV(default_open_path) && g_path_is_absolute(default_open_path))
|
||||
{
|
||||
if (g_path_is_absolute(geany_data->app->default_open_path))
|
||||
{
|
||||
gchar *def_path = utils->get_locale_from_utf8(geany_data->app->default_open_path);
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), def_path);
|
||||
g_free(def_path);
|
||||
}
|
||||
gchar *locale_path = utils->get_locale_from_utf8(default_open_path);
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path);
|
||||
g_free(locale_path);
|
||||
}
|
||||
g_free(fname);
|
||||
}
|
||||
@ -568,7 +567,7 @@ static void write_html_file(gint idx, const gchar *filename, gboolean use_zoom)
|
||||
}
|
||||
|
||||
// read Geany's font and font size
|
||||
font_desc = pango_font_description_from_string(geany_data->app->editor_font);
|
||||
font_desc = pango_font_description_from_string(geany_data->prefs->editor_font);
|
||||
font_name = pango_font_description_get_family(font_desc);
|
||||
//font_size = pango_font_description_get_size(font_desc) / PANGO_SCALE;
|
||||
// take the zoom level also into account
|
||||
|
75
src/build.c
75
src/build.c
@ -41,6 +41,7 @@
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "utils.h"
|
||||
#include "ui_utils.h"
|
||||
@ -82,6 +83,14 @@ static BuildMenuItems latex_menu_items =
|
||||
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
GtkWidget *run_button;
|
||||
GtkWidget *compile_button;
|
||||
}
|
||||
widgets;
|
||||
|
||||
|
||||
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
|
||||
static gboolean build_create_shellscript(const gchar *fname, const gchar *cmd, gboolean autoclose);
|
||||
static GPid build_spawn_cmd(gint idx, const gchar *cmd, const gchar *dir);
|
||||
@ -92,6 +101,14 @@ static void build_exit_cb(GPid child_pid, gint status, gpointer user_data);
|
||||
static void run_exit_cb(GPid child_pid, gint status, gpointer user_data);
|
||||
static void on_build_arguments_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
|
||||
static void on_build_compile_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_build_tex_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_build_build_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_build_make_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_build_execute_activate(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_build_next_error(GtkMenuItem *menuitem, gpointer user_data);
|
||||
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static void kill_process(GPid *pid);
|
||||
#endif
|
||||
@ -173,7 +190,7 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
locale_cmd_string = utils_get_locale_from_utf8(cmd_string);
|
||||
|
||||
/* get the terminal path */
|
||||
locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd);
|
||||
locale_term_cmd = utils_get_locale_from_utf8(prefs.tools_term_cmd);
|
||||
// split the term_cmd, so arguments will work too
|
||||
term_argv = g_strsplit(locale_term_cmd, " ", -1);
|
||||
term_argv_len = g_strv_length(term_argv);
|
||||
@ -190,7 +207,7 @@ static GPid build_view_tex_file(gint idx, gint mode)
|
||||
{
|
||||
msgwin_status_add(
|
||||
_("Could not find terminal '%s' "
|
||||
"(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
|
||||
"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
|
||||
|
||||
utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string,
|
||||
locale_term_cmd, NULL);
|
||||
@ -286,7 +303,7 @@ static GPid build_make_file(gint idx, gint build_opts)
|
||||
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
cmdstr = g_string_new(app->tools_make_cmd);
|
||||
cmdstr = g_string_new(prefs.tools_make_cmd);
|
||||
g_string_append_c(cmdstr, ' ');
|
||||
|
||||
if (build_opts == GBO_MAKE_OBJECT)
|
||||
@ -710,7 +727,7 @@ static GPid build_run_cmd(gint idx)
|
||||
gchar **argv = NULL;
|
||||
|
||||
/* get the terminal path */
|
||||
locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd);
|
||||
locale_term_cmd = utils_get_locale_from_utf8(prefs.tools_term_cmd);
|
||||
// split the term_cmd, so arguments will work too
|
||||
term_argv = g_strsplit(locale_term_cmd, " ", -1);
|
||||
term_argv_len = g_strv_length(term_argv);
|
||||
@ -727,7 +744,7 @@ static GPid build_run_cmd(gint idx)
|
||||
{
|
||||
msgwin_status_add(
|
||||
_("Could not find terminal '%s' "
|
||||
"(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
|
||||
"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
|
||||
run_info.pid = (GPid) 1;
|
||||
goto free_strings;
|
||||
}
|
||||
@ -871,7 +888,7 @@ static void show_build_result_message(gboolean failure)
|
||||
msg = _("Compilation failed.");
|
||||
msgwin_compiler_add(COLOR_DARK_RED, msg);
|
||||
// If msgwindow is hidden, user will want to display it to see the error
|
||||
if (! app->msgwindow_visible)
|
||||
if (! ui_prefs.msgwindow_visible)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
|
||||
msgwin_show_hide(TRUE);
|
||||
@ -884,7 +901,7 @@ static void show_build_result_message(gboolean failure)
|
||||
{
|
||||
msg = _("Compilation finished successfully.");
|
||||
msgwin_compiler_add(COLOR_BLUE, msg);
|
||||
if (! app->msgwindow_visible ||
|
||||
if (! ui_prefs.msgwindow_visible ||
|
||||
gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
|
||||
ui_set_statusbar("%s", msg);
|
||||
}
|
||||
@ -1602,8 +1619,8 @@ void build_menu_update(gint idx)
|
||||
{
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_build1"), FALSE);
|
||||
gtk_menu_item_remove_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")));
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
gtk_widget_set_sensitive(app->run_button, FALSE);
|
||||
gtk_widget_set_sensitive(widgets.compile_button, FALSE);
|
||||
gtk_widget_set_sensitive(widgets.run_button, FALSE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -1668,8 +1685,8 @@ void build_menu_update(gint idx)
|
||||
if (menu_items->item_set_args)
|
||||
gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
|
||||
|
||||
gtk_widget_set_sensitive(app->compile_button, can_build && ft->actions->can_compile);
|
||||
gtk_widget_set_sensitive(app->run_button, can_run || can_stop);
|
||||
gtk_widget_set_sensitive(widgets.compile_button, can_build && ft->actions->can_compile);
|
||||
gtk_widget_set_sensitive(widgets.run_button, can_run || can_stop);
|
||||
|
||||
// show the stop command if a program is running, otherwise show run command
|
||||
set_stop_button(can_stop);
|
||||
@ -1690,14 +1707,14 @@ static void set_stop_button(gboolean stop)
|
||||
build_get_menu_items(run_info.file_type_id)->item_exec;
|
||||
|
||||
if (stop && utils_str_equal(
|
||||
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(app->run_button)), "gtk-stop")) return;
|
||||
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(widgets.run_button)), "gtk-stop")) return;
|
||||
if (! stop && utils_str_equal(
|
||||
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(app->run_button)), "gtk-execute")) return;
|
||||
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(widgets.run_button)), "gtk-execute")) return;
|
||||
|
||||
// use the run button also as stop button
|
||||
if (stop)
|
||||
{
|
||||
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(app->run_button), "gtk-stop");
|
||||
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(widgets.run_button), "gtk-stop");
|
||||
|
||||
if (menuitem != NULL)
|
||||
{
|
||||
@ -1710,7 +1727,7 @@ static void set_stop_button(gboolean stop)
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(app->run_button), "gtk-execute");
|
||||
gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(widgets.run_button), "gtk-execute");
|
||||
|
||||
if (menuitem != NULL)
|
||||
{
|
||||
@ -1768,7 +1785,7 @@ BuildMenuItems *build_get_menu_items(gint filetype_idx)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_compile_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1785,7 +1802,7 @@ on_build_compile_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_tex_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1805,7 +1822,7 @@ on_build_tex_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_build_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1822,7 +1839,7 @@ on_build_build_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_make_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1855,7 +1872,7 @@ on_build_make_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_execute_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1952,7 +1969,7 @@ static void kill_process(GPid *pid)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
on_build_next_error (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -1966,3 +1983,19 @@ on_build_next_error (GtkMenuItem *menuitem,
|
||||
}
|
||||
|
||||
|
||||
void build_init()
|
||||
{
|
||||
widgets.compile_button = lookup_widget(app->window, "toolbutton13");
|
||||
widgets.run_button = lookup_widget(app->window, "toolbutton26");
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
// hide build support items, at least until they are available for Windows
|
||||
gtk_widget_hide(widgets.compile_button);
|
||||
{
|
||||
GtkWidget *compiler_tab;
|
||||
compiler_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(msgwindow.notebook),
|
||||
gtk_notebook_get_nth_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER));
|
||||
gtk_widget_set_sensitive(compiler_tab, FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
27
src/build.h
27
src/build.h
@ -61,8 +61,11 @@ typedef struct
|
||||
|
||||
|
||||
|
||||
void build_init();
|
||||
|
||||
void build_finalize();
|
||||
|
||||
|
||||
gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
|
||||
|
||||
void build_menu_update(gint idx);
|
||||
@ -70,28 +73,4 @@ void build_menu_update(gint idx);
|
||||
BuildMenuItems *build_get_menu_items(gint filetype_idx);
|
||||
|
||||
|
||||
void
|
||||
on_build_compile_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_build_tex_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_build_build_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_build_make_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_build_execute_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_build_next_error (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
#endif
|
||||
|
105
src/callbacks.c
105
src/callbacks.c
@ -159,7 +159,7 @@ static void quit_app()
|
||||
gboolean
|
||||
on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
||||
{
|
||||
app->quitting = TRUE;
|
||||
main_status.quitting = TRUE;
|
||||
|
||||
if (! check_no_unsaved())
|
||||
{
|
||||
@ -170,7 +170,7 @@ on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
||||
}
|
||||
}
|
||||
else
|
||||
if (! app->pref_main_confirm_exit ||
|
||||
if (! prefs.confirm_exit ||
|
||||
dialogs_show_question_full(NULL, GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL,
|
||||
_("Do you really want to quit?")))
|
||||
{
|
||||
@ -178,7 +178,7 @@ on_exit_clicked (GtkWidget *widget, gpointer gdata)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
app->quitting = FALSE;
|
||||
main_status.quitting = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -284,8 +284,8 @@ void
|
||||
on_file1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->recent_files_menuitem,
|
||||
g_queue_get_length(app->recent_queue) > 0);
|
||||
gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem,
|
||||
g_queue_get_length(ui_prefs.recent_queue) > 0);
|
||||
}
|
||||
|
||||
|
||||
@ -507,7 +507,7 @@ on_images_and_text2_activate (GtkMenuItem *menuitem,
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_BOTH);
|
||||
app->toolbar_icon_style = GTK_TOOLBAR_BOTH;
|
||||
prefs.toolbar_icon_style = GTK_TOOLBAR_BOTH;
|
||||
}
|
||||
|
||||
|
||||
@ -518,7 +518,7 @@ on_images_only2_activate (GtkMenuItem *menuitem,
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_ICONS);
|
||||
app->toolbar_icon_style = GTK_TOOLBAR_ICONS;
|
||||
prefs.toolbar_icon_style = GTK_TOOLBAR_ICONS;
|
||||
}
|
||||
|
||||
|
||||
@ -529,7 +529,7 @@ on_text_only2_activate (GtkMenuItem *menuitem,
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_TEXT);
|
||||
app->toolbar_icon_style = GTK_TOOLBAR_TEXT;
|
||||
prefs.toolbar_icon_style = GTK_TOOLBAR_TEXT;
|
||||
}
|
||||
|
||||
|
||||
@ -660,7 +660,7 @@ on_toolbar_large_icons1_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
app->toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
prefs.toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
ui_update_toolbar_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ on_toolbar_small_icons1_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
app->toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
prefs.toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
ui_update_toolbar_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ on_zoom_in1_activate (GtkMenuItem *menuitem,
|
||||
|
||||
if (idx >= 0 && doc_list[idx].is_valid)
|
||||
{
|
||||
if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin,
|
||||
if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin,
|
||||
(sci_get_zoom(doc_list[idx].sci) / 2));
|
||||
sci_zoom_in(doc_list[idx].sci);
|
||||
}
|
||||
@ -711,7 +711,7 @@ on_zoom_out1_activate (GtkMenuItem *menuitem,
|
||||
if (idx >= 0 && doc_list[idx].is_valid)
|
||||
{
|
||||
if (sci_get_zoom(doc_list[idx].sci) == 0)
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
sci_zoom_out(doc_list[idx].sci);
|
||||
}
|
||||
}
|
||||
@ -725,7 +725,7 @@ on_normal_size1_activate (GtkMenuItem *menuitem,
|
||||
if (idx >= 0 && doc_list[idx].is_valid)
|
||||
{
|
||||
sci_zoom_off(doc_list[idx].sci);
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -767,10 +767,9 @@ on_notebook1_switch_page_after (GtkNotebook *notebook,
|
||||
else
|
||||
idx = document_get_n_idx(page_num);
|
||||
|
||||
if (idx >= 0 && app->opening_session_files == FALSE)
|
||||
if (idx >= 0 && main_status.opening_session_files == FALSE)
|
||||
{
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
|
||||
|
||||
treeviews_select_openfiles_item(idx);
|
||||
document_set_text_changed(idx); // also sets window title and status bar
|
||||
ui_update_popup_reundo_items(idx);
|
||||
ui_document_show_hide(idx); // update the document menu
|
||||
@ -859,25 +858,25 @@ toolbar_popup_menu (GtkWidget *widget,
|
||||
|
||||
ignore_toolbar_toggle = TRUE;
|
||||
|
||||
switch (app->toolbar_icon_style)
|
||||
switch (prefs.toolbar_icon_style)
|
||||
{
|
||||
case 0: w = lookup_widget(app->toolbar_menu, "images_only2"); break;
|
||||
case 1: w = lookup_widget(app->toolbar_menu, "text_only2"); break;
|
||||
default: w = lookup_widget(app->toolbar_menu, "images_and_text2"); break;
|
||||
case 0: w = lookup_widget(ui_widgets.toolbar_menu, "images_only2"); break;
|
||||
case 1: w = lookup_widget(ui_widgets.toolbar_menu, "text_only2"); break;
|
||||
default: w = lookup_widget(ui_widgets.toolbar_menu, "images_and_text2"); break;
|
||||
}
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
|
||||
|
||||
switch (app->toolbar_icon_size)
|
||||
switch (prefs.toolbar_icon_size)
|
||||
{
|
||||
case GTK_ICON_SIZE_LARGE_TOOLBAR:
|
||||
widget = lookup_widget(app->toolbar_menu, "large_icons1"); break;
|
||||
default: widget = lookup_widget(app->toolbar_menu, "small_icons1"); break;
|
||||
widget = lookup_widget(ui_widgets.toolbar_menu, "large_icons1"); break;
|
||||
default: widget = lookup_widget(ui_widgets.toolbar_menu, "small_icons1"); break;
|
||||
}
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
|
||||
|
||||
ignore_toolbar_toggle = FALSE;
|
||||
|
||||
gtk_menu_popup(GTK_MENU(app->toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -915,8 +914,8 @@ on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
{
|
||||
if (app->ignore_callback) return;
|
||||
|
||||
app->toolbar_visible = (app->toolbar_visible) ? FALSE : TRUE;;
|
||||
ui_widget_show_hide(GTK_WIDGET(app->toolbar), app->toolbar_visible);
|
||||
prefs.toolbar_visible = (prefs.toolbar_visible) ? FALSE : TRUE;;
|
||||
ui_widget_show_hide(GTK_WIDGET(app->toolbar), prefs.toolbar_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -924,7 +923,7 @@ void
|
||||
on_fullscreen1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->fullscreen = (app->fullscreen) ? FALSE : TRUE;
|
||||
ui_prefs.fullscreen = (ui_prefs.fullscreen) ? FALSE : TRUE;
|
||||
ui_set_fullscreen();
|
||||
}
|
||||
|
||||
@ -935,8 +934,8 @@ on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
{
|
||||
if (app->ignore_callback) return;
|
||||
|
||||
app->msgwindow_visible = (app->msgwindow_visible) ? FALSE : TRUE;
|
||||
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), app->msgwindow_visible);
|
||||
ui_prefs.msgwindow_visible = (ui_prefs.msgwindow_visible) ? FALSE : TRUE;
|
||||
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), ui_prefs.msgwindow_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -944,7 +943,7 @@ void
|
||||
on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->show_markers_margin = (app->show_markers_margin) ? FALSE : TRUE;
|
||||
editor_prefs.show_markers_margin = (editor_prefs.show_markers_margin) ? FALSE : TRUE;
|
||||
ui_show_markers_margin();
|
||||
}
|
||||
|
||||
@ -953,7 +952,7 @@ void
|
||||
on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->show_linenumber_margin = (app->show_linenumber_margin) ? FALSE : TRUE;
|
||||
editor_prefs.show_linenumber_margin = (editor_prefs.show_linenumber_margin) ? FALSE : TRUE;
|
||||
ui_show_linenumber_margin();
|
||||
}
|
||||
|
||||
@ -1098,7 +1097,7 @@ void
|
||||
on_compile_button_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
on_build_compile_activate(NULL, NULL);
|
||||
keybindings_cmd(GEANY_KEYS_BUILD_COMPILE);
|
||||
}
|
||||
|
||||
|
||||
@ -1385,7 +1384,7 @@ on_comments_changelog_activate (GtkMenuItem *menuitem,
|
||||
sci_insert_text(doc_list[idx].sci, 0, text);
|
||||
// sets the cursor to the right position to type the changelog text,
|
||||
// the template has 21 chars + length of name and email
|
||||
sci_goto_pos(doc_list[idx].sci, 21 + strlen(app->pref_template_developer) + strlen(app->pref_template_mail), TRUE);
|
||||
sci_goto_pos(doc_list[idx].sci, 21 + strlen(prefs.template_developer) + strlen(prefs.template_mail), TRUE);
|
||||
|
||||
g_free(text);
|
||||
}
|
||||
@ -1419,8 +1418,8 @@ on_custom_date_dialog_response (GtkDialog *dialog,
|
||||
{
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
g_free(app->custom_date_format);
|
||||
app->custom_date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
|
||||
g_free(ui_prefs.custom_date_format);
|
||||
ui_prefs.custom_date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
|
||||
}
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
}
|
||||
@ -1460,19 +1459,19 @@ on_insert_date_activate (GtkMenuItem *menuitem,
|
||||
else if (utils_str_equal(_("yyyy/mm/dd hh:mm:ss"), (gchar*) user_data))
|
||||
format = "%Y/%m/%d %H:%M:%S";
|
||||
else if (utils_str_equal(_("Use Custom Date Format"), (gchar*) user_data))
|
||||
format = app->custom_date_format;
|
||||
format = ui_prefs.custom_date_format;
|
||||
else
|
||||
{
|
||||
// set default value
|
||||
if (utils_str_equal("", app->custom_date_format))
|
||||
if (utils_str_equal("", ui_prefs.custom_date_format))
|
||||
{
|
||||
g_free(app->custom_date_format);
|
||||
app->custom_date_format = g_strdup("%d.%m.%Y");
|
||||
g_free(ui_prefs.custom_date_format);
|
||||
ui_prefs.custom_date_format = g_strdup("%d.%m.%Y");
|
||||
}
|
||||
|
||||
dialogs_show_input(_("Custom Date Format"),
|
||||
_("Enter here a custom date and time format. You can use any conversion specifiers which can be used with the ANSI C strftime function. See \"man strftime\" for more information."),
|
||||
app->custom_date_format,
|
||||
ui_prefs.custom_date_format,
|
||||
G_CALLBACK(on_custom_date_dialog_response),
|
||||
G_CALLBACK(on_custom_date_entry_activate));
|
||||
return;
|
||||
@ -1558,7 +1557,7 @@ void
|
||||
on_run_button_clicked (GtkToolButton *toolbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
on_build_execute_activate(NULL, NULL);
|
||||
keybindings_cmd(GEANY_KEYS_BUILD_RUN);
|
||||
}
|
||||
|
||||
|
||||
@ -1634,19 +1633,19 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
|
||||
if (app->ignore_callback) return;
|
||||
|
||||
if (app->sidebar_visible)
|
||||
if (ui_prefs.sidebar_visible)
|
||||
{
|
||||
// to remember the active page because GTK (e.g. 2.8.18) doesn't do it and shows always
|
||||
// the last page (for unknown reason, with GTK 2.6.4 it works)
|
||||
active_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
|
||||
}
|
||||
|
||||
app->sidebar_visible = ! app->sidebar_visible;
|
||||
ui_prefs.sidebar_visible = ! ui_prefs.sidebar_visible;
|
||||
|
||||
if ((! app->sidebar_openfiles_visible && ! app->sidebar_symbol_visible))
|
||||
if ((! prefs.sidebar_openfiles_visible && ! prefs.sidebar_symbol_visible))
|
||||
{
|
||||
app->sidebar_openfiles_visible = TRUE;
|
||||
app->sidebar_symbol_visible = TRUE;
|
||||
prefs.sidebar_openfiles_visible = TRUE;
|
||||
prefs.sidebar_symbol_visible = TRUE;
|
||||
}
|
||||
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
@ -1998,7 +1997,7 @@ on_context_action1_activate (GtkMenuItem *menuitem,
|
||||
}
|
||||
else
|
||||
{
|
||||
command = g_strdup(app->context_action_cmd);
|
||||
command = g_strdup(prefs.context_action_cmd);
|
||||
}
|
||||
|
||||
// substitute the wildcard %s and run the command if it is non empty
|
||||
@ -2030,7 +2029,7 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
if (hide_all == -1)
|
||||
{
|
||||
if (! gtk_check_menu_item_get_active(msgw) &&
|
||||
! app->show_notebook_tabs &&
|
||||
! prefs.show_notebook_tabs &&
|
||||
! gtk_check_menu_item_get_active(toolbari))
|
||||
{
|
||||
hide_all = TRUE;
|
||||
@ -2046,8 +2045,8 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
if (gtk_check_menu_item_get_active(msgw))
|
||||
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
||||
|
||||
app->show_notebook_tabs = FALSE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
|
||||
prefs.show_notebook_tabs = FALSE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
|
||||
|
||||
ui_statusbar_showhide(FALSE);
|
||||
|
||||
@ -2060,8 +2059,8 @@ on_menu_toggle_all_additional_widgets1_activate
|
||||
if (! gtk_check_menu_item_get_active(msgw))
|
||||
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
|
||||
|
||||
app->show_notebook_tabs = TRUE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
|
||||
prefs.show_notebook_tabs = TRUE;
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
|
||||
|
||||
ui_statusbar_showhide(TRUE);
|
||||
|
||||
@ -2089,7 +2088,7 @@ on_back_activate (GtkMenuItem *menuitem,
|
||||
|
||||
gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
|
||||
{
|
||||
if (app->auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
|
||||
if (prefs.auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
|
||||
gtk_widget_grab_focus(widget);
|
||||
|
||||
return FALSE;
|
||||
|
171
src/dialogs.c
171
src/dialogs.c
@ -43,6 +43,7 @@
|
||||
|
||||
#include "dialogs.h"
|
||||
|
||||
#include "prefs.h"
|
||||
#include "callbacks.h"
|
||||
#include "document.h"
|
||||
#include "filetypes.h"
|
||||
@ -67,7 +68,7 @@ on_file_open_dialog_response (GtkDialog *dialog,
|
||||
gint response,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_hide(app->open_filesel);
|
||||
gtk_widget_hide(ui_widgets.open_filesel);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT || response == GTK_RESPONSE_APPLY)
|
||||
{
|
||||
@ -84,7 +85,7 @@ on_file_open_dialog_response (GtkDialog *dialog,
|
||||
if (encoding_idx >= 0 && encoding_idx < GEANY_ENCODINGS_MAX)
|
||||
charset = encodings[encoding_idx].charset;
|
||||
|
||||
filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(app->open_filesel));
|
||||
filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(ui_widgets.open_filesel));
|
||||
if (filelist != NULL)
|
||||
{
|
||||
document_open_files(filelist, ro, ft, charset);
|
||||
@ -106,12 +107,12 @@ on_file_open_entry_activate (GtkEntry *entry,
|
||||
|
||||
if (g_file_test(locale_filename, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
|
||||
}
|
||||
else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
|
||||
{
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
on_file_open_dialog_response(GTK_DIALOG(app->open_filesel), GTK_RESPONSE_ACCEPT, NULL);
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
|
||||
on_file_open_dialog_response(GTK_DIALOG(ui_widgets.open_filesel), GTK_RESPONSE_ACCEPT, NULL);
|
||||
}
|
||||
|
||||
g_free(locale_filename);
|
||||
@ -151,7 +152,7 @@ on_file_open_check_hidden_toggled (GtkToggleButton *togglebutton,
|
||||
{
|
||||
gboolean is_on = gtk_toggle_button_get_active(togglebutton);
|
||||
|
||||
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(app->open_filesel), is_on);
|
||||
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(ui_widgets.open_filesel), is_on);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -166,7 +167,7 @@ void dialogs_show_open_file ()
|
||||
|
||||
/* We use the same file selection widget each time, so first
|
||||
of all we create it if it hasn't already been created. */
|
||||
if (app->open_filesel == NULL)
|
||||
if (ui_widgets.open_filesel == NULL)
|
||||
{
|
||||
GtkWidget *filetype_combo, *encoding_combo;
|
||||
GtkWidget *viewbtn;
|
||||
@ -174,53 +175,53 @@ void dialogs_show_open_file ()
|
||||
gint i;
|
||||
gchar *encoding_string;
|
||||
|
||||
app->open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(app->window),
|
||||
ui_widgets.open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(app->window),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL);
|
||||
gtk_widget_set_name(app->open_filesel, "GeanyDialog");
|
||||
gtk_widget_set_name(ui_widgets.open_filesel, "GeanyDialog");
|
||||
|
||||
viewbtn = gtk_button_new_with_mnemonic(_("_View"));
|
||||
gtk_tooltips_set_tip(tooltips, viewbtn,
|
||||
_("Opens the file in read-only mode. If you choose more than one file to open, all files will be opened read-only."), NULL);
|
||||
gtk_widget_show(viewbtn);
|
||||
gtk_dialog_add_action_widget(GTK_DIALOG(app->open_filesel),
|
||||
gtk_dialog_add_action_widget(GTK_DIALOG(ui_widgets.open_filesel),
|
||||
viewbtn, GTK_RESPONSE_APPLY);
|
||||
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(app->open_filesel),
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.open_filesel),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(app->open_filesel),
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(ui_widgets.open_filesel),
|
||||
GTK_RESPONSE_ACCEPT);
|
||||
|
||||
gtk_widget_set_size_request(app->open_filesel, -1, 460);
|
||||
gtk_window_set_modal(GTK_WINDOW(app->open_filesel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(app->open_filesel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->open_filesel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(app->open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(app->open_filesel), GTK_WINDOW(app->window));
|
||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(app->open_filesel), TRUE);
|
||||
gtk_widget_set_size_request(ui_widgets.open_filesel, -1, 460);
|
||||
gtk_window_set_modal(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_filesel), GTK_WINDOW(app->window));
|
||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(ui_widgets.open_filesel), TRUE);
|
||||
|
||||
// add checkboxes and filename entry
|
||||
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(app->open_filesel),
|
||||
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
|
||||
add_file_open_extra_widget());
|
||||
filetype_combo = lookup_widget(app->open_filesel, "filetype_combo");
|
||||
filetype_combo = lookup_widget(ui_widgets.open_filesel, "filetype_combo");
|
||||
|
||||
// add FileFilters(start with "All Files")
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
|
||||
filetypes_create_file_filter(filetypes[GEANY_FILETYPES_ALL]));
|
||||
// now create meta filter "All Source"
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
|
||||
filetypes_create_file_filter_all_source());
|
||||
for (i = 0; i < GEANY_MAX_FILE_TYPES - 1; i++)
|
||||
{
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(filetype_combo), filetypes[i]->title);
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
|
||||
filetypes_create_file_filter(filetypes[i]));
|
||||
}
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(filetype_combo), _("Detect by file extension"));
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(filetype_combo), GEANY_MAX_FILE_TYPES - 1);
|
||||
|
||||
// fill encoding combo box
|
||||
encoding_combo = lookup_widget(app->open_filesel, "encoding_combo");
|
||||
encoding_combo = lookup_widget(ui_widgets.open_filesel, "encoding_combo");
|
||||
for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
|
||||
{
|
||||
encoding_string = encodings_to_string(&encodings[i]);
|
||||
@ -230,11 +231,11 @@ void dialogs_show_open_file ()
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(encoding_combo), _("Detect from file"));
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combo), GEANY_ENCODINGS_MAX);
|
||||
|
||||
g_signal_connect((gpointer) app->open_filesel, "selection-changed",
|
||||
g_signal_connect((gpointer) ui_widgets.open_filesel, "selection-changed",
|
||||
G_CALLBACK(on_file_open_selection_changed), NULL);
|
||||
g_signal_connect ((gpointer) app->open_filesel, "delete_event",
|
||||
g_signal_connect ((gpointer) ui_widgets.open_filesel, "delete_event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
||||
g_signal_connect((gpointer) app->open_filesel, "response",
|
||||
g_signal_connect((gpointer) ui_widgets.open_filesel, "response",
|
||||
G_CALLBACK(on_file_open_dialog_response), NULL);
|
||||
}
|
||||
|
||||
@ -248,22 +249,22 @@ void dialogs_show_open_file ()
|
||||
|
||||
if (g_path_is_absolute(locale_filename))
|
||||
gtk_file_chooser_set_current_folder(
|
||||
GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
|
||||
GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
|
||||
|
||||
g_free(initdir);
|
||||
g_free(locale_filename);
|
||||
}
|
||||
// use default startup directory(if set) if no files are open
|
||||
/// TODO should it only be used when initally open the dialog and not on every show?
|
||||
else if (app->default_open_path != NULL && *app->default_open_path != '\0')
|
||||
else if (prefs.default_open_path != NULL && *prefs.default_open_path != '\0')
|
||||
{
|
||||
if (g_path_is_absolute(app->default_open_path))
|
||||
if (g_path_is_absolute(prefs.default_open_path))
|
||||
gtk_file_chooser_set_current_folder(
|
||||
GTK_FILE_CHOOSER(app->open_filesel), app->default_open_path);
|
||||
GTK_FILE_CHOOSER(ui_widgets.open_filesel), prefs.default_open_path);
|
||||
}
|
||||
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(app->open_filesel));
|
||||
gtk_widget_show(app->open_filesel);
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(ui_widgets.open_filesel));
|
||||
gtk_widget_show(ui_widgets.open_filesel);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -347,13 +348,13 @@ static GtkWidget *add_file_open_extra_widget()
|
||||
g_signal_connect((gpointer) check_hidden, "toggled",
|
||||
G_CALLBACK(on_file_open_check_hidden_toggled), NULL);
|
||||
|
||||
g_object_set_data_full(G_OBJECT(app->open_filesel), "file_entry",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "file_entry",
|
||||
gtk_widget_ref(file_entry), (GDestroyNotify)gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->open_filesel), "check_hidden",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "check_hidden",
|
||||
gtk_widget_ref(check_hidden), (GDestroyNotify)gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->open_filesel), "filetype_combo",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "filetype_combo",
|
||||
gtk_widget_ref(filetype_combo), (GDestroyNotify)gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->open_filesel), "encoding_combo",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "encoding_combo",
|
||||
gtk_widget_ref(encoding_combo), (GDestroyNotify)gtk_widget_unref);
|
||||
|
||||
return vbox;
|
||||
@ -387,10 +388,10 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gchar *new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel));
|
||||
gchar *new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ui_widgets.save_filesel));
|
||||
gchar *utf8_filename;
|
||||
gboolean open_new_tab = gtk_toggle_button_get_active(
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(app->save_filesel, "check_open_new_tab")));
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(ui_widgets.save_filesel, "check_open_new_tab")));
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
utf8_filename = g_strdup(new_filename);
|
||||
@ -445,7 +446,7 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
g_free(new_filename);
|
||||
}
|
||||
}
|
||||
gtk_widget_hide(app->save_filesel);
|
||||
gtk_widget_hide(ui_widgets.save_filesel);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -459,30 +460,30 @@ gboolean dialogs_show_save_as()
|
||||
#else
|
||||
gint idx = document_get_cur_idx(), resp;
|
||||
|
||||
if (app->save_filesel == NULL)
|
||||
if (ui_widgets.save_filesel == NULL)
|
||||
{
|
||||
GtkWidget *vbox, *check_open_new_tab, *rename_btn;
|
||||
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
|
||||
|
||||
app->save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(app->window),
|
||||
ui_widgets.save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(app->window),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
|
||||
gtk_window_set_modal(GTK_WINDOW(app->save_filesel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(app->save_filesel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->save_filesel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(app->save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_widget_set_name(app->save_filesel, "GeanyDialog");
|
||||
gtk_window_set_modal(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_widget_set_name(ui_widgets.save_filesel, "GeanyDialog");
|
||||
|
||||
rename_btn = gtk_button_new_with_mnemonic(_("R_ename"));
|
||||
gtk_tooltips_set_tip(tooltips, rename_btn,
|
||||
_("Save the file and rename it."), NULL);
|
||||
gtk_widget_show(rename_btn);
|
||||
gtk_dialog_add_action_widget(GTK_DIALOG(app->save_filesel),
|
||||
gtk_dialog_add_action_widget(GTK_DIALOG(ui_widgets.save_filesel),
|
||||
rename_btn, GTK_RESPONSE_APPLY);
|
||||
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(app->save_filesel),
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.save_filesel),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(app->save_filesel), GTK_RESPONSE_ACCEPT);
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(ui_widgets.save_filesel), GTK_RESPONSE_ACCEPT);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
check_open_new_tab = gtk_check_button_new_with_mnemonic(_("_Open file in a new tab"));
|
||||
@ -491,20 +492,20 @@ gboolean dialogs_show_save_as()
|
||||
" and open the newly saved file in a new tab."), NULL);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), check_open_new_tab, FALSE, FALSE, 0);
|
||||
gtk_widget_show_all(vbox);
|
||||
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(app->save_filesel), vbox);
|
||||
gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.save_filesel), vbox);
|
||||
|
||||
g_signal_connect(check_open_new_tab, "toggled",
|
||||
G_CALLBACK(on_save_as_new_tab_toggled), rename_btn);
|
||||
|
||||
g_object_set_data_full(G_OBJECT(app->save_filesel), "check_open_new_tab",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.save_filesel), "check_open_new_tab",
|
||||
gtk_widget_ref(check_open_new_tab), (GDestroyNotify) gtk_widget_unref);
|
||||
|
||||
g_signal_connect((gpointer) app->save_filesel, "delete_event",
|
||||
g_signal_connect((gpointer) ui_widgets.save_filesel, "delete_event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
||||
g_signal_connect((gpointer) app->save_filesel, "response",
|
||||
g_signal_connect((gpointer) ui_widgets.save_filesel, "response",
|
||||
G_CALLBACK(on_file_save_dialog_response), NULL);
|
||||
|
||||
gtk_window_set_transient_for(GTK_WINDOW(app->save_filesel), GTK_WINDOW(app->window));
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.save_filesel), GTK_WINDOW(app->window));
|
||||
}
|
||||
|
||||
// If the current document has a filename we use that as the default.
|
||||
@ -516,9 +517,9 @@ gboolean dialogs_show_save_as()
|
||||
gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
|
||||
#endif
|
||||
if (g_path_is_absolute(locale_filename))
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(app->save_filesel), locale_filename);
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui_widgets.save_filesel), locale_filename);
|
||||
else
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(app->save_filesel),
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
|
||||
doc_list[idx].file_name);
|
||||
#ifndef G_OS_WIN32
|
||||
g_free(locale_filename);
|
||||
@ -535,20 +536,20 @@ gboolean dialogs_show_save_as()
|
||||
else
|
||||
fname = g_strdup(GEANY_STRING_UNTITLED);
|
||||
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(app->save_filesel));
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(app->save_filesel), fname);
|
||||
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(ui_widgets.save_filesel));
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel), fname);
|
||||
|
||||
// use default startup directory(if set) if no files are open
|
||||
if (app->default_open_path != NULL && *app->default_open_path != '\0')
|
||||
if (prefs.default_open_path != NULL && *prefs.default_open_path != '\0')
|
||||
{
|
||||
if (g_path_is_absolute(app->default_open_path))
|
||||
if (g_path_is_absolute(prefs.default_open_path))
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gtk_file_chooser_set_current_folder(
|
||||
GTK_FILE_CHOOSER(app->save_filesel), app->default_open_path);
|
||||
GTK_FILE_CHOOSER(ui_widgets.save_filesel), prefs.default_open_path);
|
||||
#else
|
||||
gchar *def_path = utils_get_locale_from_utf8(app->default_open_path);
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->save_filesel), def_path);
|
||||
gchar *def_path = utils_get_locale_from_utf8(prefs.default_open_path);
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel), def_path);
|
||||
g_free(def_path);
|
||||
#endif
|
||||
}
|
||||
@ -557,7 +558,7 @@ gboolean dialogs_show_save_as()
|
||||
}
|
||||
|
||||
// Run the dialog synchronously, pausing this function call
|
||||
resp = gtk_dialog_run(GTK_DIALOG(app->save_filesel));
|
||||
resp = gtk_dialog_run(GTK_DIALOG(ui_widgets.save_filesel));
|
||||
return (resp == GTK_RESPONSE_ACCEPT);
|
||||
#endif
|
||||
}
|
||||
@ -662,7 +663,7 @@ on_font_apply_button_clicked (GtkButton *button,
|
||||
gchar *fontname;
|
||||
|
||||
fontname = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG(app->open_fontsel));
|
||||
GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel));
|
||||
ui_set_editor_font(fontname);
|
||||
g_free(fontname);
|
||||
}
|
||||
@ -674,7 +675,7 @@ on_font_ok_button_clicked (GtkButton *button,
|
||||
{
|
||||
// We do the same thing as apply, but we close the dialog after.
|
||||
on_font_apply_button_clicked(button, NULL);
|
||||
gtk_widget_hide(app->open_fontsel);
|
||||
gtk_widget_hide(ui_widgets.open_fontsel);
|
||||
}
|
||||
|
||||
|
||||
@ -682,7 +683,7 @@ static void
|
||||
on_font_cancel_button_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_hide(app->open_fontsel);
|
||||
gtk_widget_hide(ui_widgets.open_fontsel);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -694,33 +695,33 @@ void dialogs_show_open_font()
|
||||
win32_show_font_dialog();
|
||||
#else
|
||||
|
||||
if (app->open_fontsel == NULL)
|
||||
if (ui_widgets.open_fontsel == NULL)
|
||||
{
|
||||
app->open_fontsel = gtk_font_selection_dialog_new(_("Choose font"));;
|
||||
gtk_container_set_border_width(GTK_CONTAINER(app->open_fontsel), 4);
|
||||
gtk_window_set_modal(GTK_WINDOW(app->open_fontsel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(app->open_fontsel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->open_fontsel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(app->open_fontsel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_widget_set_name(app->open_fontsel, "GeanyDialog");
|
||||
ui_widgets.open_fontsel = gtk_font_selection_dialog_new(_("Choose font"));;
|
||||
gtk_container_set_border_width(GTK_CONTAINER(ui_widgets.open_fontsel), 4);
|
||||
gtk_window_set_modal(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
|
||||
gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_fontsel), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_widget_set_name(ui_widgets.open_fontsel, "GeanyDialog");
|
||||
|
||||
gtk_widget_show(GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button);
|
||||
gtk_widget_show(GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->apply_button);
|
||||
|
||||
g_signal_connect((gpointer) app->open_fontsel,
|
||||
g_signal_connect((gpointer) ui_widgets.open_fontsel,
|
||||
"delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->ok_button,
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->ok_button,
|
||||
"clicked", G_CALLBACK(on_font_ok_button_clicked), NULL);
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->cancel_button,
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->cancel_button,
|
||||
"clicked", G_CALLBACK(on_font_cancel_button_clicked), NULL);
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button,
|
||||
g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->apply_button,
|
||||
"clicked", G_CALLBACK(on_font_apply_button_clicked), NULL);
|
||||
|
||||
gtk_font_selection_dialog_set_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG(app->open_fontsel), app->editor_font);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(app->open_fontsel), GTK_WINDOW(app->window));
|
||||
GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel), prefs.editor_font);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_fontsel), GTK_WINDOW(app->window));
|
||||
}
|
||||
/* We make sure the dialog is visible. */
|
||||
gtk_window_present(GTK_WINDOW(app->open_fontsel));
|
||||
gtk_window_present(GTK_WINDOW(ui_widgets.open_fontsel));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "document.h"
|
||||
#include "prefs.h"
|
||||
#include "filetypes.h"
|
||||
#include "support.h"
|
||||
#include "sciwrappers.h"
|
||||
@ -187,7 +188,7 @@ void document_finalize()
|
||||
|
||||
void document_set_text_changed(gint idx)
|
||||
{
|
||||
if (DOC_IDX_VALID(idx) && ! app->quitting)
|
||||
if (DOC_IDX_VALID(idx) && ! main_status.quitting)
|
||||
{
|
||||
ui_update_tab_status(idx);
|
||||
ui_save_buttons_toggle(doc_list[idx].changed);
|
||||
@ -201,7 +202,7 @@ void document_set_text_changed(gint idx)
|
||||
void document_apply_update_prefs(gint idx)
|
||||
{
|
||||
ScintillaObject *sci = doc_list[idx].sci;
|
||||
sci_set_mark_long_lines(sci, app->long_line_type, app->long_line_column, app->long_line_color);
|
||||
sci_set_mark_long_lines(sci, editor_prefs.long_line_type, editor_prefs.long_line_column, editor_prefs.long_line_color);
|
||||
|
||||
sci_set_tab_width(sci, editor_prefs.tab_width);
|
||||
|
||||
@ -209,7 +210,7 @@ void document_apply_update_prefs(gint idx)
|
||||
// remove indent spaces on backspace, if using spaces to indent
|
||||
SSM(sci, SCI_SETBACKSPACEUNINDENTS, ! editor_prefs.use_tabs, 0);
|
||||
|
||||
sci_set_autoc_max_height(sci, app->autocompletion_max_height);
|
||||
sci_set_autoc_max_height(sci, editor_prefs.autocompletion_max_height);
|
||||
|
||||
sci_set_indentation_guides(sci, editor_prefs.show_indent_guide);
|
||||
sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
|
||||
@ -327,9 +328,9 @@ static gint document_create_new_sci(const gchar *filename)
|
||||
|
||||
document_apply_update_prefs(new_idx);
|
||||
|
||||
sci_set_tab_indents(sci, app->use_tab_to_indent);
|
||||
sci_set_symbol_margin(sci, app->show_markers_margin);
|
||||
sci_set_line_numbers(sci, app->show_linenumber_margin, 0);
|
||||
sci_set_tab_indents(sci, editor_prefs.use_tab_to_indent);
|
||||
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
|
||||
sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin, 0);
|
||||
sci_set_lines_wrapped(sci, editor_prefs.line_breaking);
|
||||
sci_set_scrollbar_mode(sci, editor_prefs.show_scrollbars);
|
||||
sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
|
||||
@ -343,7 +344,7 @@ static gint document_create_new_sci(const gchar *filename)
|
||||
G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
|
||||
g_signal_connect(G_OBJECT(sci), "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
|
||||
|
||||
pfd = pango_font_description_from_string(app->editor_font);
|
||||
pfd = pango_font_description_from_string(prefs.editor_font);
|
||||
fname = g_strdup_printf("!%s", pango_font_description_get_family(pfd));
|
||||
document_set_font(new_idx, fname, pango_font_description_get_size(pfd) / PANGO_SCALE);
|
||||
pango_font_description_free(pfd);
|
||||
@ -486,7 +487,7 @@ gint document_new_file(const gchar *filename, filetype *ft)
|
||||
document_set_text_changed(idx);
|
||||
ui_document_show_hide(idx); // update the document menu
|
||||
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
sci_goto_pos(doc_list[idx].sci, 0, TRUE);
|
||||
|
||||
// "the" SCI signal (connect after initial setup(i.e. adding text))
|
||||
@ -686,7 +687,7 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
"This can occur if the file contains a NULL byte. "
|
||||
"Be aware that saving it can cause data loss.\nThe file was set to read-only.");
|
||||
|
||||
if (app->main_window_realized)
|
||||
if (main_status.main_window_realized)
|
||||
dialogs_show_msgbox(GTK_MESSAGE_WARNING, warn_msg, utf8_filename);
|
||||
|
||||
msgwin_status_add(warn_msg, utf8_filename);
|
||||
@ -851,7 +852,7 @@ gint document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly);
|
||||
|
||||
// update line number margin width
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
|
||||
// set the cursor position according to pos, cl_options.goto_line and cl_options.goto_column
|
||||
set_cursor_position(idx, pos);
|
||||
@ -876,7 +877,7 @@ gint document_open_file(gint idx, const gchar *filename, gint pos, gboolean read
|
||||
ui_document_show_hide(idx); // update the document menu
|
||||
|
||||
// finally add current file to recent files menu, but not the files from the last session
|
||||
if (! app->opening_session_files)
|
||||
if (! main_status.opening_session_files)
|
||||
ui_add_recent_file(utf8_filename);
|
||||
|
||||
if (! reload && geany_object)
|
||||
@ -1107,13 +1108,13 @@ gboolean document_save_file(gint idx, gboolean force)
|
||||
store_saved_encoding(idx);
|
||||
|
||||
// ignore the following things if we are quitting
|
||||
if (! app->quitting)
|
||||
if (! main_status.quitting)
|
||||
{
|
||||
gchar *base_name = g_path_get_basename(doc_list[idx].file_name);
|
||||
|
||||
// set line numbers again, to reset the margin width, if
|
||||
// there are more lines than before
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
sci_set_savepoint(doc_list[idx].sci);
|
||||
|
||||
/* stat the file to get the timestamp, otherwise on Windows the actual
|
||||
@ -1245,7 +1246,7 @@ gint document_find_text(gint idx, const gchar *text, gint flags, gboolean search
|
||||
}
|
||||
|
||||
// we searched only part of the document, so ask whether to wraparound.
|
||||
if (app->pref_main_suppress_search_dialogs ||
|
||||
if (prefs.suppress_search_dialogs ||
|
||||
dialogs_show_question_full(parent, GTK_STOCK_FIND, GTK_STOCK_CANCEL,
|
||||
_("Wrap search and find again?"), _("\"%s\" was not found."), text))
|
||||
{
|
||||
@ -1847,7 +1848,7 @@ void document_print(gint idx)
|
||||
if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL)
|
||||
return;
|
||||
|
||||
cmdline = g_strdup(app->tools_print_cmd);
|
||||
cmdline = g_strdup(prefs.tools_print_cmd);
|
||||
cmdline = utils_str_replace(cmdline, "%f", doc_list[idx].file_name);
|
||||
|
||||
if (dialogs_show_question(
|
||||
@ -2030,7 +2031,7 @@ void document_undo_clear(gint idx)
|
||||
doc_list[idx].redo_actions = NULL;
|
||||
|
||||
doc_list[idx].changed = FALSE;
|
||||
if (! app->quitting) document_set_text_changed(idx);
|
||||
if (! main_status.quitting) document_set_text_changed(idx);
|
||||
|
||||
//geany_debug("%s: new undo stack height: %d, new redo stack height: %d", __func__,
|
||||
//g_trash_stack_height(&doc_list[idx].undo_actions), g_trash_stack_height(&doc_list[idx].redo_actions));
|
||||
|
@ -556,7 +556,7 @@ static gint brace_match(ScintillaObject *sci, gint pos)
|
||||
|
||||
styBrace = sci_get_style_at(sci, pos);
|
||||
|
||||
if (utils_is_opening_brace(chBrace))
|
||||
if (utils_is_opening_brace(chBrace, editor_prefs.brace_match_ltgt))
|
||||
direction = 1;
|
||||
|
||||
pos = pos + direction;
|
||||
@ -690,7 +690,8 @@ static gint find_previous_brace(ScintillaObject *sci, gint pos)
|
||||
{
|
||||
c = SSM(sci, SCI_GETCHARAT, pos, 0);
|
||||
pos--;
|
||||
if (utils_is_opening_brace(c)) return pos;
|
||||
if (utils_is_opening_brace(c, editor_prefs.brace_match_ltgt))
|
||||
return pos;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -1908,10 +1909,10 @@ void editor_highlight_braces(ScintillaObject *sci, gint cur_pos)
|
||||
gint brace_pos = cur_pos - 1;
|
||||
gint end_pos;
|
||||
|
||||
if (! utils_isbrace(sci_get_char_at(sci, brace_pos)))
|
||||
if (! utils_isbrace(sci_get_char_at(sci, brace_pos), editor_prefs.brace_match_ltgt))
|
||||
{
|
||||
brace_pos++;
|
||||
if (! utils_isbrace(sci_get_char_at(sci, brace_pos)))
|
||||
if (! utils_isbrace(sci_get_char_at(sci, brace_pos), editor_prefs.brace_match_ltgt))
|
||||
{
|
||||
SSM(sci, SCI_BRACEBADLIGHT, -1, 0);
|
||||
return;
|
||||
|
25
src/editor.h
25
src/editor.h
@ -65,6 +65,14 @@ typedef struct EditorPrefs
|
||||
gboolean disable_dnd;
|
||||
gboolean smart_home_key;
|
||||
GHashTable *auto_completions;
|
||||
gboolean brace_match_ltgt; // whether to highlight < and > chars
|
||||
gboolean use_tab_to_indent;
|
||||
gint autocompletion_max_height;
|
||||
gint long_line_type;
|
||||
gint long_line_column;
|
||||
gchar *long_line_color;
|
||||
gboolean show_markers_margin;
|
||||
gboolean show_linenumber_margin;
|
||||
} EditorPrefs;
|
||||
|
||||
extern EditorPrefs editor_prefs;
|
||||
@ -72,8 +80,8 @@ extern EditorPrefs editor_prefs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *current_word; // holds word under the mouse or keyboard cursor
|
||||
gint click_pos; // text position where the mouse was clicked
|
||||
gchar *current_word; // holds word under the mouse or keyboard cursor
|
||||
gint click_pos; // text position where the mouse was clicked
|
||||
} EditorInfo;
|
||||
|
||||
extern EditorInfo editor_info;
|
||||
@ -81,12 +89,9 @@ extern EditorInfo editor_info;
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
on_editor_button_press_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data);
|
||||
gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *event,
|
||||
gpointer user_data);
|
||||
|
||||
// callback func called by all editors when a signal arises
|
||||
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
|
||||
|
||||
gboolean editor_start_auto_complete(gint idx, gint pos, gboolean force);
|
||||
@ -99,12 +104,8 @@ void editor_auto_latex(gint idx, gint pos);
|
||||
|
||||
void editor_show_macro_list(ScintillaObject *sci);
|
||||
|
||||
/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
|
||||
* NULL terminated in any case, even when the word is truncated because wordlen is too small.
|
||||
* position can be -1, then the current position is used.
|
||||
* wc are the wordchars to use, if NULL, GEANY_WORDCHARS will be used */
|
||||
void editor_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen,
|
||||
const gchar *wc);
|
||||
const gchar *wc);
|
||||
|
||||
gboolean editor_show_calltip(gint idx, gint pos);
|
||||
|
||||
|
118
src/geany.h
118
src/geany.h
@ -21,6 +21,9 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* Main header - should be included first in all source files.
|
||||
* externs and function prototypes are implemented in main.c. */
|
||||
|
||||
#ifndef GEANY_H
|
||||
#define GEANY_H
|
||||
|
||||
@ -80,114 +83,29 @@ typedef struct filetype filetype;
|
||||
typedef struct _GeanyProject GeanyProject;
|
||||
|
||||
|
||||
/* store some pointers and variables for frequently used widgets */
|
||||
typedef struct MyApp
|
||||
/* Commonly used items.
|
||||
* Remember to increment abi_version in plugindata.h when changing items. */
|
||||
typedef struct GeanyApp
|
||||
{
|
||||
gint toolbar_icon_style;
|
||||
// 0:x, 1:y, 2:width, 3:height, flag for maximized state
|
||||
gint geometry[5];
|
||||
gboolean debug_mode;
|
||||
// represents the state at startup while opening session files
|
||||
gboolean opening_session_files;
|
||||
// represents the state when Geany is quitting completely
|
||||
gboolean quitting;
|
||||
gboolean ignore_callback;
|
||||
gboolean ignore_global_tags;
|
||||
gboolean toolbar_visible;
|
||||
gboolean sidebar_symbol_visible;
|
||||
gboolean sidebar_openfiles_visible;
|
||||
gboolean sidebar_visible;
|
||||
gboolean statusbar_visible;
|
||||
gboolean msgwindow_visible;
|
||||
gboolean fullscreen;
|
||||
gboolean beep_on_errors;
|
||||
gboolean switch_msgwin_pages;
|
||||
gboolean auto_focus;
|
||||
gboolean show_notebook_tabs;
|
||||
gboolean tab_order_ltr;
|
||||
gboolean show_markers_margin;
|
||||
gboolean show_linenumber_margin;
|
||||
gboolean brace_match_ltgt;
|
||||
gboolean use_tab_to_indent;
|
||||
gboolean main_window_realized;
|
||||
gboolean pref_main_load_session;
|
||||
gboolean pref_main_save_winpos;
|
||||
gboolean pref_main_confirm_exit;
|
||||
gboolean pref_main_suppress_search_dialogs;
|
||||
gboolean pref_main_suppress_status_messages;
|
||||
gboolean pref_toolbar_show_search;
|
||||
gboolean pref_toolbar_show_goto;
|
||||
gboolean pref_toolbar_show_undo;
|
||||
gboolean pref_toolbar_show_navigation;
|
||||
gboolean pref_toolbar_show_compile;
|
||||
gboolean pref_toolbar_show_zoom;
|
||||
gboolean pref_toolbar_show_colour;
|
||||
gboolean pref_toolbar_show_fileops;
|
||||
gboolean pref_toolbar_show_quit;
|
||||
gint tab_pos_editor;
|
||||
gint tab_pos_msgwin;
|
||||
gint tab_pos_sidebar;
|
||||
guint mru_length;
|
||||
gint autocompletion_max_height;
|
||||
gint long_line_type;
|
||||
gint long_line_column;
|
||||
gchar *long_line_color;
|
||||
gchar *context_action_cmd;
|
||||
gchar *pref_template_developer;
|
||||
gchar *pref_template_company;
|
||||
gchar *pref_template_mail;
|
||||
gchar *pref_template_initial;
|
||||
gchar *pref_template_version;
|
||||
gchar *editor_font;
|
||||
gchar *tagbar_font;
|
||||
gchar *msgwin_font;
|
||||
gboolean debug_mode;
|
||||
gchar *configdir;
|
||||
gchar *datadir;
|
||||
gchar *docdir;
|
||||
gchar *default_open_path;
|
||||
gchar *custom_date_format;
|
||||
gchar **custom_commands;
|
||||
gchar *tools_browser_cmd;
|
||||
gchar *tools_make_cmd;
|
||||
gchar *tools_term_cmd;
|
||||
gchar *tools_print_cmd;
|
||||
gchar *tools_grep_cmd;
|
||||
GtkIconSize toolbar_icon_size;
|
||||
const TMWorkspace *tm_workspace;
|
||||
GeanyProject *project; // currently active project or NULL if none is open
|
||||
gboolean ignore_callback; // should not be used in new code (use clicked instead of toggled signal)
|
||||
|
||||
/* Important widgets */
|
||||
GtkWidget *window;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *run_button;
|
||||
GtkWidget *compile_button;
|
||||
GtkWidget *compile_button_image;
|
||||
GtkWidget *tagbar;
|
||||
GtkWidget *treeview_notebook;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *statusbar;
|
||||
GtkWidget *window;
|
||||
GtkWidget *statusbar; // use ui_set_statusbar() or msgwin_status_add() to set
|
||||
GtkWidget *popup_menu;
|
||||
GtkWidget *toolbar_menu;
|
||||
GtkWidget *new_file_menu;
|
||||
GtkWidget *recent_files_menuitem;
|
||||
GtkWidget *recent_files_menubar;
|
||||
GtkWidget *recent_files_toolbar;
|
||||
GtkWidget *menu_insert_include_item[2];
|
||||
GtkWidget *popup_goto_items[3];
|
||||
GtkWidget *popup_items[5];
|
||||
GtkWidget *menu_copy_items[5];
|
||||
GtkWidget *redo_items[3];
|
||||
GtkWidget *undo_items[3];
|
||||
GtkWidget *save_buttons[4];
|
||||
GtkWidget *navigation_buttons[2];
|
||||
GtkWidget *open_colorsel;
|
||||
GtkWidget *open_fontsel;
|
||||
GtkWidget *open_filesel;
|
||||
GtkWidget *save_filesel;
|
||||
GtkWidget *prefs_dialog;
|
||||
GtkWidget *default_tag_tree;
|
||||
const TMWorkspace *tm_workspace;
|
||||
GQueue *recent_queue;
|
||||
GeanyProject *project; // currently active project or NULL if none is open
|
||||
} MyApp;
|
||||
}
|
||||
GeanyApp;
|
||||
|
||||
extern MyApp *app;
|
||||
extern GeanyApp *app;
|
||||
|
||||
|
||||
enum
|
||||
@ -221,7 +139,7 @@ enum
|
||||
#endif
|
||||
|
||||
|
||||
// implementation in main.c; prototype is here so that all files can use it.
|
||||
// prototype is here so that all files can use it.
|
||||
void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
#endif
|
||||
|
@ -619,7 +619,7 @@ apply_filetype_properties(ScintillaObject *sci, gint lexer, filetype_id ft_id)
|
||||
// have to set whitespace after setting wordchars
|
||||
SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars);
|
||||
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0);
|
||||
SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.autocompletion_max_height, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,10 +579,10 @@ void keybindings_show_shortcuts()
|
||||
|
||||
prefs_show_dialog();
|
||||
// select the KB page
|
||||
wid = lookup_widget(app->prefs_dialog, "frame22");
|
||||
wid = lookup_widget(ui_widgets.prefs_dialog, "frame22");
|
||||
if (wid != NULL)
|
||||
{
|
||||
GtkNotebook *nb = GTK_NOTEBOOK(lookup_widget(app->prefs_dialog, "notebook2"));
|
||||
GtkNotebook *nb = GTK_NOTEBOOK(lookup_widget(ui_widgets.prefs_dialog, "notebook2"));
|
||||
|
||||
if (nb != NULL)
|
||||
gtk_notebook_set_current_page(nb, gtk_notebook_page_num(nb, wid));
|
||||
@ -605,7 +605,7 @@ static gboolean check_fixed_kb(GdkEventKey *event)
|
||||
if (event->keyval == GDK_0)
|
||||
page = npages - 1;
|
||||
// invert the order if tabs are added on the other side
|
||||
if (swap_alt_tab_order && ! app->tab_order_ltr)
|
||||
if (swap_alt_tab_order && ! prefs.tab_order_ltr)
|
||||
page = (npages - 1) - page;
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page);
|
||||
@ -973,7 +973,7 @@ static void cb_func_switch_scribble(G_GNUC_UNUSED guint key_id)
|
||||
|
||||
static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
|
||||
{
|
||||
if (app->toolbar_visible && app->pref_toolbar_show_search)
|
||||
if (prefs.toolbar_visible && prefs.toolbar_show_search)
|
||||
gtk_widget_grab_focus(lookup_widget(app->window, "entry1"));
|
||||
}
|
||||
|
||||
@ -1028,7 +1028,7 @@ static void goto_matching_brace(gint idx)
|
||||
if (! DOC_IDX_VALID(idx)) return;
|
||||
|
||||
pos = sci_get_current_position(doc_list[idx].sci);
|
||||
if (! utils_isbrace(sci_get_char_at(doc_list[idx].sci, pos)))
|
||||
if (! utils_isbrace(sci_get_char_at(doc_list[idx].sci, pos), TRUE))
|
||||
pos--; // set pos to the brace
|
||||
|
||||
new_pos = sci_find_bracematch(doc_list[idx].sci, pos);
|
||||
@ -1187,16 +1187,16 @@ static void cb_func_edit(guint key_id)
|
||||
on_to_upper_case1_activate(NULL, NULL);
|
||||
break;
|
||||
case GEANY_KEYS_EDIT_SENDTOCMD1:
|
||||
if (app->custom_commands && g_strv_length(app->custom_commands) > 0)
|
||||
tools_execute_custom_command(idx, app->custom_commands[0]);
|
||||
if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 0)
|
||||
tools_execute_custom_command(idx, ui_prefs.custom_commands[0]);
|
||||
break;
|
||||
case GEANY_KEYS_EDIT_SENDTOCMD2:
|
||||
if (app->custom_commands && g_strv_length(app->custom_commands) > 1)
|
||||
tools_execute_custom_command(idx, app->custom_commands[1]);
|
||||
if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 1)
|
||||
tools_execute_custom_command(idx, ui_prefs.custom_commands[1]);
|
||||
break;
|
||||
case GEANY_KEYS_EDIT_SENDTOCMD3:
|
||||
if (app->custom_commands && g_strv_length(app->custom_commands) > 2)
|
||||
tools_execute_custom_command(idx, app->custom_commands[2]);
|
||||
if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2)
|
||||
tools_execute_custom_command(idx, ui_prefs.custom_commands[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
289
src/keyfile.c
289
src/keyfile.c
@ -38,6 +38,7 @@
|
||||
|
||||
#include "support.h"
|
||||
#include "keyfile.h"
|
||||
#include "prefs.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "document.h"
|
||||
@ -60,16 +61,16 @@ static gint vpan_position;
|
||||
|
||||
static void save_recent_files(GKeyFile *config)
|
||||
{
|
||||
gchar **recent_files = g_new0(gchar*, app->mru_length + 1);
|
||||
gchar **recent_files = g_new0(gchar*, prefs.mru_length + 1);
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < app->mru_length; i++)
|
||||
for (i = 0; i < prefs.mru_length; i++)
|
||||
{
|
||||
if (! g_queue_is_empty(app->recent_queue))
|
||||
if (! g_queue_is_empty(ui_prefs.recent_queue))
|
||||
{
|
||||
// copy the values, this is necessary when this function is called from the
|
||||
// preferences dialog or when quitting is canceled to keep the queue intact
|
||||
recent_files[i] = g_strdup(g_queue_peek_nth(app->recent_queue, i));
|
||||
recent_files[i] = g_strdup(g_queue_peek_nth(ui_prefs.recent_queue, i));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -78,9 +79,9 @@ static void save_recent_files(GKeyFile *config)
|
||||
}
|
||||
}
|
||||
// There is a bug in GTK2.6 g_key_file_set_string_list, we must NULL terminate.
|
||||
recent_files[app->mru_length] = NULL;
|
||||
recent_files[prefs.mru_length] = NULL;
|
||||
g_key_file_set_string_list(config, "files", "recent_files",
|
||||
(const gchar**)recent_files, app->mru_length);
|
||||
(const gchar**)recent_files, prefs.mru_length);
|
||||
g_strfreev(recent_files);
|
||||
}
|
||||
|
||||
@ -154,7 +155,7 @@ void configuration_save()
|
||||
scribble_text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
|
||||
|
||||
// store basic settings
|
||||
if (app->pref_main_save_winpos)
|
||||
if (prefs.save_winpos)
|
||||
{
|
||||
g_key_file_set_integer(config, PACKAGE, "treeview_position",
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "hpaned1"))));
|
||||
@ -162,38 +163,38 @@ void configuration_save()
|
||||
gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "vpaned1"))));
|
||||
}
|
||||
|
||||
g_key_file_set_integer(config, PACKAGE, "mru_length", app->mru_length);
|
||||
g_key_file_set_integer(config, PACKAGE, "long_line_type", app->long_line_type);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_editor", app->tab_pos_editor);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_msgwin", app->tab_pos_msgwin);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_sidebar", app->tab_pos_sidebar);
|
||||
g_key_file_set_integer(config, PACKAGE, "autocompletion_max_height", app->autocompletion_max_height);
|
||||
g_key_file_set_integer(config, PACKAGE, "long_line_column", app->long_line_column);
|
||||
g_key_file_set_string(config, PACKAGE, "long_line_color", app->long_line_color);
|
||||
g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", app->beep_on_errors);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", app->sidebar_symbol_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", app->sidebar_openfiles_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", app->statusbar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
|
||||
g_key_file_set_integer(config, PACKAGE, "mru_length", prefs.mru_length);
|
||||
g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_type);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_editor", prefs.tab_pos_editor);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_msgwin", prefs.tab_pos_msgwin);
|
||||
g_key_file_set_integer(config, PACKAGE, "tab_pos_sidebar", prefs.tab_pos_sidebar);
|
||||
g_key_file_set_integer(config, PACKAGE, "autocompletion_max_height", editor_prefs.autocompletion_max_height);
|
||||
g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_column);
|
||||
g_key_file_set_string(config, PACKAGE, "long_line_color", editor_prefs.long_line_color);
|
||||
g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", prefs.beep_on_errors);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", prefs.sidebar_symbol_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", prefs.sidebar_openfiles_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", ui_prefs.sidebar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", prefs.statusbar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", ui_prefs.msgwindow_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
|
||||
g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_editor_scrollbars", editor_prefs.show_scrollbars);
|
||||
g_key_file_set_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode);
|
||||
g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent);
|
||||
g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", editor_prefs.use_tab_to_indent);
|
||||
g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", editor_prefs.show_indent_guide);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_white_space", editor_prefs.show_white_space);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", app->show_markers_margin);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", app->show_linenumber_margin);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", editor_prefs.show_markers_margin);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", editor_prefs.show_linenumber_margin);
|
||||
g_key_file_set_boolean(config, PACKAGE, "line_breaking", editor_prefs.line_breaking);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_line_endings", editor_prefs.show_line_endings);
|
||||
g_key_file_set_boolean(config, PACKAGE, "fullscreen", app->fullscreen);
|
||||
g_key_file_set_boolean(config, PACKAGE, "tab_order_ltr", app->tab_order_ltr);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", app->show_notebook_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", app->brace_match_ltgt);
|
||||
g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages);
|
||||
g_key_file_set_boolean(config, PACKAGE, "auto_focus", app->auto_focus);
|
||||
g_key_file_set_boolean(config, PACKAGE, "fullscreen", ui_prefs.fullscreen);
|
||||
g_key_file_set_boolean(config, PACKAGE, "tab_order_ltr", prefs.tab_order_ltr);
|
||||
g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", prefs.show_notebook_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", editor_prefs.brace_match_ltgt);
|
||||
g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", prefs.switch_msgwin_pages);
|
||||
g_key_file_set_boolean(config, PACKAGE, "auto_focus", prefs.auto_focus);
|
||||
g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
|
||||
g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", editor_prefs.auto_complete_constructs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
|
||||
@ -223,49 +224,49 @@ void configuration_save()
|
||||
g_key_file_set_string(config, "VTE", "last_dir", vte_info.dir);
|
||||
}
|
||||
#endif
|
||||
g_key_file_set_string(config, PACKAGE, "default_open_path", app->default_open_path);
|
||||
g_key_file_set_string(config, PACKAGE, "custom_date_format", app->custom_date_format);
|
||||
g_key_file_set_string(config, PACKAGE, "context_action_cmd", app->context_action_cmd);
|
||||
if (app->custom_commands != NULL)
|
||||
g_key_file_set_string(config, PACKAGE, "default_open_path", prefs.default_open_path);
|
||||
g_key_file_set_string(config, PACKAGE, "custom_date_format", ui_prefs.custom_date_format);
|
||||
g_key_file_set_string(config, PACKAGE, "context_action_cmd", prefs.context_action_cmd);
|
||||
if (ui_prefs.custom_commands != NULL)
|
||||
{
|
||||
g_key_file_set_string_list(config, PACKAGE, "custom_commands",
|
||||
(const gchar**) app->custom_commands, g_strv_length(app->custom_commands));
|
||||
(const gchar**) ui_prefs.custom_commands, g_strv_length(ui_prefs.custom_commands));
|
||||
}
|
||||
|
||||
g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font);
|
||||
g_key_file_set_string(config, PACKAGE, "tagbar_font", app->tagbar_font);
|
||||
g_key_file_set_string(config, PACKAGE, "msgwin_font", app->msgwin_font);
|
||||
g_key_file_set_string(config, PACKAGE, "editor_font", prefs.editor_font);
|
||||
g_key_file_set_string(config, PACKAGE, "tagbar_font", prefs.tagbar_font);
|
||||
g_key_file_set_string(config, PACKAGE, "msgwin_font", prefs.msgwin_font);
|
||||
g_key_file_set_string(config, PACKAGE, "scribble_text", scribble_text);
|
||||
if (app->pref_main_save_winpos && ! app->fullscreen)
|
||||
if (prefs.save_winpos && ! ui_prefs.fullscreen)
|
||||
{
|
||||
gtk_window_get_position(GTK_WINDOW(app->window), &app->geometry[0], &app->geometry[1]);
|
||||
gtk_window_get_size(GTK_WINDOW(app->window), &app->geometry[2], &app->geometry[3]);
|
||||
gtk_window_get_position(GTK_WINDOW(app->window), &ui_prefs.geometry[0], &ui_prefs.geometry[1]);
|
||||
gtk_window_get_size(GTK_WINDOW(app->window), &ui_prefs.geometry[2], &ui_prefs.geometry[3]);
|
||||
if (gdk_window_get_state(app->window->window) & GDK_WINDOW_STATE_MAXIMIZED)
|
||||
app->geometry[4] = 1;
|
||||
ui_prefs.geometry[4] = 1;
|
||||
else
|
||||
app->geometry[4] = 0;
|
||||
ui_prefs.geometry[4] = 0;
|
||||
|
||||
g_key_file_set_integer_list(config, PACKAGE, "geometry", app->geometry, 5);
|
||||
g_key_file_set_integer_list(config, PACKAGE, "geometry", ui_prefs.geometry, 5);
|
||||
}
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", editor_prefs.tab_width);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_use_tabs", editor_prefs.use_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", app->pref_main_confirm_exit);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", app->pref_main_suppress_search_dialogs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_status_messages", app->pref_main_suppress_status_messages);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", app->pref_main_load_session);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", app->pref_main_save_winpos);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", app->toolbar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", app->pref_toolbar_show_search);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", app->pref_toolbar_show_goto);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", app->pref_toolbar_show_zoom);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", app->pref_toolbar_show_undo);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", app->pref_toolbar_show_navigation);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", app->pref_toolbar_show_compile);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", app->pref_toolbar_show_colour);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", app->pref_toolbar_show_fileops);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", app->pref_toolbar_show_quit);
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", app->toolbar_icon_style);
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", app->toolbar_icon_size);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", prefs.confirm_exit);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", prefs.suppress_search_dialogs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_status_messages", prefs.suppress_status_messages);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", prefs.load_session);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", prefs.save_winpos);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", prefs.toolbar_visible);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", prefs.toolbar_show_search);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", prefs.toolbar_show_goto);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", prefs.toolbar_show_zoom);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", prefs.toolbar_show_undo);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", prefs.toolbar_show_navigation);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", prefs.toolbar_show_compile);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", prefs.toolbar_show_colour);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", prefs.toolbar_show_fileops);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", prefs.toolbar_show_quit);
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", prefs.toolbar_icon_style);
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", prefs.toolbar_icon_size);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", editor_prefs.new_line);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", editor_prefs.replace_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", editor_prefs.trail_space);
|
||||
@ -276,24 +277,24 @@ void configuration_save()
|
||||
g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", "none");
|
||||
else
|
||||
g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", encodings[editor_prefs.default_open_encoding].charset);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_mail", app->pref_template_mail);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_initial", app->pref_template_initial);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_version", app->pref_template_version);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_developer", prefs.template_developer);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_company", prefs.template_company);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_mail", prefs.template_mail);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_initial", prefs.template_initial);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_version", prefs.template_version);
|
||||
|
||||
// store tools settings
|
||||
g_key_file_set_string(config, "tools", "make_cmd", app->tools_make_cmd ? app->tools_make_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "term_cmd", app->tools_term_cmd ? app->tools_term_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "browser_cmd", app->tools_browser_cmd ? app->tools_browser_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "print_cmd", app->tools_print_cmd ? app->tools_print_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "grep_cmd", app->tools_grep_cmd ? app->tools_grep_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "make_cmd", prefs.tools_make_cmd ? prefs.tools_make_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "term_cmd", prefs.tools_term_cmd ? prefs.tools_term_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "browser_cmd", prefs.tools_browser_cmd ? prefs.tools_browser_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "print_cmd", prefs.tools_print_cmd ? prefs.tools_print_cmd : "");
|
||||
g_key_file_set_string(config, "tools", "grep_cmd", prefs.tools_grep_cmd ? prefs.tools_grep_cmd : "");
|
||||
|
||||
// search
|
||||
g_key_file_set_string(config, "search", "fif_extra_options", search_prefs.fif_extra_options ? search_prefs.fif_extra_options : "");
|
||||
|
||||
// startup
|
||||
g_key_file_set_boolean(config, "startup", "load_plugins", main_prefs.load_plugins);
|
||||
g_key_file_set_boolean(config, "startup", "load_plugins", prefs.load_plugins);
|
||||
|
||||
project_save_prefs(config); // save project filename, etc.
|
||||
save_recent_files(config);
|
||||
@ -323,10 +324,10 @@ static void load_file_lists(GKeyFile *config)
|
||||
recent_files = g_key_file_get_string_list(config, "files", "recent_files", &len, NULL);
|
||||
if (recent_files != NULL)
|
||||
{
|
||||
for (i = 0; (i < len) && (i < app->mru_length); i++)
|
||||
for (i = 0; (i < len) && (i < prefs.mru_length); i++)
|
||||
{
|
||||
gchar *filename = g_strdup(recent_files[i]);
|
||||
g_queue_push_tail(app->recent_queue, filename);
|
||||
g_queue_push_tail(ui_prefs.recent_queue, filename);
|
||||
}
|
||||
}
|
||||
g_strfreev(recent_files);
|
||||
@ -377,32 +378,32 @@ gboolean configuration_load()
|
||||
|
||||
g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
|
||||
|
||||
app->toolbar_visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
|
||||
prefs.toolbar_visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
|
||||
{
|
||||
GtkIconSize tb_iconsize;
|
||||
GtkToolbarStyle tb_style;
|
||||
GEANY_GET_SETTING("gtk-toolbar-style", tb_style, GTK_TOOLBAR_ICONS);
|
||||
GEANY_GET_SETTING("gtk-toolbar-icon-size", tb_iconsize, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
app->toolbar_icon_style = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_style", tb_style);
|
||||
app->toolbar_icon_size = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_size", tb_iconsize);
|
||||
prefs.toolbar_icon_style = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_style", tb_style);
|
||||
prefs.toolbar_icon_size = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_size", tb_iconsize);
|
||||
}
|
||||
app->beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE);
|
||||
app->mru_length = utils_get_setting_integer(config, PACKAGE, "mru_length", GEANY_DEFAULT_MRU_LENGTH);
|
||||
app->long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
|
||||
app->long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
|
||||
app->long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
|
||||
app->autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_HEIGHT);
|
||||
app->tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
|
||||
app->tab_pos_msgwin = utils_get_setting_integer(config, PACKAGE, "tab_pos_msgwin",GTK_POS_LEFT);
|
||||
app->tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
|
||||
app->sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
|
||||
app->sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
|
||||
app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
|
||||
app->statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
|
||||
app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
|
||||
prefs.beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE);
|
||||
prefs.mru_length = utils_get_setting_integer(config, PACKAGE, "mru_length", GEANY_DEFAULT_MRU_LENGTH);
|
||||
editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
|
||||
editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
|
||||
editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
|
||||
editor_prefs.autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_HEIGHT);
|
||||
prefs.tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
|
||||
prefs.tab_pos_msgwin = utils_get_setting_integer(config, PACKAGE, "tab_pos_msgwin",GTK_POS_LEFT);
|
||||
prefs.tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
|
||||
prefs.sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
|
||||
prefs.sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
|
||||
ui_prefs.sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
|
||||
prefs.statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
|
||||
ui_prefs.msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
|
||||
editor_prefs.line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
|
||||
editor_prefs.indent_mode = utils_get_setting_integer(config, PACKAGE, "indent_mode", INDENT_ADVANCED);
|
||||
app->use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
|
||||
editor_prefs.use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
|
||||
editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
|
||||
editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
|
||||
editor_prefs.show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE);
|
||||
@ -413,38 +414,38 @@ gboolean configuration_load()
|
||||
editor_prefs.folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
|
||||
editor_prefs.unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
|
||||
editor_prefs.show_scrollbars = utils_get_setting_boolean(config, PACKAGE, "show_editor_scrollbars", TRUE);
|
||||
app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
|
||||
app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
|
||||
app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
|
||||
app->tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", TRUE);
|
||||
app->show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
|
||||
app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
|
||||
app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
|
||||
app->auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE);
|
||||
app->custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
|
||||
app->context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
|
||||
app->default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");
|
||||
app->custom_commands = g_key_file_get_string_list(config, PACKAGE, "custom_commands", NULL, NULL);
|
||||
app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR);
|
||||
app->tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST);
|
||||
app->msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);
|
||||
editor_prefs.show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
|
||||
editor_prefs.show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
|
||||
ui_prefs.fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
|
||||
prefs.tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", TRUE);
|
||||
prefs.show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
|
||||
editor_prefs.brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
|
||||
prefs.switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
|
||||
prefs.auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE);
|
||||
ui_prefs.custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
|
||||
prefs.context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
|
||||
prefs.default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");
|
||||
ui_prefs.custom_commands = g_key_file_get_string_list(config, PACKAGE, "custom_commands", NULL, NULL);
|
||||
prefs.editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR);
|
||||
prefs.tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST);
|
||||
prefs.msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);
|
||||
scribble_text = utils_get_setting_string(config, PACKAGE, "scribble_text",
|
||||
_("Type here what you want, use it as a notice/scratch board"));
|
||||
|
||||
geo = g_key_file_get_integer_list(config, PACKAGE, "geometry", NULL, &error);
|
||||
if (error)
|
||||
{
|
||||
app->geometry[0] = -1;
|
||||
ui_prefs.geometry[0] = -1;
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
app->geometry[0] = geo[0];
|
||||
app->geometry[1] = geo[1];
|
||||
app->geometry[2] = geo[2];
|
||||
app->geometry[3] = geo[3];
|
||||
app->geometry[4] = geo[4];
|
||||
ui_prefs.geometry[0] = geo[0];
|
||||
ui_prefs.geometry[1] = geo[1];
|
||||
ui_prefs.geometry[2] = geo[2];
|
||||
ui_prefs.geometry[3] = geo[3];
|
||||
ui_prefs.geometry[4] = geo[4];
|
||||
}
|
||||
hpan_position = utils_get_setting_integer(config, PACKAGE, "treeview_position", 156);
|
||||
vpan_position = utils_get_setting_integer(config, PACKAGE, "msgwindow_position", (geo) ?
|
||||
@ -479,20 +480,20 @@ gboolean configuration_load()
|
||||
|
||||
g_free(tmp_string);
|
||||
}
|
||||
app->pref_main_confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
|
||||
app->pref_main_suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE);
|
||||
app->pref_main_suppress_status_messages = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_status_messages", FALSE);
|
||||
app->pref_main_load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
|
||||
app->pref_main_save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
|
||||
app->pref_toolbar_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
|
||||
app->pref_toolbar_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
|
||||
app->pref_toolbar_show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
|
||||
app->pref_toolbar_show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
|
||||
app->pref_toolbar_show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
|
||||
app->pref_toolbar_show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
|
||||
app->pref_toolbar_show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
|
||||
app->pref_toolbar_show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
|
||||
app->pref_toolbar_show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
|
||||
prefs.confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
|
||||
prefs.suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE);
|
||||
prefs.suppress_status_messages = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_status_messages", FALSE);
|
||||
prefs.load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
|
||||
prefs.save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
|
||||
prefs.toolbar_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
|
||||
prefs.toolbar_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
|
||||
prefs.toolbar_show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
|
||||
prefs.toolbar_show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
|
||||
prefs.toolbar_show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
|
||||
prefs.toolbar_show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
|
||||
prefs.toolbar_show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
|
||||
prefs.toolbar_show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
|
||||
prefs.toolbar_show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
|
||||
#ifdef HAVE_VTE
|
||||
vte_info.load_vte = utils_get_setting_boolean(config, "VTE", "load_vte", TRUE);
|
||||
if (vte_info.load_vte)
|
||||
@ -528,17 +529,17 @@ gboolean configuration_load()
|
||||
g_free(tmp_string);
|
||||
}
|
||||
#endif
|
||||
app->pref_template_developer = utils_get_setting_string(config, PACKAGE, "pref_template_developer", g_get_real_name());
|
||||
app->pref_template_company = utils_get_setting_string(config, PACKAGE, "pref_template_company", "");
|
||||
tmp_string = utils_get_initials(app->pref_template_developer);
|
||||
app->pref_template_initial = utils_get_setting_string(config, PACKAGE, "pref_template_initial", tmp_string);
|
||||
prefs.template_developer = utils_get_setting_string(config, PACKAGE, "pref_template_developer", g_get_real_name());
|
||||
prefs.template_company = utils_get_setting_string(config, PACKAGE, "pref_template_company", "");
|
||||
tmp_string = utils_get_initials(prefs.template_developer);
|
||||
prefs.template_initial = utils_get_setting_string(config, PACKAGE, "pref_template_initial", tmp_string);
|
||||
g_free(tmp_string);
|
||||
|
||||
app->pref_template_version = utils_get_setting_string(config, PACKAGE, "pref_template_version", "1.0");
|
||||
prefs.template_version = utils_get_setting_string(config, PACKAGE, "pref_template_version", "1.0");
|
||||
|
||||
tmp_string2 = utils_get_hostname();
|
||||
tmp_string = g_strdup_printf("%s@%s", g_get_user_name(), tmp_string2);
|
||||
app->pref_template_mail = utils_get_setting_string(config, PACKAGE, "pref_template_mail", tmp_string);
|
||||
prefs.template_mail = utils_get_setting_string(config, PACKAGE, "pref_template_mail", tmp_string);
|
||||
g_free(tmp_string);
|
||||
g_free(tmp_string2);
|
||||
|
||||
@ -549,15 +550,15 @@ gboolean configuration_load()
|
||||
editor_prefs.smart_home_key = utils_get_setting_boolean(config, PACKAGE, "pref_editor_smart_home_key", TRUE);
|
||||
|
||||
tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE);
|
||||
app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);
|
||||
prefs.tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);
|
||||
g_free(tmp_string);
|
||||
|
||||
tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_TERMINAL);
|
||||
app->tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string);
|
||||
prefs.tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string);
|
||||
g_free(tmp_string);
|
||||
|
||||
tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_BROWSER);
|
||||
app->tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
|
||||
prefs.tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
|
||||
g_free(tmp_string);
|
||||
|
||||
tmp_string2 = g_find_program_in_path(GEANY_DEFAULT_TOOLS_PRINTCMD);
|
||||
@ -567,19 +568,19 @@ gboolean configuration_load()
|
||||
#else
|
||||
tmp_string = g_strconcat(tmp_string2, " %f", NULL);
|
||||
#endif
|
||||
app->tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string);
|
||||
prefs.tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string);
|
||||
g_free(tmp_string);
|
||||
g_free(tmp_string2);
|
||||
|
||||
tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_GREP);
|
||||
app->tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
|
||||
prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
|
||||
g_free(tmp_string);
|
||||
|
||||
// search
|
||||
search_prefs.fif_extra_options = utils_get_setting_string(config, "search", "fif_extra_options", "");
|
||||
|
||||
// startup
|
||||
main_prefs.load_plugins = utils_get_setting_boolean(config, "startup", "load_plugins", TRUE);
|
||||
prefs.load_plugins = utils_get_setting_boolean(config, "startup", "load_plugins", TRUE);
|
||||
|
||||
project_load_prefs(config);
|
||||
load_file_lists(config);
|
||||
@ -599,7 +600,7 @@ gboolean configuration_open_files()
|
||||
|
||||
document_delay_colourise();
|
||||
|
||||
i = app->tab_order_ltr ? 0 : (session_files->len - 1);
|
||||
i = prefs.tab_order_ltr ? 0 : (session_files->len - 1);
|
||||
while (TRUE)
|
||||
{
|
||||
gchar *tmp = g_ptr_array_index(session_files, i);
|
||||
@ -648,7 +649,7 @@ gboolean configuration_open_files()
|
||||
}
|
||||
g_free(tmp);
|
||||
|
||||
if (app->tab_order_ltr)
|
||||
if (prefs.tab_order_ltr)
|
||||
{
|
||||
i++;
|
||||
if (i >= (gint)session_files->len) break;
|
||||
@ -681,7 +682,7 @@ void configuration_apply_settings()
|
||||
g_free(scribble_text);
|
||||
|
||||
// set the position of the hpaned and vpaned
|
||||
if (app->pref_main_save_winpos)
|
||||
if (prefs.save_winpos)
|
||||
{
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "hpaned1")), hpan_position);
|
||||
gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "vpaned1")), vpan_position);
|
||||
@ -689,10 +690,10 @@ void configuration_apply_settings()
|
||||
|
||||
// set fullscreen after initial draw so that returning to normal view is the right size.
|
||||
// fullscreen mode is disabled by default, so act only if it is true
|
||||
if (app->fullscreen)
|
||||
if (ui_prefs.fullscreen)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_fullscreen1")), TRUE);
|
||||
app->fullscreen = TRUE;
|
||||
ui_prefs.fullscreen = TRUE;
|
||||
ui_set_fullscreen();
|
||||
}
|
||||
}
|
||||
|
256
src/main.c
256
src/main.c
@ -40,6 +40,7 @@
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "prefs.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
@ -80,11 +81,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
MyApp *app;
|
||||
GeanyApp *app;
|
||||
|
||||
GeanyStatus main_status;
|
||||
CommandLineOptions cl_options; // fields initialised in parse_command_line_options
|
||||
|
||||
MainPrefs main_prefs;
|
||||
|
||||
static gboolean want_plugins;
|
||||
|
||||
@ -155,21 +156,21 @@ static void apply_settings(void)
|
||||
ui_update_fold_items();
|
||||
|
||||
// toolbar, message window and sidebar are by default visible, so don't change it if it is true
|
||||
if (! app->toolbar_visible)
|
||||
if (! prefs.toolbar_visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_toolbar1")), FALSE);
|
||||
gtk_widget_hide(app->toolbar);
|
||||
app->ignore_callback = FALSE;
|
||||
}
|
||||
if (! app->msgwindow_visible)
|
||||
if (! ui_prefs.msgwindow_visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")), FALSE);
|
||||
gtk_widget_hide(lookup_widget(app->window, "scrolledwindow1"));
|
||||
app->ignore_callback = FALSE;
|
||||
}
|
||||
if (! app->sidebar_visible)
|
||||
if (! ui_prefs.sidebar_visible)
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_sidebar1")), FALSE);
|
||||
@ -177,60 +178,60 @@ static void apply_settings(void)
|
||||
}
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
// sets the icon style of the toolbar
|
||||
switch (app->toolbar_icon_style)
|
||||
switch (prefs.toolbar_icon_style)
|
||||
{
|
||||
case GTK_TOOLBAR_BOTH:
|
||||
{
|
||||
//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_and_text1")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "images_and_text2")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_and_text2")), TRUE);
|
||||
break;
|
||||
}
|
||||
case GTK_TOOLBAR_ICONS:
|
||||
{
|
||||
//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_only1")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "images_only2")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_only2")), TRUE);
|
||||
break;
|
||||
}
|
||||
case GTK_TOOLBAR_TEXT:
|
||||
{
|
||||
//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "text_only1")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "text_only2")), TRUE);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "text_only2")), TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_style);
|
||||
|
||||
// sets the icon size of the toolbar, use user preferences (.gtkrc) if not set
|
||||
if (app->toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR ||
|
||||
app->toolbar_icon_size == GTK_ICON_SIZE_LARGE_TOOLBAR)
|
||||
if (prefs.toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR ||
|
||||
prefs.toolbar_icon_size == GTK_ICON_SIZE_LARGE_TOOLBAR)
|
||||
{
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_size);
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_size);
|
||||
}
|
||||
ui_update_toolbar_icons(app->toolbar_icon_size);
|
||||
ui_update_toolbar_icons(prefs.toolbar_icon_size);
|
||||
|
||||
// line number and markers margin are by default enabled
|
||||
if (! app->show_markers_margin)
|
||||
if (! editor_prefs.show_markers_margin)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_markers_margin1")), FALSE);
|
||||
app->show_markers_margin = FALSE;
|
||||
editor_prefs.show_markers_margin = FALSE;
|
||||
}
|
||||
if (! app->show_linenumber_margin)
|
||||
if (! editor_prefs.show_linenumber_margin)
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_linenumber_margin1")), FALSE);
|
||||
app->show_linenumber_margin = FALSE;
|
||||
editor_prefs.show_linenumber_margin = FALSE;
|
||||
}
|
||||
|
||||
// interprets the saved window geometry
|
||||
if (app->pref_main_save_winpos && app->geometry[0] != -1)
|
||||
if (prefs.save_winpos && ui_prefs.geometry[0] != -1)
|
||||
{
|
||||
gtk_window_move(GTK_WINDOW(app->window), app->geometry[0], app->geometry[1]);
|
||||
gtk_window_set_default_size(GTK_WINDOW(app->window), app->geometry[2], app->geometry[3]);
|
||||
if (app->geometry[4] == 1)
|
||||
gtk_window_move(GTK_WINDOW(app->window), ui_prefs.geometry[0], ui_prefs.geometry[1]);
|
||||
gtk_window_set_default_size(GTK_WINDOW(app->window), ui_prefs.geometry[2], ui_prefs.geometry[3]);
|
||||
if (ui_prefs.geometry[4] == 1)
|
||||
gtk_window_maximize(GTK_WINDOW(app->window));
|
||||
}
|
||||
|
||||
// hide statusbar if desired
|
||||
if (! app->statusbar_visible)
|
||||
if (! prefs.statusbar_visible)
|
||||
{
|
||||
gtk_widget_hide(app->statusbar);
|
||||
}
|
||||
@ -245,17 +246,17 @@ static void apply_settings(void)
|
||||
|
||||
// connect the toolbar dropdown menu for the new button
|
||||
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
||||
lookup_widget(app->window, "menutoolbutton1")), app->new_file_menu);
|
||||
lookup_widget(app->window, "menutoolbutton1")), ui_widgets.new_file_menu);
|
||||
|
||||
// set the tab placements of the notebooks
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), app->tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), app->tab_pos_sidebar);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), prefs.tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), prefs.tab_pos_msgwin);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), prefs.tab_pos_sidebar);
|
||||
|
||||
ui_update_toolbar_items();
|
||||
|
||||
// whether to show notebook tabs or not
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
|
||||
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
|
||||
}
|
||||
|
||||
|
||||
@ -264,71 +265,66 @@ static void main_init(void)
|
||||
// inits
|
||||
app->window = NULL;
|
||||
app->project = NULL;
|
||||
app->open_fontsel = NULL;
|
||||
app->open_colorsel = NULL;
|
||||
app->open_filesel = NULL;
|
||||
app->save_filesel = NULL;
|
||||
app->prefs_dialog = NULL;
|
||||
app->default_tag_tree = NULL;
|
||||
app->main_window_realized= FALSE;
|
||||
app->tab_order_ltr = FALSE;
|
||||
app->quitting = FALSE;
|
||||
ui_widgets.open_fontsel = NULL;
|
||||
ui_widgets.open_colorsel = NULL;
|
||||
ui_widgets.open_filesel = NULL;
|
||||
ui_widgets.save_filesel = NULL;
|
||||
ui_widgets.prefs_dialog = NULL;
|
||||
tv.default_tag_tree = NULL;
|
||||
main_status.main_window_realized= FALSE;
|
||||
prefs.tab_order_ltr = FALSE;
|
||||
main_status.quitting = FALSE;
|
||||
app->ignore_callback = FALSE;
|
||||
app->tm_workspace = tm_get_workspace();
|
||||
app->recent_queue = g_queue_new();
|
||||
app->opening_session_files = FALSE;
|
||||
ui_prefs.recent_queue = g_queue_new();
|
||||
main_status.opening_session_files = FALSE;
|
||||
|
||||
app->window = create_window1();
|
||||
app->new_file_menu = gtk_menu_new();
|
||||
app->recent_files_toolbar = gtk_menu_new();
|
||||
app->recent_files_menuitem = lookup_widget(app->window, "recent_files1");
|
||||
app->recent_files_menubar = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(app->recent_files_menuitem),
|
||||
app->recent_files_menubar);
|
||||
ui_widgets.new_file_menu = gtk_menu_new();
|
||||
ui_widgets.recent_files_toolbar = gtk_menu_new();
|
||||
ui_widgets.recent_files_menuitem = lookup_widget(app->window, "recent_files1");
|
||||
ui_widgets.recent_files_menubar = gtk_menu_new();
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem),
|
||||
ui_widgets.recent_files_menubar);
|
||||
|
||||
// store important pointers in the MyApp structure
|
||||
// store important pointers in the GeanyApp structure
|
||||
app->toolbar = lookup_widget(app->window, "toolbar1");
|
||||
app->tagbar = lookup_widget(app->window, "scrolledwindow2");
|
||||
app->treeview_notebook = lookup_widget(app->window, "notebook3");
|
||||
app->notebook = lookup_widget(app->window, "notebook1");
|
||||
app->statusbar = lookup_widget(app->window, "statusbar");
|
||||
app->popup_menu = create_edit_menu1();
|
||||
app->toolbar_menu = create_toolbar_popup_menu1();
|
||||
app->compile_button = lookup_widget(app->window, "toolbutton13");
|
||||
app->run_button = lookup_widget(app->window, "toolbutton26");
|
||||
app->popup_goto_items[0] = lookup_widget(app->popup_menu, "goto_tag_definition1");
|
||||
app->popup_goto_items[1] = lookup_widget(app->popup_menu, "goto_tag_declaration1");
|
||||
app->popup_goto_items[2] = lookup_widget(app->popup_menu, "find_usage1");
|
||||
app->popup_items[0] = lookup_widget(app->popup_menu, "cut1");
|
||||
app->popup_items[1] = lookup_widget(app->popup_menu, "copy1");
|
||||
app->popup_items[2] = lookup_widget(app->popup_menu, "delete1");
|
||||
app->popup_items[3] = lookup_widget(app->popup_menu, "to_lower_case1");
|
||||
app->popup_items[4] = lookup_widget(app->popup_menu, "to_upper_case1");
|
||||
app->menu_copy_items[0] = lookup_widget(app->window, "menu_cut1");
|
||||
app->menu_copy_items[1] = lookup_widget(app->window, "menu_copy1");
|
||||
app->menu_copy_items[2] = lookup_widget(app->window, "menu_delete1");
|
||||
app->menu_copy_items[3] = lookup_widget(app->window, "menu_to_lower_case2");
|
||||
app->menu_copy_items[4] = lookup_widget(app->window, "menu_to_upper_case2");
|
||||
app->menu_insert_include_item[0] = lookup_widget(app->popup_menu, "insert_include1");
|
||||
app->menu_insert_include_item[1] = lookup_widget(app->window, "insert_include2");
|
||||
app->save_buttons[0] = lookup_widget(app->window, "menu_save1");
|
||||
app->save_buttons[1] = lookup_widget(app->window, "toolbutton10");
|
||||
app->save_buttons[2] = lookup_widget(app->window, "menu_save_all1");
|
||||
app->save_buttons[3] = lookup_widget(app->window, "toolbutton22");
|
||||
app->navigation_buttons[0] = lookup_widget(app->window, "toolbutton_back");
|
||||
app->navigation_buttons[1] = lookup_widget(app->window, "toolbutton_forward");
|
||||
app->redo_items[0] = lookup_widget(app->popup_menu, "redo1");
|
||||
app->redo_items[1] = lookup_widget(app->window, "menu_redo2");
|
||||
app->redo_items[2] = lookup_widget(app->window, "toolbutton_redo");
|
||||
app->undo_items[0] = lookup_widget(app->popup_menu, "undo1");
|
||||
app->undo_items[1] = lookup_widget(app->window, "menu_undo2");
|
||||
app->undo_items[2] = lookup_widget(app->window, "toolbutton_undo");
|
||||
ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
|
||||
ui_widgets.popup_goto_items[0] = lookup_widget(app->popup_menu, "goto_tag_definition1");
|
||||
ui_widgets.popup_goto_items[1] = lookup_widget(app->popup_menu, "goto_tag_declaration1");
|
||||
ui_widgets.popup_goto_items[2] = lookup_widget(app->popup_menu, "find_usage1");
|
||||
ui_widgets.popup_items[0] = lookup_widget(app->popup_menu, "cut1");
|
||||
ui_widgets.popup_items[1] = lookup_widget(app->popup_menu, "copy1");
|
||||
ui_widgets.popup_items[2] = lookup_widget(app->popup_menu, "delete1");
|
||||
ui_widgets.popup_items[3] = lookup_widget(app->popup_menu, "to_lower_case1");
|
||||
ui_widgets.popup_items[4] = lookup_widget(app->popup_menu, "to_upper_case1");
|
||||
ui_widgets.menu_copy_items[0] = lookup_widget(app->window, "menu_cut1");
|
||||
ui_widgets.menu_copy_items[1] = lookup_widget(app->window, "menu_copy1");
|
||||
ui_widgets.menu_copy_items[2] = lookup_widget(app->window, "menu_delete1");
|
||||
ui_widgets.menu_copy_items[3] = lookup_widget(app->window, "menu_to_lower_case2");
|
||||
ui_widgets.menu_copy_items[4] = lookup_widget(app->window, "menu_to_upper_case2");
|
||||
ui_widgets.menu_insert_include_items[0] = lookup_widget(app->popup_menu, "insert_include1");
|
||||
ui_widgets.menu_insert_include_items[1] = lookup_widget(app->window, "insert_include2");
|
||||
ui_widgets.save_buttons[0] = lookup_widget(app->window, "menu_save1");
|
||||
ui_widgets.save_buttons[1] = lookup_widget(app->window, "toolbutton10");
|
||||
ui_widgets.save_buttons[2] = lookup_widget(app->window, "menu_save_all1");
|
||||
ui_widgets.save_buttons[3] = lookup_widget(app->window, "toolbutton22");
|
||||
ui_widgets.redo_items[0] = lookup_widget(app->popup_menu, "redo1");
|
||||
ui_widgets.redo_items[1] = lookup_widget(app->window, "menu_redo2");
|
||||
ui_widgets.redo_items[2] = lookup_widget(app->window, "toolbutton_redo");
|
||||
ui_widgets.undo_items[0] = lookup_widget(app->popup_menu, "undo1");
|
||||
ui_widgets.undo_items[1] = lookup_widget(app->window, "menu_undo2");
|
||||
ui_widgets.undo_items[2] = lookup_widget(app->window, "toolbutton_undo");
|
||||
|
||||
ui_init();
|
||||
|
||||
// set widget names for matching with .gtkrc-2.0
|
||||
gtk_widget_set_name(app->window, "GeanyMainWindow");
|
||||
gtk_widget_set_name(app->toolbar_menu, "GeanyToolbarMenu");
|
||||
gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
|
||||
gtk_widget_set_name(app->popup_menu, "GeanyEditMenu");
|
||||
}
|
||||
|
||||
@ -343,7 +339,7 @@ gchar *get_argv_filename(const gchar *filename)
|
||||
result = g_strdup(filename);
|
||||
else
|
||||
{
|
||||
//use current dir
|
||||
// use current dir
|
||||
gchar *cur_dir = g_get_current_dir();
|
||||
|
||||
result = g_strjoin(
|
||||
@ -492,7 +488,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
|
||||
#ifdef HAVE_VTE
|
||||
vte_info.lib_vte = lib_vte;
|
||||
#endif
|
||||
app->ignore_global_tags = ignore_global_tags;
|
||||
cl_options.ignore_global_tags = ignore_global_tags;
|
||||
}
|
||||
|
||||
|
||||
@ -599,9 +595,9 @@ static void load_settings()
|
||||
#ifdef HAVE_VTE
|
||||
vte_info.have_vte = (no_vte) ? FALSE : vte_info.load_vte;
|
||||
#endif
|
||||
if (no_msgwin) app->msgwindow_visible = FALSE;
|
||||
if (no_msgwin) ui_prefs.msgwindow_visible = FALSE;
|
||||
|
||||
want_plugins = main_prefs.load_plugins && !no_plugins;
|
||||
want_plugins = prefs.load_plugins && !no_plugins;
|
||||
}
|
||||
|
||||
|
||||
@ -610,7 +606,11 @@ gint main(gint argc, gchar **argv)
|
||||
gint idx;
|
||||
gint config_dir_result;
|
||||
|
||||
app = g_new0(MyApp, 1);
|
||||
app = g_new0(GeanyApp, 1);
|
||||
memset(&main_status, 0, sizeof(GeanyStatus));
|
||||
memset(&prefs, 0, sizeof(GeanyPrefs));
|
||||
memset(&ui_prefs, 0, sizeof(UIPrefs));
|
||||
memset(&ui_widgets, 0, sizeof(UIWidgets));
|
||||
|
||||
setup_paths();
|
||||
locale_init();
|
||||
@ -666,6 +666,7 @@ gint main(gint argc, gchar **argv)
|
||||
load_settings();
|
||||
|
||||
msgwin_init();
|
||||
build_init();
|
||||
search_init();
|
||||
ui_create_insert_menu_items();
|
||||
ui_create_insert_date_menu_items();
|
||||
@ -674,7 +675,9 @@ gint main(gint argc, gchar **argv)
|
||||
notebook_init();
|
||||
filetypes_init();
|
||||
templates_init();
|
||||
navqueue_init();
|
||||
document_init_doclist();
|
||||
treeviews_init();
|
||||
configuration_read_filetype_extensions();
|
||||
configuration_read_autocompletions();
|
||||
|
||||
@ -698,9 +701,6 @@ gint main(gint argc, gchar **argv)
|
||||
g_signal_connect(G_OBJECT(lookup_widget(app->window, "entry_goto_line")),
|
||||
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
|
||||
|
||||
treeviews_prepare_openfiles();
|
||||
treeviews_create_taglist_popup_menu();
|
||||
treeviews_create_openfiles_popup_menu();
|
||||
#ifdef HAVE_VTE
|
||||
vte_init();
|
||||
#endif
|
||||
@ -721,10 +721,10 @@ gint main(gint argc, gchar **argv)
|
||||
#endif
|
||||
|
||||
// load any command line files or session files
|
||||
app->opening_session_files = TRUE;
|
||||
main_status.opening_session_files = TRUE;
|
||||
if (! open_cl_files(argc, argv))
|
||||
{
|
||||
if (app->pref_main_load_session && cl_options.load_session)
|
||||
if (prefs.load_session && cl_options.load_session)
|
||||
{
|
||||
load_project_file();
|
||||
|
||||
@ -736,7 +736,7 @@ gint main(gint argc, gchar **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
app->opening_session_files = FALSE;
|
||||
main_status.opening_session_files = FALSE;
|
||||
|
||||
// open a new file if no other file was opened
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
@ -747,25 +747,13 @@ gint main(gint argc, gchar **argv)
|
||||
|
||||
idx = document_get_cur_idx();
|
||||
gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
|
||||
treeviews_select_openfiles_item(idx);
|
||||
build_menu_update(idx);
|
||||
treeviews_update_tag_list(idx, FALSE);
|
||||
navqueue_init();
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
// hide "Build" menu item, at least until it is available for Windows
|
||||
gtk_widget_hide(app->compile_button);
|
||||
{
|
||||
GtkWidget *compiler_tab;
|
||||
compiler_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(msgwindow.notebook),
|
||||
gtk_notebook_get_nth_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER));
|
||||
gtk_widget_set_sensitive(compiler_tab, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
// finally realize the window to show the user what we have done
|
||||
gtk_widget_show(app->window);
|
||||
app->main_window_realized = TRUE;
|
||||
main_status.main_window_realized = TRUE;
|
||||
|
||||
configuration_apply_settings();
|
||||
|
||||
@ -815,39 +803,39 @@ void main_quit()
|
||||
g_free(app->configdir);
|
||||
g_free(app->datadir);
|
||||
g_free(app->docdir);
|
||||
g_free(app->default_open_path);
|
||||
g_free(app->custom_date_format);
|
||||
g_free(app->editor_font);
|
||||
g_free(app->tagbar_font);
|
||||
g_free(app->msgwin_font);
|
||||
g_free(app->long_line_color);
|
||||
g_free(app->context_action_cmd);
|
||||
g_free(app->pref_template_developer);
|
||||
g_free(app->pref_template_company);
|
||||
g_free(app->pref_template_mail);
|
||||
g_free(app->pref_template_initial);
|
||||
g_free(app->pref_template_version);
|
||||
g_free(app->tools_make_cmd);
|
||||
g_free(app->tools_term_cmd);
|
||||
g_free(app->tools_browser_cmd);
|
||||
g_free(app->tools_print_cmd);
|
||||
g_free(app->tools_grep_cmd);
|
||||
g_strfreev(app->custom_commands);
|
||||
while (! g_queue_is_empty(app->recent_queue))
|
||||
g_free(prefs.default_open_path);
|
||||
g_free(ui_prefs.custom_date_format);
|
||||
g_free(prefs.editor_font);
|
||||
g_free(prefs.tagbar_font);
|
||||
g_free(prefs.msgwin_font);
|
||||
g_free(editor_prefs.long_line_color);
|
||||
g_free(prefs.context_action_cmd);
|
||||
g_free(prefs.template_developer);
|
||||
g_free(prefs.template_company);
|
||||
g_free(prefs.template_mail);
|
||||
g_free(prefs.template_initial);
|
||||
g_free(prefs.template_version);
|
||||
g_free(prefs.tools_make_cmd);
|
||||
g_free(prefs.tools_term_cmd);
|
||||
g_free(prefs.tools_browser_cmd);
|
||||
g_free(prefs.tools_print_cmd);
|
||||
g_free(prefs.tools_grep_cmd);
|
||||
g_strfreev(ui_prefs.custom_commands);
|
||||
while (! g_queue_is_empty(ui_prefs.recent_queue))
|
||||
{
|
||||
g_free(g_queue_pop_tail(app->recent_queue));
|
||||
g_free(g_queue_pop_tail(ui_prefs.recent_queue));
|
||||
}
|
||||
g_queue_free(app->recent_queue);
|
||||
g_queue_free(ui_prefs.recent_queue);
|
||||
|
||||
if (app->prefs_dialog && GTK_IS_WIDGET(app->prefs_dialog)) gtk_widget_destroy(app->prefs_dialog);
|
||||
if (app->save_filesel && GTK_IS_WIDGET(app->save_filesel)) gtk_widget_destroy(app->save_filesel);
|
||||
if (app->open_filesel && GTK_IS_WIDGET(app->open_filesel)) gtk_widget_destroy(app->open_filesel);
|
||||
if (app->open_fontsel && GTK_IS_WIDGET(app->open_fontsel)) gtk_widget_destroy(app->open_fontsel);
|
||||
if (app->open_colorsel && GTK_IS_WIDGET(app->open_colorsel)) gtk_widget_destroy(app->open_colorsel);
|
||||
if (app->default_tag_tree && GTK_IS_WIDGET(app->default_tag_tree))
|
||||
if (ui_widgets.prefs_dialog && GTK_IS_WIDGET(ui_widgets.prefs_dialog)) gtk_widget_destroy(ui_widgets.prefs_dialog);
|
||||
if (ui_widgets.save_filesel && GTK_IS_WIDGET(ui_widgets.save_filesel)) gtk_widget_destroy(ui_widgets.save_filesel);
|
||||
if (ui_widgets.open_filesel && GTK_IS_WIDGET(ui_widgets.open_filesel)) gtk_widget_destroy(ui_widgets.open_filesel);
|
||||
if (ui_widgets.open_fontsel && GTK_IS_WIDGET(ui_widgets.open_fontsel)) gtk_widget_destroy(ui_widgets.open_fontsel);
|
||||
if (ui_widgets.open_colorsel && GTK_IS_WIDGET(ui_widgets.open_colorsel)) gtk_widget_destroy(ui_widgets.open_colorsel);
|
||||
if (tv.default_tag_tree && GTK_IS_WIDGET(tv.default_tag_tree))
|
||||
{
|
||||
g_object_unref(app->default_tag_tree);
|
||||
gtk_widget_destroy(app->default_tag_tree);
|
||||
g_object_unref(tv.default_tag_tree);
|
||||
gtk_widget_destroy(tv.default_tag_tree);
|
||||
}
|
||||
#ifdef HAVE_VTE
|
||||
if (vte_info.have_vte) vte_close();
|
||||
@ -859,8 +847,8 @@ void main_quit()
|
||||
// destroy popup menus
|
||||
if (app->popup_menu && GTK_IS_WIDGET(app->popup_menu))
|
||||
gtk_widget_destroy(app->popup_menu);
|
||||
if (app->toolbar_menu && GTK_IS_WIDGET(app->toolbar_menu))
|
||||
gtk_widget_destroy(app->toolbar_menu);
|
||||
if (ui_widgets.toolbar_menu && GTK_IS_WIDGET(ui_widgets.toolbar_menu))
|
||||
gtk_widget_destroy(ui_widgets.toolbar_menu);
|
||||
if (tv.popup_taglist && GTK_IS_WIDGET(tv.popup_taglist))
|
||||
gtk_widget_destroy(tv.popup_taglist);
|
||||
if (tv.popup_openfiles && GTK_IS_WIDGET(tv.popup_openfiles))
|
||||
|
18
src/main.h
18
src/main.h
@ -27,20 +27,24 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gboolean load_session;
|
||||
gint goto_line;
|
||||
gint goto_column;
|
||||
gboolean load_session;
|
||||
gint goto_line;
|
||||
gint goto_column;
|
||||
gboolean ignore_global_tags;
|
||||
} CommandLineOptions;
|
||||
|
||||
extern CommandLineOptions cl_options;
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct GeanyStatus
|
||||
{
|
||||
gboolean load_plugins;
|
||||
} MainPrefs;
|
||||
gboolean opening_session_files; // state at startup while opening session files
|
||||
gboolean quitting; // state when Geany is quitting completely
|
||||
gboolean main_window_realized;
|
||||
}
|
||||
GeanyStatus;
|
||||
|
||||
extern MainPrefs main_prefs;
|
||||
extern GeanyStatus main_status;
|
||||
|
||||
|
||||
gchar *get_argv_filename(const gchar *filename);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "geany.h"
|
||||
|
||||
#include "support.h"
|
||||
#include "prefs.h"
|
||||
#include "callbacks.h"
|
||||
#include "msgwindow.h"
|
||||
#include "ui_utils.h"
|
||||
@ -38,6 +39,7 @@
|
||||
#include "document.h"
|
||||
#include "filetypes.h"
|
||||
#include "build.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -115,7 +117,7 @@ static void prepare_status_tree_view(void)
|
||||
|
||||
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(msgwindow.tree_status), FALSE);
|
||||
|
||||
pfd = pango_font_description_from_string(app->msgwin_font);
|
||||
pfd = pango_font_description_from_string(prefs.msgwin_font);
|
||||
gtk_widget_modify_font(msgwindow.tree_status, pfd);
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
@ -142,7 +144,7 @@ static void prepare_msg_tree_view(void)
|
||||
|
||||
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(msgwindow.tree_msg), FALSE);
|
||||
|
||||
pfd = pango_font_description_from_string(app->msgwin_font);
|
||||
pfd = pango_font_description_from_string(prefs.msgwin_font);
|
||||
gtk_widget_modify_font(msgwindow.tree_msg, pfd);
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
@ -174,7 +176,7 @@ static void prepare_compiler_tree_view(void)
|
||||
|
||||
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(msgwindow.tree_compiler), FALSE);
|
||||
|
||||
pfd = pango_font_description_from_string(app->msgwin_font);
|
||||
pfd = pango_font_description_from_string(prefs.msgwin_font);
|
||||
gtk_widget_modify_font(msgwindow.tree_compiler, pfd);
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
@ -224,7 +226,7 @@ void msgwin_compiler_add(gint msg_color, const gchar *msg)
|
||||
gtk_list_store_append(msgwindow.store_compiler, &iter);
|
||||
gtk_list_store_set(msgwindow.store_compiler, &iter, 0, color, 1, msg, -1);
|
||||
|
||||
if (app->msgwindow_visible)
|
||||
if (ui_prefs.msgwindow_visible)
|
||||
{
|
||||
path = gtk_tree_model_get_path(
|
||||
gtk_tree_view_get_model(GTK_TREE_VIEW(msgwindow.tree_compiler)), &iter);
|
||||
@ -239,7 +241,7 @@ void msgwin_compiler_add(gint msg_color, const gchar *msg)
|
||||
|
||||
void msgwin_show_hide(gboolean show)
|
||||
{
|
||||
app->msgwindow_visible = show;
|
||||
ui_prefs.msgwindow_visible = show;
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(
|
||||
GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")),
|
||||
@ -268,7 +270,7 @@ void msgwin_msg_add(gint line, gint idx, const gchar *string)
|
||||
GtkTreeIter iter;
|
||||
static gint state = 0;
|
||||
|
||||
if (! app->msgwindow_visible) msgwin_show_hide(TRUE);
|
||||
if (! ui_prefs.msgwindow_visible) msgwin_show_hide(TRUE);
|
||||
|
||||
gtk_list_store_append(msgwindow.store_msg, &iter);
|
||||
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2,
|
||||
@ -292,7 +294,7 @@ void msgwin_status_add(const gchar *format, ...)
|
||||
va_end(args);
|
||||
|
||||
// display status message in status bar
|
||||
if (! app->pref_main_suppress_status_messages)
|
||||
if (! prefs.suppress_status_messages)
|
||||
ui_set_statusbar("%s", string);
|
||||
|
||||
// add a timestamp to status messages
|
||||
@ -309,12 +311,12 @@ void msgwin_status_add(const gchar *format, ...)
|
||||
((state++ % 2) == 0) ? &white : &dark, 1, statusmsg, -1);
|
||||
g_free(statusmsg);
|
||||
|
||||
if (app->main_window_realized)
|
||||
if (main_status.main_window_realized)
|
||||
{
|
||||
GtkTreePath *path = gtk_tree_model_get_path(gtk_tree_view_get_model(GTK_TREE_VIEW(msgwindow.tree_status)), &iter);
|
||||
|
||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(msgwindow.tree_status), path, NULL, FALSE, 0.0, 0.0);
|
||||
if (app->switch_msgwin_pages) gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_STATUS);
|
||||
if (prefs.switch_msgwin_pages) gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_STATUS);
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "sciwrappers.h"
|
||||
#include "document.h"
|
||||
#include "utils.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
// for the navigation history queue
|
||||
@ -41,14 +42,20 @@ typedef struct
|
||||
gint line; // line is counted with 1 as the first line, not 0
|
||||
} filepos;
|
||||
|
||||
GQueue *navigation_queue;
|
||||
guint nav_queue_pos;
|
||||
static GQueue *navigation_queue;
|
||||
static guint nav_queue_pos;
|
||||
|
||||
static GtkWidget *navigation_buttons[2];
|
||||
|
||||
|
||||
|
||||
void navqueue_init()
|
||||
{
|
||||
navigation_queue = g_queue_new();
|
||||
nav_queue_pos = 0;
|
||||
|
||||
navigation_buttons[0] = lookup_widget(app->window, "toolbutton_back");
|
||||
navigation_buttons[1] = lookup_widget(app->window, "toolbutton_forward");
|
||||
}
|
||||
|
||||
|
||||
@ -66,23 +73,23 @@ static void adjust_buttons()
|
||||
{
|
||||
if (g_queue_get_length(navigation_queue) < 2)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[0], FALSE);
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[1], FALSE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[0], FALSE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[1], FALSE);
|
||||
return;
|
||||
}
|
||||
if (nav_queue_pos == 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[0], TRUE);
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[1], FALSE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[0], TRUE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[1], FALSE);
|
||||
return;
|
||||
}
|
||||
// forward should be sensitive since where not at the start
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[1], TRUE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[1], TRUE);
|
||||
|
||||
// back should be sensitive if there's a place to go back to
|
||||
(nav_queue_pos < g_queue_get_length(navigation_queue) - 1) ?
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[0], TRUE) :
|
||||
gtk_widget_set_sensitive(app->navigation_buttons[0], FALSE);
|
||||
gtk_widget_set_sensitive(navigation_buttons[0], TRUE) :
|
||||
gtk_widget_set_sensitive(navigation_buttons[0], FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "geany.h"
|
||||
#include "notebook.h"
|
||||
#include "prefs.h"
|
||||
#include "document.h"
|
||||
#include "ui_utils.h"
|
||||
#include "treeviews.h"
|
||||
@ -335,7 +336,7 @@ gint notebook_new_tab(gint doc_idx)
|
||||
this->tabmenu_label = gtk_label_new(title);
|
||||
gtk_misc_set_alignment(GTK_MISC(this->tabmenu_label), 0.0, 0);
|
||||
|
||||
if (app->tab_order_ltr)
|
||||
if (prefs.tab_order_ltr)
|
||||
tabnum = gtk_notebook_append_page_menu(GTK_NOTEBOOK(app->notebook), page,
|
||||
hbox, this->tabmenu_label);
|
||||
else
|
||||
|
@ -68,12 +68,12 @@
|
||||
|
||||
/* The API version should be incremented whenever any plugin data types below are
|
||||
* modified. */
|
||||
static const gint api_version = 12;
|
||||
static const gint api_version = 13;
|
||||
|
||||
/* The ABI version should be incremented whenever existing fields in the plugin
|
||||
* data types below have to be changed or reordered. It should stay the same if fields
|
||||
* are only appended, as this doesn't affect existing fields. */
|
||||
static const gint abi_version = 3;
|
||||
static const gint abi_version = 4;
|
||||
|
||||
/* This performs runtime checks that try to ensure:
|
||||
* 1. Geany ABI data types are compatible with this plugin.
|
||||
@ -132,10 +132,11 @@ PluginFields;
|
||||
* making changes. */
|
||||
typedef struct GeanyData
|
||||
{
|
||||
MyApp *app; // Geany application data fields
|
||||
GeanyApp *app; // Geany application data fields
|
||||
GtkWidget *tools_menu; // Almost all plugins should add menu items to the Tools menu only
|
||||
GArray *doc_array; // array of document pointers
|
||||
struct filetype **filetypes;
|
||||
struct GeanyPrefs *prefs;
|
||||
struct EditorPrefs *editor_prefs;
|
||||
|
||||
struct DocumentFuncs *document;
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "editor.h"
|
||||
#include "dialogs.h"
|
||||
#include "msgwindow.h"
|
||||
#include "prefs.h"
|
||||
#include "geanyobject.h"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@ -156,6 +157,7 @@ static GeanyData geany_data = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
&doc_funcs,
|
||||
&sci_funcs,
|
||||
@ -175,6 +177,7 @@ geany_data_init()
|
||||
geany_data.tools_menu = lookup_widget(app->window, "tools1_menu");
|
||||
geany_data.doc_array = doc_array;
|
||||
geany_data.filetypes = filetypes;
|
||||
geany_data.prefs = &prefs;
|
||||
geany_data.editor_prefs = &editor_prefs;
|
||||
}
|
||||
|
||||
|
710
src/prefs.c
710
src/prefs.c
File diff suppressed because it is too large
Load Diff
71
src/prefs.h
71
src/prefs.h
@ -24,16 +24,81 @@
|
||||
#ifndef GEANY_PREFS_H
|
||||
#define GEANY_PREFS_H 1
|
||||
|
||||
/* Preferences dialog settings.
|
||||
* (See also EditorPrefs in editor.h).
|
||||
* Remember to increment abi_version in plugindata.h when changing items. */
|
||||
typedef struct GeanyPrefs
|
||||
{
|
||||
/* general */
|
||||
gboolean load_session;
|
||||
gboolean load_plugins;
|
||||
gboolean save_winpos;
|
||||
gboolean confirm_exit;
|
||||
gboolean beep_on_errors;
|
||||
gboolean suppress_search_dialogs;
|
||||
gboolean suppress_status_messages;
|
||||
gboolean switch_msgwin_pages;
|
||||
gboolean auto_focus;
|
||||
gchar *default_open_path;
|
||||
|
||||
/* interface */
|
||||
gboolean sidebar_symbol_visible;
|
||||
gboolean sidebar_openfiles_visible;
|
||||
gchar *editor_font;
|
||||
gchar *tagbar_font;
|
||||
gchar *msgwin_font;
|
||||
gboolean show_notebook_tabs;
|
||||
gint tab_pos_editor;
|
||||
gint tab_pos_msgwin;
|
||||
gint tab_pos_sidebar;
|
||||
gboolean statusbar_visible;
|
||||
|
||||
/* toolbar */
|
||||
gboolean toolbar_visible;
|
||||
gboolean toolbar_show_search;
|
||||
gboolean toolbar_show_goto;
|
||||
gboolean toolbar_show_undo;
|
||||
gboolean toolbar_show_navigation;
|
||||
gboolean toolbar_show_compile;
|
||||
gboolean toolbar_show_zoom;
|
||||
gboolean toolbar_show_colour;
|
||||
gboolean toolbar_show_fileops;
|
||||
gboolean toolbar_show_quit;
|
||||
GtkIconSize toolbar_icon_size;
|
||||
gint toolbar_icon_style;
|
||||
|
||||
/* files */
|
||||
gboolean tab_order_ltr;
|
||||
guint mru_length;
|
||||
|
||||
/* tools */
|
||||
gchar *tools_browser_cmd;
|
||||
gchar *tools_make_cmd;
|
||||
gchar *tools_term_cmd;
|
||||
gchar *tools_print_cmd;
|
||||
gchar *tools_grep_cmd;
|
||||
gchar *context_action_cmd;
|
||||
|
||||
/* templates */
|
||||
gchar *template_developer;
|
||||
gchar *template_company;
|
||||
gchar *template_mail;
|
||||
gchar *template_initial;
|
||||
gchar *template_version;
|
||||
}
|
||||
GeanyPrefs;
|
||||
|
||||
extern GeanyPrefs prefs;
|
||||
|
||||
|
||||
void prefs_init_dialog(void);
|
||||
|
||||
void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data);
|
||||
void prefs_show_dialog(void);
|
||||
|
||||
void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data);
|
||||
|
||||
void on_prefs_color_choosed(GtkColorButton *widget, gpointer user_data);
|
||||
|
||||
void prefs_show_dialog(void);
|
||||
|
||||
void on_prefs_tools_button_clicked(GtkButton *button, gpointer user_data);
|
||||
|
||||
#endif
|
||||
|
@ -894,8 +894,8 @@ void project_load_prefs(GKeyFile *config)
|
||||
/* Initialize project-related preferences in the Preferences dialog. */
|
||||
void project_setup_prefs()
|
||||
{
|
||||
GtkWidget *path_entry = lookup_widget(app->prefs_dialog, "project_file_path_entry");
|
||||
GtkWidget *path_btn = lookup_widget(app->prefs_dialog, "project_file_path_button");
|
||||
GtkWidget *path_entry = lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
|
||||
GtkWidget *path_btn = lookup_widget(ui_widgets.prefs_dialog, "project_file_path_button");
|
||||
|
||||
g_return_if_fail(local_prefs.project_file_path != NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(path_entry), local_prefs.project_file_path);
|
||||
@ -907,7 +907,7 @@ void project_setup_prefs()
|
||||
/* Update project-related preferences after using the Preferences dialog. */
|
||||
void project_apply_prefs()
|
||||
{
|
||||
GtkWidget *path_entry = lookup_widget(app->prefs_dialog, "project_file_path_entry");
|
||||
GtkWidget *path_entry = lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
|
||||
const gchar *str;
|
||||
|
||||
str = gtk_entry_get_text(GTK_ENTRY(path_entry));
|
||||
|
13
src/search.c
13
src/search.c
@ -30,6 +30,7 @@
|
||||
|
||||
#include "geany.h"
|
||||
#include "search.h"
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "utils.h"
|
||||
#include "msgwindow.h"
|
||||
@ -854,7 +855,7 @@ on_find_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
document_find_text(idx, search_data.text, search_data.flags,
|
||||
(response == GEANY_RESPONSE_FIND_PREVIOUS), TRUE, GTK_WIDGET(widgets.find_dialog));
|
||||
check_close = FALSE;
|
||||
if (app->pref_main_suppress_search_dialogs)
|
||||
if (prefs.suppress_search_dialogs)
|
||||
check_close = TRUE;
|
||||
break;
|
||||
|
||||
@ -1131,10 +1132,10 @@ search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *op
|
||||
|
||||
if (! search_text || ! *search_text || ! dir) return TRUE;
|
||||
|
||||
if (! g_file_test(app->tools_grep_cmd, G_FILE_TEST_IS_EXECUTABLE))
|
||||
if (! g_file_test(prefs.tools_grep_cmd, G_FILE_TEST_IS_EXECUTABLE))
|
||||
{
|
||||
msgwin_status_add(_("Cannot execute grep tool '%s';"
|
||||
" check the path setting in Preferences."), app->tools_grep_cmd);
|
||||
" check the path setting in Preferences."), prefs.tools_grep_cmd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1144,14 +1145,14 @@ search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *op
|
||||
// set grep command and options
|
||||
argv_prefix = g_new0(gchar*, 1 + opts_argv_len + 3 + 1); // last +1 for recursive arg
|
||||
|
||||
argv_prefix[0] = g_strdup(app->tools_grep_cmd);
|
||||
argv_prefix[0] = g_strdup(prefs.tools_grep_cmd);
|
||||
for (i = 0; i < opts_argv_len; i++)
|
||||
{
|
||||
argv_prefix[i + 1] = g_strdup(opts_argv[i]);
|
||||
}
|
||||
g_strfreev(opts_argv);
|
||||
|
||||
i++; // correct for app->tools_grep_cmd
|
||||
i++; // correct for prefs.tools_grep_cmd
|
||||
argv_prefix[i++] = g_strdup("--");
|
||||
argv_prefix[i++] = g_strdup(search_text);
|
||||
|
||||
@ -1199,7 +1200,7 @@ search_find_in_files(const gchar *search_text, const gchar *dir, const gchar *op
|
||||
g_child_watch_add(child_pid, search_close_pid, NULL);
|
||||
|
||||
str = g_strdup_printf(_("%s %s -- %s (in directory: %s)"),
|
||||
app->tools_grep_cmd, opts, search_text, dir);
|
||||
prefs.tools_grep_cmd, opts, search_text, dir);
|
||||
utf8_str = utils_get_utf8_from_locale(str);
|
||||
msgwin_msg_add(-1, -1, utf8_str);
|
||||
utils_free_pointers(str, utf8_str, NULL);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "support.h"
|
||||
#include "msgwindow.h"
|
||||
#include "treeviews.h"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
#define MAX_SYMBOL_TYPES 8 // amount of types in the symbol list (currently max. 8 are used)
|
||||
@ -91,7 +92,7 @@ void symbols_global_tags_loaded(gint file_type_idx)
|
||||
TagFileInfo *tfi;
|
||||
gint tag_type;
|
||||
|
||||
if (app->ignore_global_tags) return;
|
||||
if (cl_options.ignore_global_tags) return;
|
||||
|
||||
load_user_tags(file_type_idx);
|
||||
|
||||
@ -134,7 +135,7 @@ static void html_tags_loaded()
|
||||
{
|
||||
TagFileInfo *tfi;
|
||||
|
||||
if (app->ignore_global_tags) return;
|
||||
if (cl_options.ignore_global_tags) return;
|
||||
|
||||
tfi = &tag_file_info[GTF_HTML_ENTITIES];
|
||||
if (! tfi->tags_loaded)
|
||||
|
@ -32,10 +32,12 @@
|
||||
#include "geany.h"
|
||||
|
||||
#include "templates.h"
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "utils.h"
|
||||
#include "document.h"
|
||||
#include "filetypes.h"
|
||||
#include "ui_utils.h"
|
||||
|
||||
|
||||
// default templates, only for initial tempate file creation on first start of Geany
|
||||
@ -330,7 +332,7 @@ static void create_new_menu_items()
|
||||
gtk_widget_show(tmp_menu);
|
||||
gtk_widget_show(tmp_button);
|
||||
gtk_container_add(GTK_CONTAINER(template_menu), tmp_menu);
|
||||
gtk_container_add(GTK_CONTAINER(app->new_file_menu), tmp_button);
|
||||
gtk_container_add(GTK_CONTAINER(ui_widgets.new_file_menu), tmp_button);
|
||||
g_signal_connect((gpointer) tmp_menu, "activate",
|
||||
G_CALLBACK(on_new_with_template), (gpointer) ft);
|
||||
g_signal_connect((gpointer) tmp_button, "activate",
|
||||
@ -624,11 +626,11 @@ static gchar *templates_replace_all(gchar *text, const gchar *year, const gchar
|
||||
{
|
||||
text = utils_str_replace(text, "{year}", year);
|
||||
text = utils_str_replace(text, "{date}", date);
|
||||
text = utils_str_replace(text, "{version}", app->pref_template_version);
|
||||
text = utils_str_replace(text, "{initial}", app->pref_template_initial);
|
||||
text = utils_str_replace(text, "{developer}", app->pref_template_developer);
|
||||
text = utils_str_replace(text, "{mail}", app->pref_template_mail);
|
||||
text = utils_str_replace(text, "{company}", app->pref_template_company);
|
||||
text = utils_str_replace(text, "{version}", prefs.template_version);
|
||||
text = utils_str_replace(text, "{initial}", prefs.template_initial);
|
||||
text = utils_str_replace(text, "{developer}", prefs.template_developer);
|
||||
text = utils_str_replace(text, "{mail}", prefs.template_mail);
|
||||
text = utils_str_replace(text, "{company}", prefs.template_company);
|
||||
text = utils_str_replace(text, "{untitled}", GEANY_STRING_UNTITLED);
|
||||
text = utils_str_replace(text, "{geanyversion}", "Geany " VERSION);
|
||||
|
||||
|
56
src/tools.c
56
src/tools.c
@ -70,7 +70,7 @@ static void cc_add_command(struct cc_dialog *cc, gint idx)
|
||||
|
||||
entry = gtk_entry_new();
|
||||
if (idx >= 0)
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), app->custom_commands[idx]);
|
||||
gtk_entry_set_text(GTK_ENTRY(entry), ui_prefs.custom_commands[idx]);
|
||||
gtk_entry_set_max_length(GTK_ENTRY(entry), 255);
|
||||
gtk_entry_set_width_chars(GTK_ENTRY(entry), 30);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
||||
@ -231,15 +231,15 @@ static void cc_show_dialog_custom_commands()
|
||||
cc.box = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), cc.box);
|
||||
|
||||
if (app->custom_commands == NULL || g_strv_length(app->custom_commands) == 0)
|
||||
if (ui_prefs.custom_commands == NULL || g_strv_length(ui_prefs.custom_commands) == 0)
|
||||
{
|
||||
cc_add_command(&cc, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < g_strv_length(app->custom_commands); i++)
|
||||
for (i = 0; i < g_strv_length(ui_prefs.custom_commands); i++)
|
||||
{
|
||||
if (app->custom_commands[i][0] == '\0')
|
||||
if (ui_prefs.custom_commands[i][0] == '\0')
|
||||
continue; // skip empty fields
|
||||
|
||||
cc_add_command(&cc, i);
|
||||
@ -296,8 +296,8 @@ static void cc_show_dialog_custom_commands()
|
||||
result[len] = NULL; // null-terminate the array
|
||||
}
|
||||
// set the new array
|
||||
g_strfreev(app->custom_commands);
|
||||
app->custom_commands = result;
|
||||
g_strfreev(ui_prefs.custom_commands);
|
||||
ui_prefs.custom_commands = result;
|
||||
// rebuild the menu items
|
||||
tools_create_insert_custom_command_menu_items();
|
||||
|
||||
@ -318,7 +318,7 @@ static void cc_on_custom_command_menu_activate(GtkMenuItem *menuitem, gpointer u
|
||||
|
||||
if (! DOC_IDX_VALID(idx)) return;
|
||||
|
||||
enable = sci_can_copy(doc_list[idx].sci) && (app->custom_commands != NULL);
|
||||
enable = sci_can_copy(doc_list[idx].sci) && (ui_prefs.custom_commands != NULL);
|
||||
|
||||
children = gtk_container_get_children(GTK_CONTAINER(user_data));
|
||||
len = g_list_length(children);
|
||||
@ -344,8 +344,8 @@ static void cc_on_custom_command_activate(GtkMenuItem *menuitem, gpointer user_d
|
||||
|
||||
command_idx = GPOINTER_TO_INT(user_data);
|
||||
|
||||
if (app->custom_commands == NULL ||
|
||||
command_idx < 0 || command_idx > (gint) g_strv_length(app->custom_commands))
|
||||
if (ui_prefs.custom_commands == NULL ||
|
||||
command_idx < 0 || command_idx > (gint) g_strv_length(ui_prefs.custom_commands))
|
||||
{
|
||||
cc_show_dialog_custom_commands();
|
||||
return;
|
||||
@ -353,7 +353,7 @@ static void cc_on_custom_command_activate(GtkMenuItem *menuitem, gpointer user_d
|
||||
|
||||
// send it through the command and when the command returned the output the current selection
|
||||
// will be replaced
|
||||
tools_execute_custom_command(idx, app->custom_commands[command_idx]);
|
||||
tools_execute_custom_command(idx, ui_prefs.custom_commands[command_idx]);
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ void tools_create_insert_custom_command_menu_items()
|
||||
}
|
||||
|
||||
|
||||
if (app->custom_commands == NULL || g_strv_length(app->custom_commands) == 0)
|
||||
if (ui_prefs.custom_commands == NULL || g_strv_length(ui_prefs.custom_commands) == 0)
|
||||
{
|
||||
item = gtk_menu_item_new_with_label(_("No custom commands defined."));
|
||||
gtk_container_add(GTK_CONTAINER(menu_edit), item);
|
||||
@ -426,11 +426,11 @@ void tools_create_insert_custom_command_menu_items()
|
||||
{
|
||||
guint i;
|
||||
gint idx = 0;
|
||||
for (i = 0; i < g_strv_length(app->custom_commands); i++)
|
||||
for (i = 0; i < g_strv_length(ui_prefs.custom_commands); i++)
|
||||
{
|
||||
if (app->custom_commands[i][0] != '\0') // skip empty fields
|
||||
if (ui_prefs.custom_commands[i][0] != '\0') // skip empty fields
|
||||
{
|
||||
cc_insert_custom_command_items(menu_edit, menu_popup, app->custom_commands[i], idx);
|
||||
cc_insert_custom_command_items(menu_edit, menu_popup, ui_prefs.custom_commands[i], idx);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
@ -615,7 +615,7 @@ static void
|
||||
on_color_cancel_button_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_widget_hide(app->open_colorsel);
|
||||
gtk_widget_hide(ui_widgets.open_colorsel);
|
||||
}
|
||||
|
||||
|
||||
@ -627,11 +627,11 @@ on_color_ok_button_clicked (GtkButton *button,
|
||||
gint idx = document_get_cur_idx();
|
||||
gchar *hex;
|
||||
|
||||
gtk_widget_hide(app->open_colorsel);
|
||||
gtk_widget_hide(ui_widgets.open_colorsel);
|
||||
if (idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
|
||||
gtk_color_selection_get_current_color(
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->colorsel), &color);
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->colorsel), &color);
|
||||
|
||||
hex = utils_get_hex_from_color(&color);
|
||||
document_insert_colour(idx, hex);
|
||||
@ -647,19 +647,19 @@ void tools_color_chooser(gchar *color)
|
||||
win32_show_color_dialog(color);
|
||||
#else
|
||||
|
||||
if (app->open_colorsel == NULL)
|
||||
if (ui_widgets.open_colorsel == NULL)
|
||||
{
|
||||
app->open_colorsel = gtk_color_selection_dialog_new(_("Color Chooser"));
|
||||
gtk_widget_set_name(app->open_colorsel, "GeanyDialog");
|
||||
gtk_window_set_transient_for(GTK_WINDOW(app->open_colorsel), GTK_WINDOW(app->window));
|
||||
ui_widgets.open_colorsel = gtk_color_selection_dialog_new(_("Color Chooser"));
|
||||
gtk_widget_set_name(ui_widgets.open_colorsel, "GeanyDialog");
|
||||
gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_colorsel), GTK_WINDOW(app->window));
|
||||
gtk_color_selection_set_has_palette(
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->colorsel), TRUE);
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->colorsel), TRUE);
|
||||
|
||||
g_signal_connect(GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->cancel_button, "clicked",
|
||||
g_signal_connect(GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->cancel_button, "clicked",
|
||||
G_CALLBACK(on_color_cancel_button_clicked), NULL);
|
||||
g_signal_connect(GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->ok_button, "clicked",
|
||||
g_signal_connect(GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->ok_button, "clicked",
|
||||
G_CALLBACK(on_color_ok_button_clicked), NULL);
|
||||
g_signal_connect(app->open_colorsel, "delete_event",
|
||||
g_signal_connect(ui_widgets.open_colorsel, "delete_event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
||||
}
|
||||
// if color is non-NULL set it in the dialog as preselected color
|
||||
@ -674,13 +674,13 @@ void tools_color_chooser(gchar *color)
|
||||
}
|
||||
gdk_color_parse(color, &gc);
|
||||
gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(
|
||||
GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->colorsel), &gc);
|
||||
GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->colorsel), &gc);
|
||||
gtk_color_selection_set_previous_color(GTK_COLOR_SELECTION(
|
||||
GTK_COLOR_SELECTION_DIALOG(app->open_colorsel)->colorsel), &gc);
|
||||
GTK_COLOR_SELECTION_DIALOG(ui_widgets.open_colorsel)->colorsel), &gc);
|
||||
}
|
||||
|
||||
// We make sure the dialog is visible.
|
||||
gtk_window_present(GTK_WINDOW(app->open_colorsel));
|
||||
gtk_window_present(GTK_WINDOW(ui_widgets.open_colorsel));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* treeviews.c
|
||||
* treeviews.c - this file is part of Geany, a fast and lightweight IDE
|
||||
*
|
||||
* Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
@ -28,6 +28,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "geany.h"
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "treeviews.h"
|
||||
@ -39,6 +40,8 @@
|
||||
#include "navqueue.h"
|
||||
|
||||
|
||||
SidebarTreeviews tv;
|
||||
|
||||
enum
|
||||
{
|
||||
TREEVIEW_SYMBOL = 0,
|
||||
@ -59,6 +62,10 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static GtkListStore *store_openfiles;
|
||||
static GtkWidget *tag_window; // scrolled window that holds the symbol list GtkTreeView
|
||||
|
||||
|
||||
/* callback prototypes */
|
||||
static void on_taglist_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data);
|
||||
static void on_openfiles_tree_selection_changed(GtkTreeSelection *selection, gpointer data);
|
||||
@ -68,7 +75,6 @@ static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButto
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
|
||||
/* the prepare_* functions are document-related, but I think they fit better here than in document.c */
|
||||
static void prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
|
||||
{
|
||||
@ -93,7 +99,7 @@ static void prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
|
||||
|
||||
pfd = pango_font_description_from_string(app->tagbar_font);
|
||||
pfd = pango_font_description_from_string(prefs.tagbar_font);
|
||||
gtk_widget_modify_font(tree, pfd);
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
@ -125,32 +131,32 @@ on_default_tag_tree_button_press_event(GtkWidget *widget, GdkEventButton *event,
|
||||
// update = rescan the tags for document[idx].filename
|
||||
void treeviews_update_tag_list(gint idx, gboolean update)
|
||||
{
|
||||
if (gtk_bin_get_child(GTK_BIN(app->tagbar)))
|
||||
gtk_container_remove(GTK_CONTAINER(app->tagbar), gtk_bin_get_child(GTK_BIN(app->tagbar)));
|
||||
if (gtk_bin_get_child(GTK_BIN(tag_window)))
|
||||
gtk_container_remove(GTK_CONTAINER(tag_window), gtk_bin_get_child(GTK_BIN(tag_window)));
|
||||
|
||||
if (app->default_tag_tree == NULL)
|
||||
if (tv.default_tag_tree == NULL)
|
||||
{
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW(app->tagbar);
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW(tag_window);
|
||||
GtkWidget *label;
|
||||
|
||||
// default_tag_tree is a GtkViewPort with a GtkLabel inside it
|
||||
app->default_tag_tree = gtk_viewport_new(
|
||||
tv.default_tag_tree = gtk_viewport_new(
|
||||
gtk_scrolled_window_get_hadjustment(scrolled_window),
|
||||
gtk_scrolled_window_get_vadjustment(scrolled_window));
|
||||
label = gtk_label_new(_("No tags found"));
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0.1, 0.01);
|
||||
gtk_container_add(GTK_CONTAINER(app->default_tag_tree), label);
|
||||
gtk_widget_show_all(app->default_tag_tree);
|
||||
g_signal_connect(G_OBJECT(app->default_tag_tree), "button-press-event",
|
||||
gtk_container_add(GTK_CONTAINER(tv.default_tag_tree), label);
|
||||
gtk_widget_show_all(tv.default_tag_tree);
|
||||
g_signal_connect(G_OBJECT(tv.default_tag_tree), "button-press-event",
|
||||
G_CALLBACK(on_default_tag_tree_button_press_event), NULL);
|
||||
g_object_ref((gpointer)app->default_tag_tree); // to hold it after removing
|
||||
g_object_ref((gpointer)tv.default_tag_tree); // to hold it after removing
|
||||
}
|
||||
|
||||
// show default empty tag tree if there are no tags
|
||||
if (idx == -1 || doc_list[idx].file_type == NULL ||
|
||||
! filetype_has_tags(doc_list[idx].file_type))
|
||||
{
|
||||
gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree);
|
||||
gtk_container_add(GTK_CONTAINER(tag_window), tv.default_tag_tree);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,17 +177,17 @@ void treeviews_update_tag_list(gint idx, gboolean update)
|
||||
|
||||
if (doc_list[idx].has_tags)
|
||||
{
|
||||
gtk_container_add(GTK_CONTAINER(app->tagbar), doc_list[idx].tag_tree);
|
||||
gtk_container_add(GTK_CONTAINER(tag_window), doc_list[idx].tag_tree);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree);
|
||||
gtk_container_add(GTK_CONTAINER(tag_window), tv.default_tag_tree);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* does some preparing things to the open files list widget */
|
||||
void treeviews_prepare_openfiles()
|
||||
static void prepare_openfiles()
|
||||
{
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
@ -192,8 +198,8 @@ void treeviews_prepare_openfiles()
|
||||
tv.tree_openfiles = lookup_widget(app->window, "treeview6");
|
||||
|
||||
// store the short filename to show, and the index as reference
|
||||
tv.store_openfiles = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(tv.tree_openfiles), GTK_TREE_MODEL(tv.store_openfiles));
|
||||
store_openfiles = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_COLOR);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(tv.tree_openfiles), GTK_TREE_MODEL(store_openfiles));
|
||||
|
||||
// set policy settings for the scolledwindow around the treeview again, because glade
|
||||
// doesn't keep the settings
|
||||
@ -210,10 +216,10 @@ void treeviews_prepare_openfiles()
|
||||
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tv.tree_openfiles), FALSE);
|
||||
|
||||
// sort opened filenames in the store_openfiles treeview
|
||||
sortable = GTK_TREE_SORTABLE(GTK_TREE_MODEL(tv.store_openfiles));
|
||||
sortable = GTK_TREE_SORTABLE(GTK_TREE_MODEL(store_openfiles));
|
||||
gtk_tree_sortable_set_sort_column_id(sortable, 0, GTK_SORT_ASCENDING);
|
||||
|
||||
pfd = pango_font_description_from_string(app->tagbar_font);
|
||||
pfd = pango_font_description_from_string(prefs.tagbar_font);
|
||||
gtk_widget_modify_font(tv.tree_openfiles, pfd);
|
||||
pango_font_description_free(pfd);
|
||||
|
||||
@ -233,7 +239,7 @@ void treeviews_openfiles_add(gint idx)
|
||||
{
|
||||
GtkTreeIter *iter = &doc_list[idx].iter;
|
||||
|
||||
gtk_list_store_append(tv.store_openfiles, iter);
|
||||
gtk_list_store_append(store_openfiles, iter);
|
||||
treeviews_openfiles_update(idx);
|
||||
}
|
||||
|
||||
@ -244,7 +250,7 @@ void treeviews_openfiles_update(gint idx)
|
||||
GdkColor *color = document_get_status(idx);
|
||||
|
||||
basename = g_path_get_basename(DOC_FILENAME(idx));
|
||||
gtk_list_store_set(tv.store_openfiles, &doc_list[idx].iter,
|
||||
gtk_list_store_set(store_openfiles, &doc_list[idx].iter,
|
||||
0, basename, 1, idx, 2, color, -1);
|
||||
g_free(basename);
|
||||
}
|
||||
@ -256,7 +262,7 @@ void treeviews_openfiles_update_all()
|
||||
guint i;
|
||||
gint idx;
|
||||
|
||||
gtk_list_store_clear(tv.store_openfiles);
|
||||
gtk_list_store_clear(store_openfiles);
|
||||
for (i = 0; i < (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); i++)
|
||||
{
|
||||
idx = document_get_n_idx(i);
|
||||
@ -272,7 +278,7 @@ void treeviews_remove_document(gint idx)
|
||||
{
|
||||
GtkTreeIter *iter = &doc_list[idx].iter;
|
||||
|
||||
gtk_list_store_remove(tv.store_openfiles, iter);
|
||||
gtk_list_store_remove(store_openfiles, iter);
|
||||
|
||||
if (GTK_IS_WIDGET(doc_list[idx].tag_tree))
|
||||
{
|
||||
@ -287,7 +293,7 @@ void treeviews_remove_document(gint idx)
|
||||
}
|
||||
|
||||
|
||||
void treeviews_create_taglist_popup_menu()
|
||||
static void create_taglist_popup_menu()
|
||||
{
|
||||
GtkWidget *item;
|
||||
|
||||
@ -329,7 +335,7 @@ void treeviews_create_taglist_popup_menu()
|
||||
}
|
||||
|
||||
|
||||
void treeviews_create_openfiles_popup_menu()
|
||||
static void create_openfiles_popup_menu()
|
||||
{
|
||||
GtkWidget *item;
|
||||
|
||||
@ -384,11 +390,12 @@ void treeviews_create_openfiles_popup_menu()
|
||||
/* compares the given data (GINT_TO_PONTER(idx)) with the idx from the selected row of openfiles
|
||||
* treeview, in case of a match the row is selected and TRUE is returned
|
||||
* (called indirectly from gtk_tree_model_foreach()) */
|
||||
gboolean treeviews_find_node(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
|
||||
static gboolean tree_model_find_node(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
gint idx = -1;
|
||||
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(tv.store_openfiles), iter, 1, &idx, -1);
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(store_openfiles), iter, 1, &idx, -1);
|
||||
|
||||
if (idx == GPOINTER_TO_INT(data))
|
||||
{
|
||||
@ -399,6 +406,13 @@ gboolean treeviews_find_node(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter
|
||||
}
|
||||
|
||||
|
||||
void treeviews_select_openfiles_item(gint idx)
|
||||
{
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(store_openfiles), tree_model_find_node,
|
||||
GINT_TO_POINTER(idx));
|
||||
}
|
||||
|
||||
|
||||
/* callbacks */
|
||||
|
||||
static void on_openfiles_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_data)
|
||||
@ -432,13 +446,13 @@ static void on_openfiles_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user
|
||||
}
|
||||
case OPENFILES_ACTION_HIDE:
|
||||
{
|
||||
app->sidebar_openfiles_visible = FALSE;
|
||||
prefs.sidebar_openfiles_visible = FALSE;
|
||||
ui_treeviews_show_hide(FALSE);
|
||||
break;
|
||||
}
|
||||
case OPENFILES_ACTION_HIDE_ALL:
|
||||
{
|
||||
app->sidebar_visible = FALSE;
|
||||
ui_prefs.sidebar_visible = FALSE;
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
break;
|
||||
}
|
||||
@ -501,13 +515,13 @@ static void on_taglist_tree_popup_clicked(GtkMenuItem *menuitem, gpointer user_d
|
||||
}
|
||||
case SYMBOL_ACTION_HIDE:
|
||||
{
|
||||
app->sidebar_symbol_visible = FALSE;
|
||||
prefs.sidebar_symbol_visible = FALSE;
|
||||
ui_treeviews_show_hide(FALSE);
|
||||
break;
|
||||
}
|
||||
case SYMBOL_ACTION_HIDE_ALL:
|
||||
{
|
||||
app->sidebar_visible = FALSE;
|
||||
ui_prefs.sidebar_visible = FALSE;
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
break;
|
||||
}
|
||||
@ -561,3 +575,16 @@ static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButto
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void treeviews_init()
|
||||
{
|
||||
tv.default_tag_tree = NULL;
|
||||
tag_window = lookup_widget(app->window, "scrolledwindow2");
|
||||
|
||||
prepare_openfiles();
|
||||
create_taglist_popup_menu();
|
||||
create_openfiles_popup_menu();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* treeviws.h
|
||||
* treeviews.h - this file is part of Geany, a fast and lightweight IDE
|
||||
*
|
||||
* Copyright 2005-2007 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
* Copyright 2006-2007 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
@ -27,13 +27,15 @@
|
||||
#define GEANY_TREEVIEWS_H 1
|
||||
|
||||
|
||||
struct SidebarTreeviews
|
||||
typedef struct SidebarTreeviews
|
||||
{
|
||||
GtkListStore *store_openfiles;
|
||||
GtkWidget *tree_openfiles;
|
||||
GtkWidget *default_tag_tree;
|
||||
GtkWidget *popup_taglist;
|
||||
GtkWidget *popup_openfiles;
|
||||
} tv;
|
||||
} SidebarTreeviews;
|
||||
|
||||
extern SidebarTreeviews tv;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -43,9 +45,9 @@ enum
|
||||
SYMBOLS_N_COLUMNS,
|
||||
};
|
||||
|
||||
void treeviews_update_tag_list(gint idx, gboolean update);
|
||||
void treeviews_init();
|
||||
|
||||
void treeviews_prepare_openfiles();
|
||||
void treeviews_update_tag_list(gint idx, gboolean update);
|
||||
|
||||
void treeviews_openfiles_add(gint idx);
|
||||
|
||||
@ -53,15 +55,8 @@ void treeviews_openfiles_update(gint idx);
|
||||
|
||||
void treeviews_openfiles_update_all();
|
||||
|
||||
void treeviews_select_openfiles_item(gint idx);
|
||||
|
||||
void treeviews_remove_document(gint idx);
|
||||
|
||||
void treeviews_create_openfiles_popup_menu();
|
||||
|
||||
void treeviews_create_taglist_popup_menu();
|
||||
|
||||
/* compares the given data (GINT_TO_PONTER(idx)) with the idx from the selected row of openfiles
|
||||
* treeview, in case of a match the row is selected and TRUE is returned
|
||||
* (called indirectly from gtk_tree_model_foreach()) */
|
||||
gboolean treeviews_find_node(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
|
||||
|
||||
#endif
|
||||
|
214
src/ui_utils.c
214
src/ui_utils.c
@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "ui_utils.h"
|
||||
#include "prefs.h"
|
||||
#include "sciwrappers.h"
|
||||
#include "document.h"
|
||||
#include "filetypes.h"
|
||||
@ -46,6 +47,9 @@
|
||||
#include "plugins.h"
|
||||
|
||||
|
||||
UIPrefs ui_prefs;
|
||||
UIWidgets ui_widgets;
|
||||
|
||||
static struct
|
||||
{
|
||||
GtkWidget *document_buttons[38]; // widgets only sensitive when there is at least one document
|
||||
@ -88,20 +92,20 @@ static void set_statusbar(const gchar *text, gboolean allow_override)
|
||||
|
||||
|
||||
/* Display text on the statusbar or log it to the Status window if
|
||||
* app->pref_main_suppress_status_messages is set */
|
||||
* prefs.suppress_status_messages is set */
|
||||
void ui_set_statusbar(const gchar *format, ...)
|
||||
{
|
||||
gchar string[512];
|
||||
va_list args;
|
||||
|
||||
if (! app->statusbar_visible)
|
||||
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 (app->pref_main_suppress_status_messages)
|
||||
if (prefs.suppress_status_messages)
|
||||
msgwin_status_add("%s", string);
|
||||
else
|
||||
set_statusbar(string, FALSE);
|
||||
@ -115,7 +119,7 @@ void ui_update_statusbar(gint idx, gint pos)
|
||||
const gchar *cur_tag;
|
||||
guint line, col;
|
||||
|
||||
if (! app->statusbar_visible)
|
||||
if (! prefs.statusbar_visible)
|
||||
return; // just do nothing if statusbar is not visible
|
||||
|
||||
if (idx == -1) idx = document_get_cur_idx();
|
||||
@ -212,13 +216,13 @@ void ui_set_editor_font(const gchar *font_name)
|
||||
|
||||
g_return_if_fail(font_name != NULL);
|
||||
// do nothing if font has not changed
|
||||
if (app->editor_font != NULL)
|
||||
if (strcmp(font_name, app->editor_font) == 0) return;
|
||||
if (prefs.editor_font != NULL)
|
||||
if (strcmp(font_name, prefs.editor_font) == 0) return;
|
||||
|
||||
g_free(app->editor_font);
|
||||
app->editor_font = g_strdup(font_name);
|
||||
g_free(prefs.editor_font);
|
||||
prefs.editor_font = g_strdup(font_name);
|
||||
|
||||
font_desc = pango_font_description_from_string(app->editor_font);
|
||||
font_desc = pango_font_description_from_string(prefs.editor_font);
|
||||
|
||||
fname = g_strdup_printf("!%s", pango_font_description_get_family(font_desc));
|
||||
size = pango_font_description_get_size(font_desc) / PANGO_SCALE;
|
||||
@ -233,14 +237,14 @@ void ui_set_editor_font(const gchar *font_name)
|
||||
}
|
||||
pango_font_description_free(font_desc);
|
||||
|
||||
msgwin_status_add(_("Font updated (%s)."), app->editor_font);
|
||||
msgwin_status_add(_("Font updated (%s)."), prefs.editor_font);
|
||||
g_free(fname);
|
||||
}
|
||||
|
||||
|
||||
void ui_set_fullscreen()
|
||||
{
|
||||
if (app->fullscreen)
|
||||
if (ui_prefs.fullscreen)
|
||||
{
|
||||
gtk_window_fullscreen(GTK_WINDOW(app->window));
|
||||
}
|
||||
@ -268,13 +272,13 @@ void ui_update_popup_reundo_items(gint idx)
|
||||
}
|
||||
|
||||
// index 0 is the popup menu, 1 is the menubar, 2 is the toolbar
|
||||
gtk_widget_set_sensitive(app->undo_items[0], enable_undo);
|
||||
gtk_widget_set_sensitive(app->undo_items[1], enable_undo);
|
||||
gtk_widget_set_sensitive(app->undo_items[2], enable_undo);
|
||||
gtk_widget_set_sensitive(ui_widgets.undo_items[0], enable_undo);
|
||||
gtk_widget_set_sensitive(ui_widgets.undo_items[1], enable_undo);
|
||||
gtk_widget_set_sensitive(ui_widgets.undo_items[2], enable_undo);
|
||||
|
||||
gtk_widget_set_sensitive(app->redo_items[0], enable_redo);
|
||||
gtk_widget_set_sensitive(app->redo_items[1], enable_redo);
|
||||
gtk_widget_set_sensitive(app->redo_items[2], enable_redo);
|
||||
gtk_widget_set_sensitive(ui_widgets.redo_items[0], enable_redo);
|
||||
gtk_widget_set_sensitive(ui_widgets.redo_items[1], enable_redo);
|
||||
gtk_widget_set_sensitive(ui_widgets.redo_items[2], enable_redo);
|
||||
}
|
||||
|
||||
|
||||
@ -286,16 +290,16 @@ void ui_update_popup_copy_items(gint idx)
|
||||
if (idx == -1) enable = FALSE;
|
||||
else enable = sci_can_copy(doc_list[idx].sci);
|
||||
|
||||
for(i = 0; i < (sizeof(app->popup_items)/sizeof(GtkWidget*)); i++)
|
||||
gtk_widget_set_sensitive(app->popup_items[i], enable);
|
||||
for(i = 0; i < (sizeof(ui_widgets.popup_items)/sizeof(GtkWidget*)); i++)
|
||||
gtk_widget_set_sensitive(ui_widgets.popup_items[i], enable);
|
||||
}
|
||||
|
||||
|
||||
void ui_update_popup_goto_items(gboolean enable)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->popup_goto_items[0], enable);
|
||||
gtk_widget_set_sensitive(app->popup_goto_items[1], enable);
|
||||
gtk_widget_set_sensitive(app->popup_goto_items[2], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.popup_goto_items[0], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.popup_goto_items[1], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.popup_goto_items[2], enable);
|
||||
}
|
||||
|
||||
|
||||
@ -318,8 +322,8 @@ void ui_update_menu_copy_items(gint idx)
|
||||
enable = gtk_text_buffer_get_selection_bounds(buffer, NULL, NULL);
|
||||
}
|
||||
|
||||
for(i = 0; i < (sizeof(app->menu_copy_items)/sizeof(GtkWidget*)); i++)
|
||||
gtk_widget_set_sensitive(app->menu_copy_items[i], enable);
|
||||
for(i = 0; i < (sizeof(ui_widgets.menu_copy_items)/sizeof(GtkWidget*)); i++)
|
||||
gtk_widget_set_sensitive(ui_widgets.menu_copy_items[i], enable);
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +337,7 @@ void ui_update_insert_include_item(gint idx, gint item)
|
||||
{
|
||||
enable = TRUE;
|
||||
}
|
||||
gtk_widget_set_sensitive(app->menu_insert_include_item[item], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.menu_insert_include_items[item], enable);
|
||||
}
|
||||
|
||||
|
||||
@ -500,8 +504,8 @@ void ui_save_buttons_toggle(gboolean enable)
|
||||
guint i;
|
||||
gboolean dirty_tabs = FALSE;
|
||||
|
||||
gtk_widget_set_sensitive(app->save_buttons[0], enable);
|
||||
gtk_widget_set_sensitive(app->save_buttons[1], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.save_buttons[0], enable);
|
||||
gtk_widget_set_sensitive(ui_widgets.save_buttons[1], enable);
|
||||
|
||||
// save all menu item and tool button
|
||||
for (i = 0; i < (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); i++)
|
||||
@ -512,8 +516,8 @@ void ui_save_buttons_toggle(gboolean enable)
|
||||
dirty_tabs = TRUE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive(app->save_buttons[2], (dirty_tabs > 0) ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive(app->save_buttons[3], (dirty_tabs > 0) ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive(ui_widgets.save_buttons[2], (dirty_tabs > 0) ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive(ui_widgets.save_buttons[3], (dirty_tabs > 0) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -531,7 +535,7 @@ static void init_document_widgets()
|
||||
widgets.document_buttons[7] = lookup_widget(app->window, "menu_close_all1");
|
||||
widgets.document_buttons[8] = lookup_widget(app->window, "menu_save_all1");
|
||||
widgets.document_buttons[9] = lookup_widget(app->window, "toolbutton22");
|
||||
widgets.document_buttons[10] = app->compile_button;
|
||||
widgets.document_buttons[10] = lookup_widget(app->window, "toolbutton13"); // compile_button
|
||||
widgets.document_buttons[11] = lookup_widget(app->window, "menu_save_as1");
|
||||
widgets.document_buttons[12] = lookup_widget(app->window, "toolbutton23");
|
||||
widgets.document_buttons[13] = lookup_widget(app->window, "menu_count_words1");
|
||||
@ -591,29 +595,29 @@ void ui_treeviews_show_hide(G_GNUC_UNUSED gboolean force)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
/* geany_debug("\nSidebar: %s\nSymbol: %s\nFiles: %s", ui_btoa(app->sidebar_visible),
|
||||
ui_btoa(app->sidebar_symbol_visible), ui_btoa(app->sidebar_openfiles_visible));
|
||||
/* geany_debug("\nSidebar: %s\nSymbol: %s\nFiles: %s", ui_btoa(ui_prefs.sidebar_visible),
|
||||
ui_btoa(prefs.sidebar_symbol_visible), ui_btoa(prefs.sidebar_openfiles_visible));
|
||||
*/
|
||||
|
||||
if (! app->sidebar_openfiles_visible && ! app->sidebar_symbol_visible)
|
||||
if (! prefs.sidebar_openfiles_visible && ! prefs.sidebar_symbol_visible)
|
||||
{
|
||||
app->sidebar_visible = FALSE;
|
||||
ui_prefs.sidebar_visible = FALSE;
|
||||
}
|
||||
|
||||
widget = lookup_widget(app->window, "menu_show_sidebar1");
|
||||
if (app->sidebar_visible != gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
if (ui_prefs.sidebar_visible != gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
{
|
||||
app->ignore_callback = TRUE;
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), app->sidebar_visible);
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), ui_prefs.sidebar_visible);
|
||||
app->ignore_callback = FALSE;
|
||||
}
|
||||
|
||||
ui_widget_show_hide(app->treeview_notebook, app->sidebar_visible);
|
||||
ui_widget_show_hide(app->treeview_notebook, ui_prefs.sidebar_visible);
|
||||
|
||||
ui_widget_show_hide(gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 0), app->sidebar_symbol_visible);
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 0), prefs.sidebar_symbol_visible);
|
||||
ui_widget_show_hide(gtk_notebook_get_nth_page(
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 1), app->sidebar_openfiles_visible);
|
||||
GTK_NOTEBOOK(app->treeview_notebook), 1), prefs.sidebar_openfiles_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -689,56 +693,56 @@ void ui_update_toolbar_items()
|
||||
{
|
||||
// show toolbar
|
||||
GtkWidget *widget = lookup_widget(app->window, "menu_show_toolbar1");
|
||||
if (app->toolbar_visible && ! gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
if (prefs.toolbar_visible && ! gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
{
|
||||
app->toolbar_visible = ! app->toolbar_visible; // will be changed by the toggled callback
|
||||
prefs.toolbar_visible = ! prefs.toolbar_visible; // will be changed by the toggled callback
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
|
||||
}
|
||||
else if (! app->toolbar_visible && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
else if (! prefs.toolbar_visible && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
|
||||
{
|
||||
app->toolbar_visible = ! app->toolbar_visible; // will be changed by the toggled callback
|
||||
prefs.toolbar_visible = ! prefs.toolbar_visible; // will be changed by the toggled callback
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), FALSE);
|
||||
}
|
||||
|
||||
// fileops
|
||||
ui_widget_show_hide(lookup_widget(app->window, "menutoolbutton1"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton9"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton10"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton22"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton23"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton15"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem7"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem2"), app->pref_toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "menutoolbutton1"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton9"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton10"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton22"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton23"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton15"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem7"), prefs.toolbar_show_fileops);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem2"), prefs.toolbar_show_fileops);
|
||||
// search
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry1"), app->pref_toolbar_show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton18"), app->pref_toolbar_show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem5"), app->pref_toolbar_show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry1"), prefs.toolbar_show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton18"), prefs.toolbar_show_search);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem5"), prefs.toolbar_show_search);
|
||||
// goto line
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry_goto_line"), app->pref_toolbar_show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton25"), app->pref_toolbar_show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), app->pref_toolbar_show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "entry_goto_line"), prefs.toolbar_show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton25"), prefs.toolbar_show_goto);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), prefs.toolbar_show_goto);
|
||||
// compile
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton13"), app->pref_toolbar_show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton26"), app->pref_toolbar_show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem6"), app->pref_toolbar_show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton13"), prefs.toolbar_show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton26"), prefs.toolbar_show_compile);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem6"), prefs.toolbar_show_compile);
|
||||
// colour
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton24"), app->pref_toolbar_show_colour);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem3"), app->pref_toolbar_show_colour);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton24"), prefs.toolbar_show_colour);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem3"), prefs.toolbar_show_colour);
|
||||
// zoom
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton20"), app->pref_toolbar_show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton21"), app->pref_toolbar_show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem4"), app->pref_toolbar_show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton20"), prefs.toolbar_show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton21"), prefs.toolbar_show_zoom);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem4"), prefs.toolbar_show_zoom);
|
||||
// undo
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_undo"), app->pref_toolbar_show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_redo"), app->pref_toolbar_show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem9"), app->pref_toolbar_show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_undo"), prefs.toolbar_show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_redo"), prefs.toolbar_show_undo);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem9"), prefs.toolbar_show_undo);
|
||||
// navigation
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_back"), app->pref_toolbar_show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_forward"), app->pref_toolbar_show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem10"), app->pref_toolbar_show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_back"), prefs.toolbar_show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton_forward"), prefs.toolbar_show_navigation);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem10"), prefs.toolbar_show_navigation);
|
||||
// quit
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton19"), app->pref_toolbar_show_quit);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), app->pref_toolbar_show_quit);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "toolbutton19"), prefs.toolbar_show_quit);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "separatortoolitem8"), prefs.toolbar_show_quit);
|
||||
}
|
||||
|
||||
|
||||
@ -751,7 +755,7 @@ GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img)
|
||||
case GEANY_IMAGE_LOGO: return gdk_pixbuf_new_from_inline(-1, aladin_inline, FALSE, NULL); break;
|
||||
case GEANY_IMAGE_SAVE_ALL:
|
||||
{
|
||||
if ((app->toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR) || small_img)
|
||||
if ((prefs.toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR) || small_img)
|
||||
{
|
||||
return gdk_pixbuf_scale_simple(gdk_pixbuf_new_from_inline(-1, save_all_inline, FALSE, NULL),
|
||||
16, 16, GDK_INTERP_HYPER);
|
||||
@ -764,7 +768,7 @@ GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img)
|
||||
}
|
||||
case GEANY_IMAGE_NEW_ARROW:
|
||||
{
|
||||
if ((app->toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR) || small_img)
|
||||
if ((prefs.toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR) || small_img)
|
||||
{
|
||||
return gdk_pixbuf_scale_simple(gdk_pixbuf_new_from_inline(-1, newfile_inline, FALSE, NULL),
|
||||
16, 16, GDK_INTERP_HYPER);
|
||||
@ -800,25 +804,25 @@ void ui_create_recent_menu()
|
||||
guint i;
|
||||
gchar *filename;
|
||||
|
||||
if (g_queue_get_length(app->recent_queue) > 0)
|
||||
if (g_queue_get_length(ui_prefs.recent_queue) > 0)
|
||||
{
|
||||
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
||||
lookup_widget(app->window, "toolbutton9")), app->recent_files_toolbar);
|
||||
lookup_widget(app->window, "toolbutton9")), ui_widgets.recent_files_toolbar);
|
||||
}
|
||||
|
||||
for (i = 0; i < MIN(app->mru_length, g_queue_get_length(app->recent_queue)); i++)
|
||||
for (i = 0; i < MIN(prefs.mru_length, g_queue_get_length(ui_prefs.recent_queue)); i++)
|
||||
{
|
||||
filename = g_queue_peek_nth(app->recent_queue, i);
|
||||
filename = g_queue_peek_nth(ui_prefs.recent_queue, i);
|
||||
// create menu item for the recent files menu in the menu bar
|
||||
tmp = gtk_menu_item_new_with_label(filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(app->recent_files_menubar), tmp);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
// create menu item for the recent files menu in the toolbar bar
|
||||
tmp = gtk_menu_item_new_with_label(filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(app->recent_files_toolbar), tmp);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
}
|
||||
@ -842,12 +846,12 @@ recent_file_activate_cb (GtkMenuItem *menuitem,
|
||||
|
||||
void ui_add_recent_file(const gchar *utf8_filename)
|
||||
{
|
||||
if (g_queue_find_custom(app->recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL)
|
||||
if (g_queue_find_custom(ui_prefs.recent_queue, utf8_filename, (GCompareFunc) strcmp) == NULL)
|
||||
{
|
||||
g_queue_push_head(app->recent_queue, g_strdup(utf8_filename));
|
||||
if (g_queue_get_length(app->recent_queue) > app->mru_length)
|
||||
g_queue_push_head(ui_prefs.recent_queue, g_strdup(utf8_filename));
|
||||
if (g_queue_get_length(ui_prefs.recent_queue) > prefs.mru_length)
|
||||
{
|
||||
g_free(g_queue_pop_tail(app->recent_queue));
|
||||
g_free(g_queue_pop_tail(ui_prefs.recent_queue));
|
||||
}
|
||||
update_recent_menu();
|
||||
}
|
||||
@ -894,32 +898,32 @@ static void recent_file_loaded(const gchar *utf8_filename)
|
||||
GtkWidget *tmp;
|
||||
|
||||
// first reorder the queue
|
||||
item = g_queue_find_custom(app->recent_queue, utf8_filename, (GCompareFunc) strcmp);
|
||||
item = g_queue_find_custom(ui_prefs.recent_queue, utf8_filename, (GCompareFunc) strcmp);
|
||||
g_return_if_fail(item != NULL);
|
||||
|
||||
data = item->data;
|
||||
g_queue_remove(app->recent_queue, data);
|
||||
g_queue_push_head(app->recent_queue, data);
|
||||
g_queue_remove(ui_prefs.recent_queue, data);
|
||||
g_queue_push_head(ui_prefs.recent_queue, data);
|
||||
|
||||
// remove the old menuitem for the filename
|
||||
children = gtk_container_get_children(GTK_CONTAINER(app->recent_files_menubar));
|
||||
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menubar));
|
||||
item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item);
|
||||
if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data));
|
||||
|
||||
children = gtk_container_get_children(GTK_CONTAINER(app->recent_files_toolbar));
|
||||
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_toolbar));
|
||||
item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item);
|
||||
if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data));
|
||||
|
||||
// now prepend a new menuitem for the filename, first for the recent files menu in the menu bar
|
||||
tmp = gtk_menu_item_new_with_label(utf8_filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(app->recent_files_menubar), tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
// then for the recent files menu in the tool bar
|
||||
tmp = gtk_menu_item_new_with_label(utf8_filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(app->recent_files_toolbar), tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
}
|
||||
@ -937,14 +941,14 @@ static void update_recent_menu()
|
||||
|
||||
if (gtk_menu_tool_button_get_menu(menu) == NULL)
|
||||
{
|
||||
gtk_menu_tool_button_set_menu(menu, app->recent_files_toolbar);
|
||||
gtk_menu_tool_button_set_menu(menu, ui_widgets.recent_files_toolbar);
|
||||
}
|
||||
|
||||
// clean the MRU list before adding an item (menubar)
|
||||
children = gtk_container_get_children(GTK_CONTAINER(app->recent_files_menubar));
|
||||
if (g_list_length(children) > app->mru_length - 1)
|
||||
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menubar));
|
||||
if (g_list_length(children) > prefs.mru_length - 1)
|
||||
{
|
||||
item = g_list_nth(children, app->mru_length - 1);
|
||||
item = g_list_nth(children, prefs.mru_length - 1);
|
||||
while (item != NULL)
|
||||
{
|
||||
if (GTK_IS_MENU_ITEM(item->data)) gtk_widget_destroy(GTK_WIDGET(item->data));
|
||||
@ -953,10 +957,10 @@ static void update_recent_menu()
|
||||
}
|
||||
|
||||
// clean the MRU list before adding an item (toolbar)
|
||||
children = gtk_container_get_children(GTK_CONTAINER(app->recent_files_toolbar));
|
||||
if (g_list_length(children) > app->mru_length - 1)
|
||||
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_toolbar));
|
||||
if (g_list_length(children) > prefs.mru_length - 1)
|
||||
{
|
||||
item = g_list_nth(children, app->mru_length - 1);
|
||||
item = g_list_nth(children, prefs.mru_length - 1);
|
||||
while (item != NULL)
|
||||
{
|
||||
if (GTK_IS_MENU_ITEM(item->data)) gtk_widget_destroy(GTK_WIDGET(item->data));
|
||||
@ -964,17 +968,17 @@ static void update_recent_menu()
|
||||
}
|
||||
}
|
||||
|
||||
filename = g_queue_peek_head(app->recent_queue);
|
||||
filename = g_queue_peek_head(ui_prefs.recent_queue);
|
||||
// create item for the menu bar menu
|
||||
tmp = gtk_menu_item_new_with_label(filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(app->recent_files_menubar), tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
// create item for the tool bar menu
|
||||
tmp = gtk_menu_item_new_with_label(filename);
|
||||
gtk_widget_show(tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(app->recent_files_toolbar), tmp);
|
||||
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
|
||||
g_signal_connect((gpointer) tmp, "activate",
|
||||
G_CALLBACK(recent_file_activate_cb), NULL);
|
||||
}
|
||||
@ -987,7 +991,7 @@ void ui_show_markers_margin()
|
||||
for(i = 0; i < max; i++)
|
||||
{
|
||||
idx = document_get_n_idx(i);
|
||||
sci_set_symbol_margin(doc_list[idx].sci, app->show_markers_margin);
|
||||
sci_set_symbol_margin(doc_list[idx].sci, editor_prefs.show_markers_margin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -999,7 +1003,7 @@ void ui_show_linenumber_margin()
|
||||
for(i = 0; i < max; i++)
|
||||
{
|
||||
idx = document_get_n_idx(i);
|
||||
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
|
||||
sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1172,7 +1176,7 @@ gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb)
|
||||
return FALSE; // no more items
|
||||
}
|
||||
// scroll item in view
|
||||
if (app->msgwindow_visible)
|
||||
if (ui_prefs.msgwindow_visible)
|
||||
{
|
||||
GtkTreePath *path = gtk_tree_model_get_path(
|
||||
gtk_tree_view_get_model(treeview), &iter);
|
||||
|
@ -24,6 +24,54 @@
|
||||
#ifndef GEANY_UI_UTILS_H
|
||||
#define GEANY_UI_UTILS_H 1
|
||||
|
||||
/* User Interface settings not shown in the Prefs dialog. */
|
||||
typedef struct UIPrefs
|
||||
{
|
||||
/* State of the main window when Geany was closed */
|
||||
gint geometry[5]; // 0:x, 1:y, 2:width, 3:height, flag for maximized state
|
||||
gboolean fullscreen;
|
||||
gboolean sidebar_visible;
|
||||
gboolean msgwindow_visible;
|
||||
|
||||
/* Menu-item related data */
|
||||
GQueue *recent_queue;
|
||||
gchar *custom_date_format;
|
||||
gchar **custom_commands;
|
||||
}
|
||||
UIPrefs;
|
||||
|
||||
extern UIPrefs ui_prefs;
|
||||
|
||||
|
||||
/* Less commonly used widgets */
|
||||
typedef struct UIWidgets
|
||||
{
|
||||
/* menu widgets */
|
||||
GtkWidget *toolbar_menu;
|
||||
GtkWidget *new_file_menu;
|
||||
GtkWidget *recent_files_menuitem;
|
||||
GtkWidget *recent_files_menubar;
|
||||
GtkWidget *recent_files_toolbar;
|
||||
GtkWidget *menu_insert_include_items[2];
|
||||
GtkWidget *popup_goto_items[3];
|
||||
GtkWidget *popup_items[5];
|
||||
GtkWidget *menu_copy_items[5];
|
||||
GtkWidget *redo_items[3];
|
||||
GtkWidget *undo_items[3];
|
||||
GtkWidget *save_buttons[4];
|
||||
|
||||
/* dialogs */
|
||||
GtkWidget *open_colorsel;
|
||||
GtkWidget *open_fontsel;
|
||||
GtkWidget *open_filesel;
|
||||
GtkWidget *save_filesel;
|
||||
GtkWidget *prefs_dialog;
|
||||
}
|
||||
UIWidgets;
|
||||
|
||||
extern UIWidgets ui_widgets;
|
||||
|
||||
|
||||
/* The following block of functions are more generic functions and closely related to
|
||||
* certain GTK+ widgets. */
|
||||
|
||||
|
15
src/utils.c
15
src/utils.c
@ -45,6 +45,7 @@
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "document.h"
|
||||
#include "filetypes.h"
|
||||
@ -62,7 +63,7 @@ void utils_start_browser(const gchar *uri)
|
||||
#else
|
||||
const gchar *argv[3];
|
||||
|
||||
argv[0] = app->tools_browser_cmd;
|
||||
argv[0] = prefs.tools_browser_cmd;
|
||||
argv[1] = uri;
|
||||
argv[2] = NULL;
|
||||
|
||||
@ -147,14 +148,13 @@ gint utils_get_line_endings(gchar* buffer, glong size)
|
||||
}
|
||||
|
||||
|
||||
gboolean utils_isbrace(gchar c)
|
||||
gboolean utils_isbrace(gchar c, gboolean include_angles)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
// match < and > only if desired, because I don't like it, but some people do
|
||||
case '<':
|
||||
case '>':
|
||||
return app->brace_match_ltgt;
|
||||
return include_angles;
|
||||
|
||||
case '(':
|
||||
case ')':
|
||||
@ -167,13 +167,12 @@ gboolean utils_isbrace(gchar c)
|
||||
}
|
||||
|
||||
|
||||
gboolean utils_is_opening_brace(gchar c)
|
||||
gboolean utils_is_opening_brace(gchar c, gboolean include_angles)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
// match < only if desired, because I don't like it, but some people do
|
||||
case '<':
|
||||
return app->brace_match_ltgt;
|
||||
return include_angles;
|
||||
|
||||
case '(':
|
||||
case '{':
|
||||
@ -1063,7 +1062,7 @@ gchar *utils_get_current_file_dir()
|
||||
/* very simple convenience function */
|
||||
void utils_beep()
|
||||
{
|
||||
if (app->beep_on_errors) gdk_beep();
|
||||
if (prefs.beep_on_errors) gdk_beep();
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,9 +45,9 @@ void utils_start_browser(const gchar *uri);
|
||||
/* taken from anjuta, to determine the EOL mode of the file */
|
||||
gint utils_get_line_endings(gchar* buffer, glong size);
|
||||
|
||||
gboolean utils_isbrace(gchar c);
|
||||
gboolean utils_isbrace(gchar c, gboolean include_angles);
|
||||
|
||||
gboolean utils_is_opening_brace(gchar c);
|
||||
gboolean utils_is_opening_brace(gchar c, gboolean include_angles);
|
||||
|
||||
gboolean utils_goto_file_line(const gchar *file, gboolean is_tm_filename, gint line);
|
||||
|
||||
|
30
src/vte.c
30
src/vte.c
@ -327,7 +327,7 @@ static void vte_register_symbols(GModule *mod)
|
||||
|
||||
void vte_apply_user_settings(void)
|
||||
{
|
||||
if (! app->msgwindow_visible) return;
|
||||
if (! ui_prefs.msgwindow_visible) return;
|
||||
//if (! GTK_WIDGET_REALIZED(vc->vte)) gtk_widget_realize(vc->vte);
|
||||
vf->vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte), vc->scrollback_lines);
|
||||
vf->vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(vc->vte), vc->scroll_on_key);
|
||||
@ -369,7 +369,7 @@ static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data)
|
||||
|
||||
prefs_show_dialog();
|
||||
|
||||
notebook = lookup_widget(app->prefs_dialog, "notebook2");
|
||||
notebook = lookup_widget(ui_widgets.prefs_dialog, "notebook2");
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), vte_prefs_tab_num);
|
||||
break;
|
||||
@ -539,8 +539,8 @@ void vte_append_preferences_tab()
|
||||
GtkTooltips *tooltips;
|
||||
GtkObject *spin_scrollback_adj;
|
||||
|
||||
tooltips = GTK_TOOLTIPS(lookup_widget(app->prefs_dialog, "tooltips"));
|
||||
notebook = lookup_widget(app->prefs_dialog, "notebook2");
|
||||
tooltips = GTK_TOOLTIPS(lookup_widget(ui_widgets.prefs_dialog, "tooltips"));
|
||||
notebook = lookup_widget(ui_widgets.prefs_dialog, "notebook2");
|
||||
|
||||
frame = ui_frame_new_with_alignment(_("Terminal plugin"), &alignment);
|
||||
vbox = gtk_vbox_new(FALSE, 12);
|
||||
@ -676,27 +676,27 @@ void vte_append_preferences_tab()
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), box, FALSE, FALSE, 0);
|
||||
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "font_term",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "font_term",
|
||||
gtk_widget_ref(font_term), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "color_fore",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "color_fore",
|
||||
gtk_widget_ref(color_fore), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "color_back",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "color_back",
|
||||
gtk_widget_ref(color_back), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "spin_scrollback",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "spin_scrollback",
|
||||
gtk_widget_ref(spin_scrollback), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "entry_emulation",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "entry_emulation",
|
||||
gtk_widget_ref(entry_emulation), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "entry_shell",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "entry_shell",
|
||||
gtk_widget_ref(entry_shell), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_scroll_key",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_scroll_key",
|
||||
gtk_widget_ref(check_scroll_key), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_scroll_out",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_scroll_out",
|
||||
gtk_widget_ref(check_scroll_out), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_ignore_menu_key",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_ignore_menu_key",
|
||||
gtk_widget_ref(check_ignore_menu_key), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_follow_path",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_follow_path",
|
||||
gtk_widget_ref(check_follow_path), (GDestroyNotify) gtk_widget_unref);
|
||||
g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_run_in_vte",
|
||||
g_object_set_data_full(G_OBJECT(ui_widgets.prefs_dialog), "check_run_in_vte",
|
||||
gtk_widget_ref(check_run_in_vte), (GDestroyNotify) gtk_widget_unref);
|
||||
|
||||
gtk_widget_show_all(frame);
|
||||
|
Loading…
x
Reference in New Issue
Block a user