xed-pref-manager-app.c: Clean up code style

This commit is contained in:
JosephMcc 2016-12-31 21:21:06 -08:00
parent d80329db5c
commit 63f4658807
1 changed files with 769 additions and 845 deletions

View File

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