languages.h File Reference

#include <gtk/gtk.h>
Include dependency graph for languages.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GtkWidget * create_language_window (GtkWidget *parent, gboolean is_firstboot)
void load_language_settings ()
void save_language_settings ()
void language_set_main_focus ()

Function Documentation

GtkWidget* create_language_window ( GtkWidget *  parent,
gboolean  is_firstboot 
)

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Definition at line 116 of file languages.c.

References create_continue_widgets(), create_language_widgets(), create_settingsview_for_type(), create_title_keep_labels(), g_is_firstboot, g_main_window, g_subtitle, g_title, init_widgets_with_settings(), SETTING_LANGUAGE, and WINDOW_BORDER_PADDING.

Referenced by create_concrete_win().

00117 {
00118     g_is_firstboot = is_firstboot;
00119 
00120     // create top window
00121     GtkWidget* top_window = parent;
00122     if (is_firstboot) 
00123     {
00124         gtk_window_fullscreen(GTK_WINDOW(top_window));
00125     } else 
00126     {
00127         gtk_window_maximize(GTK_WINDOW(top_window));
00128     }
00129     gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE);
00130     gtk_container_set_border_width(GTK_CONTAINER(top_window),WINDOW_BORDER_PADDING);
00131     gtk_window_set_modal(GTK_WINDOW(top_window), TRUE);
00132 
00133     // top level vbox (vboxtop)
00134     GtkWidget* vboxtop = gtk_vbox_new(FALSE, 3);
00135     gtk_container_add(GTK_CONTAINER(top_window), vboxtop);
00136 
00137     // add header container the title and subtitle of this settings page
00138     create_title_keep_labels(GTK_VBOX(vboxtop), NULL, NULL, &g_title, &g_subtitle);
00139 
00140     GtkWidget* view = NULL ; 
00141     if (! is_firstboot) {
00142         // add the back/exit bar below the title 
00143         view = create_settingsview_for_type( SETTING_LANGUAGE );
00144         gtk_box_pack_start(GTK_BOX(vboxtop), view, FALSE, FALSE,0 ); 
00145     }
00146 
00147     // The margin settings section.
00148     create_language_widgets(GTK_BOX(vboxtop));
00149 
00150 
00151     if ( ! is_firstboot )
00152     {
00153         gtk_widget_grab_focus(view);
00154     }
00155     else {
00156         // create save frame
00157         create_continue_widgets(GTK_BOX(vboxtop));
00158     }
00159     
00160     // Update widget with current settings.
00161     init_widgets_with_settings();
00162 
00163     g_main_window = top_window;
00164 
00165     gtk_widget_show_all(top_window);
00166 
00167     return top_window;
00168 }

Here is the call graph for this function:

Here is the caller graph for this function:

void language_set_main_focus (  ) 

Definition at line 476 of file languages.c.

References g_language_radios.

Referenced by setting_set_focus().

00477 {
00478     gtk_widget_grab_focus(g_language_radios[0]);
00479 }

Here is the caller graph for this function:

void load_language_settings (  ) 

Definition at line 410 of file languages.c.

References g_cur_language, g_orig_language, GCONF_CURRENT_LOCALE, get_available_locales(), get_value_string(), and LOGPRINTF.

Referenced by create_concrete_win().

00411 {
00412     GSList* available_locales = get_available_locales();
00413     const char* cur_locale = get_value_string(GCONF_CURRENT_LOCALE);
00414     if (cur_locale == NULL)
00415     {
00416         cur_locale = "en_US";
00417     }
00418 
00419     GSList* found = g_slist_find_custom(available_locales, cur_locale, (GCompareFunc)strcmp);
00420     if (!found)
00421     {
00422         LOGPRINTF("Locale [%s] not found - try en_US", cur_locale);
00423         found = g_slist_find_custom(available_locales, "en_US", (GCompareFunc)strcmp);
00424     }
00425     if (!found)
00426     {
00427         LOGPRINTF("Locale en_US not found - try en_GB");
00428         found = g_slist_find_custom(available_locales, "en_GB", (GCompareFunc)strcmp);
00429     }
00430 
00431     g_orig_language = g_slist_position(available_locales, found);
00432     g_cur_language = g_orig_language;
00433 }

Here is the call graph for this function:

Here is the caller graph for this function:

void save_language_settings (  ) 

Definition at line 435 of file languages.c.

References free_string_list(), g_cur_language, g_orig_language, GCONF_CURRENT_LOCALE, get_available_locales(), LOGPRINTF, and set_value_string().

Referenced by on_language_selection_changed(), and on_listview_row_activated().

00436 {
00437     GSList*  available_locales = NULL;
00438     gpointer cur_locale        = NULL;
00439 
00440     // Save language settings if necessary.
00441     if (g_cur_language != g_orig_language)
00442     {
00443         // Set current locale.
00444         available_locales = get_available_locales();
00445         cur_locale = g_slist_nth_data(available_locales, g_cur_language);
00446         set_value_string(GCONF_CURRENT_LOCALE, cur_locale);
00447         free_string_list(available_locales);
00448     }
00449 
00450     LOGPRINTF("Saving language settings, done.");
00451 }

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208