moo_lang_id()

This commit is contained in:
Yevgen Muntyan 2006-04-26 23:04:30 -05:00
parent 294133a068
commit e22147ef2e
5 changed files with 12 additions and 8 deletions

View File

@ -746,7 +746,7 @@ moo_edit_action_check (MooEditAction *action)
{
GSList *l;
MooLang *lang = moo_text_view_get_lang (MOO_TEXT_VIEW (action->doc));
const char *lang_id = lang ? lang->id : MOO_LANG_NONE;
const char *lang_id = moo_lang_id (lang);
gboolean visible = FALSE;
for (l = action->langs; l != NULL; l = l->next)

View File

@ -2232,8 +2232,6 @@ moo_edit_window_message (MooEditWindow *window,
/* Language menu
*/
#define NONE_LANGUAGE_ID "MOO_LANG_NONE"
static int
cmp_langs (MooLang *lang1,
MooLang *lang2)
@ -2297,7 +2295,7 @@ create_lang_action (MooEditWindow *window)
"Language", 0, NULL, NULL);
moo_menu_mgr_append (menu_mgr, LANG_ACTION_ID,
NONE_LANGUAGE_ID, "None",
MOO_LANG_NONE, "None",
MOO_MENU_ITEM_RADIO, NULL, NULL);
for (l = sections; l != NULL; l = l->next)
@ -2341,7 +2339,7 @@ update_lang_menu (MooEditWindow *window)
g_return_if_fail (action != NULL);
moo_menu_mgr_set_active (moo_menu_action_get_mgr (MOO_MENU_ACTION (action)),
lang ? lang->id : NONE_LANGUAGE_ID, TRUE);
moo_lang_id (lang), TRUE);
}

View File

@ -254,6 +254,13 @@ moo_lang_id_from_name (const char *name)
}
const char *
moo_lang_id (MooLang *lang)
{
return lang ? lang->id : MOO_LANG_NONE;
}
void
moo_lang_add_style (MooLang *lang,
const char *name,

View File

@ -224,6 +224,7 @@ void moo_lang_add_style (MooLang *lang,
const MooTextStyle *style);
char *moo_lang_id_from_name (const char *name);
const char *moo_lang_id (MooLang *lang);
/*****************************************************************************/

View File

@ -728,7 +728,6 @@ check_visible_func (MooAction *_action,
G_GNUC_UNUSED gpointer dummy)
{
MooToolAction *action;
const char *lang_id;
MooLang *lang;
gboolean visible;
@ -737,10 +736,9 @@ check_visible_func (MooAction *_action,
g_return_if_fail (action->data != NULL);
lang = moo_text_view_get_lang (MOO_TEXT_VIEW (doc));
lang_id = lang ? lang->id : MOO_LANG_NONE;
visible = NULL != g_slist_find_custom (action->data->langs,
lang_id,
moo_lang_id (lang),
(GCompareFunc) strcmp);
g_value_set_boolean (prop_value, visible);