xed-pref-manager-app.c: Clean up code style
This commit is contained in:
parent
d80329db5c
commit
63f4658807
|
@ -159,9 +159,7 @@ get_state_filename (void)
|
|||
|
||||
if (config_dir != NULL)
|
||||
{
|
||||
filename = g_build_filename (config_dir,
|
||||
XED_STATE_FILE_LOCATION,
|
||||
NULL);
|
||||
filename = g_build_filename (config_dir, XED_STATE_FILE_LOCATION, NULL);
|
||||
g_free (config_dir);
|
||||
}
|
||||
|
||||
|
@ -179,19 +177,13 @@ get_xed_state_file (void)
|
|||
GError *err = NULL;
|
||||
|
||||
state_file = g_key_file_new ();
|
||||
|
||||
filename = get_state_filename ();
|
||||
|
||||
if (!g_key_file_load_from_file (state_file,
|
||||
filename,
|
||||
G_KEY_FILE_NONE,
|
||||
&err))
|
||||
if (!g_key_file_load_from_file (state_file, filename, G_KEY_FILE_NONE, &err))
|
||||
{
|
||||
if (err->domain != G_FILE_ERROR ||
|
||||
err->code != G_FILE_ERROR_NOENT)
|
||||
if (err->domain != G_FILE_ERROR || err->code != G_FILE_ERROR_NOENT)
|
||||
{
|
||||
g_warning ("Could not load xed state file: %s\n",
|
||||
err->message);
|
||||
g_warning ("Could not load xed state file: %s\n", err->message);
|
||||
}
|
||||
|
||||
g_error_free (err);
|
||||
|
@ -214,10 +206,7 @@ xed_state_get_int (const gchar *group,
|
|||
GError *err = NULL;
|
||||
|
||||
state_file = get_xed_state_file ();
|
||||
res = g_key_file_get_integer (state_file,
|
||||
group,
|
||||
key,
|
||||
&err);
|
||||
res = g_key_file_get_integer (state_file, group, key, &err);
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
|
@ -225,10 +214,7 @@ xed_state_get_int (const gchar *group,
|
|||
((err->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND &&
|
||||
err->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND)))
|
||||
{
|
||||
g_warning ("Could not get state value %s::%s : %s\n",
|
||||
group,
|
||||
key,
|
||||
err->message);
|
||||
g_warning ("Could not get state value %s::%s : %s\n", group, key, err->message);
|
||||
}
|
||||
|
||||
*result = defval;
|
||||
|
@ -248,10 +234,7 @@ xed_state_set_int (const gchar *group,
|
|||
GKeyFile *state_file;
|
||||
|
||||
state_file = get_xed_state_file ();
|
||||
g_key_file_set_integer (state_file,
|
||||
group,
|
||||
key,
|
||||
value);
|
||||
g_key_file_set_integer (state_file, group, key, value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -283,27 +266,20 @@ xed_state_file_sync (void)
|
|||
goto out;
|
||||
}
|
||||
|
||||
content = g_key_file_to_data (state_file,
|
||||
&length,
|
||||
&err);
|
||||
content = g_key_file_to_data (state_file, &length, &err);
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
g_warning ("Could not get data from state file: %s\n",
|
||||
err->message);
|
||||
g_warning ("Could not get data from state file: %s\n", err->message);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (content != NULL)
|
||||
{
|
||||
filename = get_state_filename ();
|
||||
if (!g_file_set_contents (filename,
|
||||
content,
|
||||
length,
|
||||
&err))
|
||||
if (!g_file_set_contents (filename, content, length, &err))
|
||||
{
|
||||
g_warning ("Could not write xed state file: %s\n",
|
||||
err->message);
|
||||
g_warning ("Could not write xed state file: %s\n", err->message);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +288,9 @@ xed_state_file_sync (void)
|
|||
|
||||
out:
|
||||
if (err != NULL)
|
||||
{
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
g_free (config_dir);
|
||||
g_free (filename);
|
||||
|
@ -343,9 +321,7 @@ xed_prefs_manager_set_window_state (gint ws)
|
|||
|
||||
window_state = ws;
|
||||
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_WINDOW_STATE,
|
||||
ws);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_WINDOW_STATE, ws);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -356,7 +332,8 @@ xed_prefs_manager_window_state_can_set (void)
|
|||
|
||||
/* Window size */
|
||||
void
|
||||
xed_prefs_manager_get_window_size (gint *width, gint *height)
|
||||
xed_prefs_manager_get_window_size (gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (width != NULL && height != NULL);
|
||||
|
||||
|
@ -381,7 +358,8 @@ xed_prefs_manager_get_window_size (gint *width, gint *height)
|
|||
}
|
||||
|
||||
void
|
||||
xed_prefs_manager_get_default_window_size (gint *width, gint *height)
|
||||
xed_prefs_manager_get_default_window_size (gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (width != NULL && height != NULL);
|
||||
|
||||
|
@ -390,19 +368,16 @@ xed_prefs_manager_get_default_window_size (gint *width, gint *height)
|
|||
}
|
||||
|
||||
void
|
||||
xed_prefs_manager_set_window_size (gint width, gint height)
|
||||
xed_prefs_manager_set_window_size (gint width,
|
||||
gint height)
|
||||
{
|
||||
g_return_if_fail (width > -1 && height > -1);
|
||||
|
||||
window_width = width;
|
||||
window_height = height;
|
||||
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_WINDOW_WIDTH,
|
||||
width);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_WINDOW_HEIGHT,
|
||||
height);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_WINDOW_WIDTH, width);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_WINDOW_HEIGHT, height);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -438,12 +413,12 @@ xed_prefs_manager_set_side_panel_size (gint ps)
|
|||
g_return_if_fail (ps > -1);
|
||||
|
||||
if (side_panel_size == ps)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
side_panel_size = ps;
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_SIDE_PANEL_SIZE,
|
||||
ps);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_SIDE_PANEL_SIZE, ps);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -470,12 +445,12 @@ void
|
|||
xed_prefs_manager_set_side_panel_active_page (gint id)
|
||||
{
|
||||
if (side_panel_active_page == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
side_panel_active_page = id;
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_SIDE_PANEL_ACTIVE_PAGE,
|
||||
id);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_SIDE_PANEL_ACTIVE_PAGE, id);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -511,12 +486,12 @@ xed_prefs_manager_set_bottom_panel_size (gint ps)
|
|||
g_return_if_fail (ps > -1);
|
||||
|
||||
if (bottom_panel_size == ps)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bottom_panel_size = ps;
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_BOTTOM_PANEL_SIZE,
|
||||
ps);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_BOTTOM_PANEL_SIZE, ps);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -543,12 +518,12 @@ void
|
|||
xed_prefs_manager_set_bottom_panel_active_page (gint id)
|
||||
{
|
||||
if (bottom_panel_active_page == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bottom_panel_active_page = id;
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP,
|
||||
XED_STATE_BOTTOM_PANEL_ACTIVE_PAGE,
|
||||
id);
|
||||
xed_state_set_int (XED_STATE_WINDOW_GROUP, XED_STATE_BOTTOM_PANEL_ACTIVE_PAGE, id);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -578,12 +553,12 @@ xed_prefs_manager_set_active_file_filter (gint id)
|
|||
g_return_if_fail (id >= 0);
|
||||
|
||||
if (active_file_filter == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
active_file_filter = id;
|
||||
xed_state_set_int (XED_STATE_FILEFILTER_GROUP,
|
||||
XED_STATE_FILEFILTER_ID,
|
||||
id);
|
||||
xed_state_set_int (XED_STATE_FILEFILTER_GROUP, XED_STATE_FILEFILTER_ID, id);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -605,113 +580,71 @@ xed_prefs_manager_app_init (void)
|
|||
|
||||
if (xed_prefs_manager != NULL)
|
||||
{
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_USE_DEFAULT_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_editor_font_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_USE_DEFAULT_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_editor_font_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_EDITOR_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_editor_font_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_EDITOR_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_editor_font_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->interface_settings,
|
||||
"changed::" GPM_SYSTEM_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_system_font_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->interface_settings, "changed::" GPM_SYSTEM_FONT,
|
||||
G_CALLBACK (xed_prefs_manager_system_font_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_TABS_SIZE,
|
||||
G_CALLBACK (xed_prefs_manager_tabs_size_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_TABS_SIZE,
|
||||
G_CALLBACK (xed_prefs_manager_tabs_size_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_INSERT_SPACES,
|
||||
G_CALLBACK (xed_prefs_manager_tabs_size_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_INSERT_SPACES,
|
||||
G_CALLBACK (xed_prefs_manager_tabs_size_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_WRAP_MODE,
|
||||
G_CALLBACK (xed_prefs_manager_wrap_mode_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_WRAP_MODE,
|
||||
G_CALLBACK (xed_prefs_manager_wrap_mode_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_DISPLAY_LINE_NUMBERS,
|
||||
G_CALLBACK (xed_prefs_manager_line_numbers_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_DISPLAY_LINE_NUMBERS,
|
||||
G_CALLBACK (xed_prefs_manager_line_numbers_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_AUTO_INDENT,
|
||||
G_CALLBACK (xed_prefs_manager_auto_indent_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_AUTO_INDENT,
|
||||
G_CALLBACK (xed_prefs_manager_auto_indent_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_UNDO_ACTIONS_LIMIT,
|
||||
G_CALLBACK (xed_prefs_manager_undo_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_UNDO_ACTIONS_LIMIT,
|
||||
G_CALLBACK (xed_prefs_manager_undo_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_DISPLAY_RIGHT_MARGIN,
|
||||
G_CALLBACK (xed_prefs_manager_right_margin_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_DISPLAY_RIGHT_MARGIN,
|
||||
G_CALLBACK (xed_prefs_manager_right_margin_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_RIGHT_MARGIN_POSITION,
|
||||
G_CALLBACK (xed_prefs_manager_right_margin_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_RIGHT_MARGIN_POSITION,
|
||||
G_CALLBACK (xed_prefs_manager_right_margin_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_SMART_HOME_END,
|
||||
G_CALLBACK (xed_prefs_manager_smart_home_end_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_SMART_HOME_END,
|
||||
G_CALLBACK (xed_prefs_manager_smart_home_end_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_ENABLE_TAB_SCROLLING,
|
||||
G_CALLBACK (xed_prefs_manager_enable_tab_scrolling_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_HIGHLIGHT_CURRENT_LINE,
|
||||
G_CALLBACK (xed_prefs_manager_hl_current_line_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_HIGHLIGHT_CURRENT_LINE,
|
||||
G_CALLBACK (xed_prefs_manager_hl_current_line_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_BRACKET_MATCHING,
|
||||
G_CALLBACK (xed_prefs_manager_bracket_matching_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_BRACKET_MATCHING,
|
||||
G_CALLBACK (xed_prefs_manager_bracket_matching_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_SYNTAX_HL_ENABLE,
|
||||
G_CALLBACK (xed_prefs_manager_syntax_hl_enable_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_SYNTAX_HL_ENABLE,
|
||||
G_CALLBACK (xed_prefs_manager_syntax_hl_enable_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_SEARCH_HIGHLIGHTING_ENABLE,
|
||||
G_CALLBACK (xed_prefs_manager_search_hl_enable_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_SEARCH_HIGHLIGHTING_ENABLE,
|
||||
G_CALLBACK (xed_prefs_manager_search_hl_enable_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_SOURCE_STYLE_SCHEME,
|
||||
G_CALLBACK (xed_prefs_manager_source_style_scheme_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_SOURCE_STYLE_SCHEME,
|
||||
G_CALLBACK (xed_prefs_manager_source_style_scheme_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_MAX_RECENTS,
|
||||
G_CALLBACK (xed_prefs_manager_max_recents_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_MAX_RECENTS,
|
||||
G_CALLBACK (xed_prefs_manager_max_recents_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_CREATE_BACKUP_COPY,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_CREATE_BACKUP_COPY,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_AUTO_SAVE_INTERVAL,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_AUTO_SAVE_INTERVAL,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed), NULL);
|
||||
|
||||
g_signal_connect (xed_prefs_manager->settings,
|
||||
"changed::" GPM_WRITABLE_VFS_SCHEMES,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed),
|
||||
NULL);
|
||||
g_signal_connect (xed_prefs_manager->settings, "changed::" GPM_WRITABLE_VFS_SCHEMES,
|
||||
G_CALLBACK (xed_prefs_manager_auto_save_changed), NULL);
|
||||
}
|
||||
|
||||
return xed_prefs_manager != NULL;
|
||||
|
@ -747,18 +680,23 @@ xed_prefs_manager_editor_font_changed (GSettings *settings,
|
|||
def = g_settings_get_boolean (settings, key);
|
||||
|
||||
if (def)
|
||||
{
|
||||
font = xed_prefs_manager_get_system_font ();
|
||||
}
|
||||
else
|
||||
{
|
||||
font = xed_prefs_manager_get_editor_font ();
|
||||
}
|
||||
}
|
||||
else if (strcmp (key, GPM_EDITOR_FONT) == 0)
|
||||
{
|
||||
font = g_settings_get_string (settings, key);
|
||||
|
||||
def = xed_prefs_manager_get_use_default_font ();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
|
||||
|
@ -793,10 +731,14 @@ xed_prefs_manager_system_font_changed (GSettings *settings,
|
|||
xed_debug (DEBUG_PREFS);
|
||||
|
||||
if (strcmp (key, GPM_SYSTEM_FONT) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xed_prefs_manager_get_use_default_font ())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
font = g_settings_get_string (settings, key);
|
||||
|
||||
|
@ -832,7 +774,6 @@ xed_prefs_manager_tabs_size_changed (GSettings *settings,
|
|||
GList *l;
|
||||
|
||||
tab_width = g_settings_get_int (settings, key);
|
||||
|
||||
tab_width = CLAMP (tab_width, 1, 24);
|
||||
|
||||
views = xed_app_get_views (xed_app_get_default ());
|
||||
|
@ -840,9 +781,7 @@ xed_prefs_manager_tabs_size_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (l->data),
|
||||
tab_width);
|
||||
|
||||
gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (l->data), tab_width);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -861,10 +800,7 @@ xed_prefs_manager_tabs_size_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_insert_spaces_instead_of_tabs (
|
||||
GTK_SOURCE_VIEW (l->data),
|
||||
enable);
|
||||
|
||||
gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (l->data), enable);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -880,14 +816,20 @@ get_wrap_mode_from_string (const gchar* str)
|
|||
g_return_val_if_fail (str != NULL, GTK_WRAP_WORD);
|
||||
|
||||
if (strcmp (str, "GTK_WRAP_NONE") == 0)
|
||||
{
|
||||
res = GTK_WRAP_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (str, "GTK_WRAP_CHAR") == 0)
|
||||
{
|
||||
res = GTK_WRAP_CHAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = GTK_WRAP_WORD;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -912,9 +854,7 @@ xed_prefs_manager_wrap_mode_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (l->data),
|
||||
wrap_mode);
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (l->data), wrap_mode);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -942,9 +882,7 @@ xed_prefs_manager_line_numbers_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (l->data),
|
||||
dln);
|
||||
|
||||
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (l->data), dln);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -972,9 +910,7 @@ xed_prefs_manager_hl_current_line_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_highlight_current_line (GTK_SOURCE_VIEW (l->data),
|
||||
hl);
|
||||
|
||||
gtk_source_view_set_highlight_current_line (GTK_SOURCE_VIEW (l->data), hl);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1002,9 +938,7 @@ xed_prefs_manager_bracket_matching_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (l->data),
|
||||
enable);
|
||||
|
||||
gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (l->data), enable);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1032,9 +966,7 @@ xed_prefs_manager_auto_indent_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (l->data),
|
||||
enable);
|
||||
|
||||
gtk_source_view_set_auto_indent (GTK_SOURCE_VIEW (l->data), enable);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1064,9 +996,7 @@ xed_prefs_manager_undo_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (l->data),
|
||||
ul);
|
||||
|
||||
gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (l->data), ul);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1096,9 +1026,7 @@ xed_prefs_manager_right_margin_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_right_margin_position (GTK_SOURCE_VIEW (l->data),
|
||||
pos);
|
||||
|
||||
gtk_source_view_set_right_margin_position (GTK_SOURCE_VIEW (l->data), pos);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1117,9 +1045,7 @@ xed_prefs_manager_right_margin_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_show_right_margin (GTK_SOURCE_VIEW (l->data),
|
||||
display);
|
||||
|
||||
gtk_source_view_set_show_right_margin (GTK_SOURCE_VIEW (l->data), display);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1135,13 +1061,21 @@ get_smart_home_end_from_string (const gchar *str)
|
|||
g_return_val_if_fail (str != NULL, GTK_SOURCE_SMART_HOME_END_AFTER);
|
||||
|
||||
if (strcmp (str, "DISABLED") == 0)
|
||||
{
|
||||
res = GTK_SOURCE_SMART_HOME_END_DISABLED;
|
||||
}
|
||||
else if (strcmp (str, "BEFORE") == 0)
|
||||
{
|
||||
res = GTK_SOURCE_SMART_HOME_END_BEFORE;
|
||||
}
|
||||
else if (strcmp (str, "ALWAYS") == 0)
|
||||
{
|
||||
res = GTK_SOURCE_SMART_HOME_END_ALWAYS;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = GTK_SOURCE_SMART_HOME_END_AFTER;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -1166,9 +1100,7 @@ xed_prefs_manager_smart_home_end_changed (GSettings *settings,
|
|||
|
||||
while (l != NULL)
|
||||
{
|
||||
gtk_source_view_set_smart_home_end (GTK_SOURCE_VIEW (l->data),
|
||||
smart_he);
|
||||
|
||||
gtk_source_view_set_smart_home_end (GTK_SOURCE_VIEW (l->data), smart_he);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1226,9 +1158,7 @@ xed_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
|
|||
{
|
||||
g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
|
||||
|
||||
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data),
|
||||
enable);
|
||||
|
||||
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (l->data), enable);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1242,10 +1172,7 @@ xed_prefs_manager_syntax_hl_enable_changed (GSettings *settings,
|
|||
GtkAction *a;
|
||||
|
||||
ui = xed_window_get_ui_manager (XED_WINDOW (windows->data));
|
||||
|
||||
a = gtk_ui_manager_get_action (ui,
|
||||
"/MenuBar/ViewMenu/ViewHighlightModeMenu");
|
||||
|
||||
a = gtk_ui_manager_get_action (ui, "/MenuBar/ViewMenu/ViewHighlightModeMenu");
|
||||
gtk_action_set_sensitive (a, enable);
|
||||
|
||||
windows = g_list_next (windows);
|
||||
|
@ -1275,9 +1202,7 @@ xed_prefs_manager_search_hl_enable_changed (GSettings *settings,
|
|||
{
|
||||
g_return_if_fail (XED_IS_DOCUMENT (l->data));
|
||||
|
||||
xed_document_set_enable_search_highlighting (XED_DOCUMENT (l->data),
|
||||
enable);
|
||||
|
||||
xed_document_set_enable_search_highlighting (XED_DOCUMENT (l->data), enable);
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
|
@ -1303,22 +1228,20 @@ xed_prefs_manager_source_style_scheme_changed (GSettings *settings,
|
|||
scheme = g_settings_get_string (settings, key);
|
||||
|
||||
if (old_scheme != NULL && (strcmp (scheme, old_scheme) == 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (old_scheme);
|
||||
old_scheme = scheme;
|
||||
|
||||
style = gtk_source_style_scheme_manager_get_scheme (
|
||||
xed_get_style_scheme_manager (),
|
||||
scheme);
|
||||
style = gtk_source_style_scheme_manager_get_scheme (xed_get_style_scheme_manager (), scheme);
|
||||
|
||||
if (style == NULL)
|
||||
{
|
||||
g_warning ("Default style scheme '%s' not found, falling back to 'classic'", scheme);
|
||||
|
||||
style = gtk_source_style_scheme_manager_get_scheme (
|
||||
xed_get_style_scheme_manager (),
|
||||
"classic");
|
||||
style = gtk_source_style_scheme_manager_get_scheme (xed_get_style_scheme_manager (), "classic");
|
||||
|
||||
if (style == NULL)
|
||||
{
|
||||
|
@ -1332,8 +1255,7 @@ xed_prefs_manager_source_style_scheme_changed (GSettings *settings,
|
|||
{
|
||||
g_return_if_fail (GTK_SOURCE_IS_BUFFER (l->data));
|
||||
|
||||
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data),
|
||||
style);
|
||||
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (l->data), style);
|
||||
}
|
||||
|
||||
g_list_free (docs);
|
||||
|
@ -1402,7 +1324,9 @@ xed_prefs_manager_auto_save_changed (GSettings *settings,
|
|||
auto_save_interval = g_settings_get_int (settings, key);
|
||||
|
||||
if (auto_save_interval <= 0)
|
||||
{
|
||||
auto_save_interval = GPM_DEFAULT_AUTO_SAVE_INTERVAL;
|
||||
}
|
||||
|
||||
docs = xed_app_get_documents (xed_app_get_default ());
|
||||
l = docs;
|
||||
|
|
Loading…
Reference in New Issue