Empty changelog

This commit is contained in:
Yevgen Muntyan 2005-11-03 06:47:53 +00:00
parent 62768ed718
commit eaf27307ef
5 changed files with 48 additions and 30 deletions

View File

@ -570,10 +570,12 @@ moo_edit_set_var (MooEdit *edit,
if (is_ascii (name)) if (is_ascii (name))
key = g_ascii_strdown (name, -1); key = g_ascii_strdown (name, -1);
else
key = g_strdup (name);
g_hash_table_insert (edit->priv->vars, g_strdelimit (key, "-_", '-');
key ? key : g_strdup (name),
g_strdup (value)); g_hash_table_insert (edit->priv->vars, key, g_strdup (value));
} }
@ -654,8 +656,8 @@ out:
#define KATE_MODE_STRING "kate:" #define KATE_MODE_STRING "kate:"
#define KATE_VAR_VAL_SEPARATOR " " #define KATE_VAR_VAL_SEPARATOR " "
#define VI_MODE_STRING "-*-" #define EMACS_MODE_STRING "-*-"
#define VI_VAR_VAL_SEPARATOR ":" #define EMACS_VAR_VAL_SEPARATOR ":"
static void static void
try_mode (MooEdit *edit) try_mode (MooEdit *edit)
@ -669,12 +671,23 @@ try_mode (MooEdit *edit)
gtk_text_iter_forward_to_line_end (&end); gtk_text_iter_forward_to_line_end (&end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
try_mode_string (edit, text, KATE_MODE_STRING, KATE_VAR_VAL_SEPARATOR); try_mode_string (edit, text, KATE_MODE_STRING, KATE_VAR_VAL_SEPARATOR);
try_mode_string (edit, text, VI_MODE_STRING, VI_VAR_VAL_SEPARATOR); try_mode_string (edit, text, EMACS_MODE_STRING, EMACS_VAR_VAL_SEPARATOR);
g_free (text); g_free (text);
gtk_text_buffer_get_end_iter (buffer, &end); gtk_text_buffer_get_end_iter (buffer, &end);
start = end;
gtk_text_iter_set_line_offset (&start, 0); if (gtk_text_iter_starts_line (&end))
{
gtk_text_iter_backward_line (&end);
start = end;
gtk_text_iter_forward_to_line_end (&end);
}
else
{
start = end;
gtk_text_iter_set_line_offset (&start, 0);
}
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
try_mode_string (edit, text, KATE_MODE_STRING, KATE_VAR_VAL_SEPARATOR); try_mode_string (edit, text, KATE_MODE_STRING, KATE_VAR_VAL_SEPARATOR);
g_free (text); g_free (text);

View File

@ -312,8 +312,11 @@ moo_edit_load_default (G_GNUC_UNUSED MooEditLoader *loader,
if (success) if (success)
{ {
/* XXX */
gtk_text_buffer_get_start_iter (buffer, &start); gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_place_cursor (buffer, &start); gtk_text_buffer_place_cursor (buffer, &start);
edit->priv->status = 0;
moo_edit_set_modified (edit, FALSE);
_moo_edit_set_filename (edit, file, encoding); _moo_edit_set_filename (edit, file, encoding);
_moo_edit_start_file_watch (edit); _moo_edit_start_file_watch (edit);
} }
@ -327,11 +330,6 @@ moo_edit_load_default (G_GNUC_UNUSED MooEditLoader *loader,
else else
moo_text_view_end_not_undoable_action (view); moo_text_view_end_not_undoable_action (view);
edit->priv->status = 0;
moo_edit_set_modified (edit, FALSE);
// _moo_text_buffer_dump (buffer, "/tmp/dump.c");
return success; return success;
} }
@ -442,6 +440,7 @@ do_load (MooEdit *edit,
} }
/* XXX */
static gboolean moo_edit_reload_default (MooEditLoader *loader, static gboolean moo_edit_reload_default (MooEditLoader *loader,
MooEdit *edit, MooEdit *edit,
GError **error) GError **error)

View File

@ -613,12 +613,14 @@ set_value_default (MooIndenter *indenter,
} }
else if (!g_ascii_strcasecmp (var, "indent-tabs-mode")) else if (!g_ascii_strcasecmp (var, "indent-tabs-mode"))
{ {
if (!g_ascii_strcasecmp (value, "t")) indenter->use_tabs = !g_ascii_strcasecmp (value, "t");
indenter->use_tabs = TRUE;
else
indenter->use_tabs = FALSE;
} }
else if (!g_ascii_strcasecmp (var, "c-basic-offset")) else if (!g_ascii_strcasecmp (var, "space-indent"))
{
indenter->use_tabs = !!g_ascii_strcasecmp (value, "on");
}
else if (!g_ascii_strcasecmp (var, "c-basic-offset") ||
!g_ascii_strcasecmp (var, "indent-width"))
{ {
guint64 indent = g_ascii_strtoull (value, NULL, 10); guint64 indent = g_ascii_strtoull (value, NULL, 10);

View File

@ -331,28 +331,32 @@ prefs_new_key_from_string (MooPrefs *prefs,
const char *value) const char *value)
{ {
PrefsItem *item; PrefsItem *item;
GValue gval; GValue val, default_val;
g_return_if_fail (key && key[0]); g_return_if_fail (key && key[0]);
g_return_if_fail (g_utf8_validate (key, -1, NULL)); g_return_if_fail (g_utf8_validate (key, -1, NULL));
item = prefs_get_item (prefs, key); item = prefs_get_item (prefs, key);
gval.g_type = 0; val.g_type = 0;
g_value_init (&gval, G_TYPE_STRING); g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&gval, value); g_value_set_string (&val, value);
default_val.g_type = 0;
g_value_init (&default_val, G_TYPE_STRING);
if (!item) if (!item)
{ {
prefs_new_key (prefs, key, G_TYPE_STRING, &gval); prefs_new_key (prefs, key, G_TYPE_STRING, &default_val);
item = prefs_get_item (prefs, key); item = prefs_get_item (prefs, key);
item_set (item, &val);
} }
else else
{ {
moo_value_convert (&gval, &item->value); moo_value_convert (&val, &item->value);
} }
g_value_unset (&gval); g_value_unset (&val);
g_value_unset (&default_val);
prefs_emit_notify (prefs, key, item_value (item)); prefs_emit_notify (prefs, key, item_value (item));
} }

View File

@ -167,7 +167,7 @@ moo_value_convert (const GValue *src,
if (dest_type == G_TYPE_BOOLEAN) if (dest_type == G_TYPE_BOOLEAN)
{ {
if (!string) if (!string || !string[0])
g_value_set_boolean (dest, FALSE); g_value_set_boolean (dest, FALSE);
else else
g_value_set_boolean (dest, g_value_set_boolean (dest,
@ -179,7 +179,7 @@ moo_value_convert (const GValue *src,
if (dest_type == G_TYPE_DOUBLE) if (dest_type == G_TYPE_DOUBLE)
{ {
if (!string) if (!string || !string[0])
g_value_set_double (dest, 0); g_value_set_double (dest, 0);
else else
g_value_set_double (dest, g_ascii_strtod (string, NULL)); g_value_set_double (dest, g_ascii_strtod (string, NULL));
@ -188,7 +188,7 @@ moo_value_convert (const GValue *src,
if (dest_type == G_TYPE_INT) if (dest_type == G_TYPE_INT)
{ {
if (!string) if (!string || !string[0])
g_value_set_int (dest, 0); g_value_set_int (dest, 0);
else else
g_value_set_int (dest, g_ascii_strtod (string, NULL)); g_value_set_int (dest, g_ascii_strtod (string, NULL));
@ -199,7 +199,7 @@ moo_value_convert (const GValue *src,
{ {
GdkColor color; GdkColor color;
if (!string) if (!string || !string[0])
{ {
g_value_set_boxed (dest, NULL); g_value_set_boxed (dest, NULL);
return TRUE; return TRUE;
@ -222,7 +222,7 @@ moo_value_convert (const GValue *src,
if (!string || !string[0]) if (!string || !string[0])
{ {
g_value_set_enum (dest, 0); g_value_set_enum (dest, 0);
g_return_val_if_reached (TRUE); return TRUE;
} }
klass = g_type_class_ref (dest_type); klass = g_type_class_ref (dest_type);