static void set_language (GeditDocument *doc, GtkSourceLanguage *lang, gboolean set_by_user) { GeditDocumentPrivate *priv; GtkSourceLanguage *old_lang; gedit_debug (DEBUG_DOCUMENT); priv = gedit_document_get_instance_private (doc); old_lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc)); if (old_lang == lang) { return; } gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang); if (set_by_user) { const gchar *language = get_language_string (doc); gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language, NULL); } priv->language_set_by_user = set_by_user; }
static void save_metadata (GeditDocument *doc) { const gchar *language = NULL; GtkTextIter iter; gchar *position; if (doc->priv->language_set_by_user) { language = get_language_string (doc); } gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), &iter, gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (doc))); position = g_strdup_printf ("%d", gtk_text_iter_get_offset (&iter)); if (language == NULL) { gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_POSITION, position, NULL); } else { gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_POSITION, position, GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language, NULL); } g_free (position); }
static HRESULT WINAPI OmNavigator_get_userLanguage(IOmNavigator *iface, BSTR *p) { OmNavigator *This = impl_from_IOmNavigator(iface); TRACE("(%p)->(%p)\n", This, p); return get_language_string(LOCALE_USER_DEFAULT, p); }
static HRESULT WINAPI OmNavigator_get_browserLanguage(IOmNavigator *iface, BSTR *p) { OmNavigator *This = impl_from_IOmNavigator(iface); TRACE("(%p)->(%p)\n", This, p); return get_language_string(GetUserDefaultUILanguage(), p); }
static void set_language (GeditDocument *doc, GtkSourceLanguage *lang, gboolean set_by_user) { GtkSourceLanguage *old_lang; gedit_debug (DEBUG_DOCUMENT); old_lang = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc)); if (old_lang == lang) { return; } gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang); if (lang != NULL) { gboolean syntax_hl; syntax_hl = g_settings_get_boolean (doc->priv->editor_settings, GEDIT_SETTINGS_SYNTAX_HIGHLIGHTING); gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), syntax_hl); } else { gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc), FALSE); } if (set_by_user) { const gchar *language = get_language_string (doc); gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_LANGUAGE, language, NULL); } doc->priv->language_set_by_user = set_by_user; }
.get_num_rows = menu_get_num_rows_callback, .get_header_height = menu_get_header_height_callback, .get_cell_height = menu_get_cell_height_callback, .draw_header = menu_draw_header_callback, .draw_row = menu_draw_row_callback, .select_click = menu_select_click_callback }); menu_layer_set_click_config_onto_window(menu_layer, window); menu_layer_add_to_window(menu_layer, window); // Set menu layer transport_type_to_menulayer_map[ttype] = menu_layer; // Set loading layer LoadingLayer *loading_layer = loading_layer_create(window); loading_layer_set_text(loading_layer, get_language_string(5)); transport_type_to_loadinglayer_map[ttype] = loading_layer; } static void window_unload(Window *window) { realtime_transport_type_t ttype = get_transport_type_from_window(window); menu_layer_destroy(transport_type_to_menulayer_map[ttype]); loading_layer_destroy(transport_type_to_loadinglayer_map[ttype]); } static void window_disappear(Window *window) { if (command_timeout_timer != NULL) { app_timer_cancel(command_timeout_timer); command_timeout_timer = NULL; } }