ctb/src/main.c File Reference

#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <unistd.h>
#include "ctb_log.h"
#include "fileview.h"
#include "filemodel.h"
#include "i18n.h"
#include "ipc.h"
#include "menu.h"
Include dependency graph for ctb/src/main.c:

Go to the source code of this file.

Functions

void main_set_locale (const char *locale)
void main_quit (void)
static gboolean on_startup_complete (gpointer data)
int main (int argc, char *argv[])

Variables

static const char * rc_filename = DATADIR "/" PACKAGE_NAME ".rc"
static const char * EMULATOR_HOSTNAME = "qemuarm"

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 86 of file ctb/src/main.c.

References DIR_LIBRARY, EMULATOR_HOSTNAME, filemodel_quit(), fileview_create(), fileview_init(), fileview_media_mounted(), fileview_media_unmounted(), GETTEXT_PACKAGE, ipc_init(), LOGPRINTF, main_quit(), main_set_locale(), menu_init(), on_startup_complete(), rc_filename, storage_media_mounted(), and WARNPRINTF.

00087 {
00088     textdomain(GETTEXT_PACKAGE);
00089     
00090     gtk_init(&argc, &argv);
00091     gchar** files = gtk_rc_get_default_files();
00092     while (*files)
00093     {
00094         LOGPRINTF("gtk_rc_get_default_files [%s]", *files);
00095         files++;
00096     }
00097 
00098     ipc_init(main_quit, main_set_locale, fileview_media_mounted, fileview_media_unmounted);
00099     menu_init();
00100     fileview_init();
00101 
00102     LOGPRINTF("gtk_rc_parse [%s]", rc_filename);
00103     gtk_rc_parse(rc_filename);
00104 
00105     fileview_create();
00106 
00107     // debug: mount "internal SD" when running on emulator
00108     char hostname[100];
00109     int rc = gethostname(hostname, sizeof(hostname));
00110     if (   rc == 0
00111         && strcmp(hostname, EMULATOR_HOSTNAME) == 0 )
00112     {
00113         WARNPRINTF("Emulator mode: mounting fake card");
00114         storage_media_mounted(DIR_LIBRARY);
00115     }
00116 
00117     g_idle_add(on_startup_complete, NULL);
00118     gdk_threads_enter();
00119     gtk_main();
00120     gdk_threads_leave();
00121 
00122     filemodel_quit();
00123 
00124     return 0;
00125 }

Here is the call graph for this function:

void main_quit ( void   ) 
void main_set_locale ( const char *  locale  ) 

Definition at line 52 of file ctb/src/main.c.

Referenced by main(), and on_changed_locale().

00053 {
00054     LOGPRINTF("entry: locale [%s]", locale);
00055 
00056     const char *old_locale = g_getenv("LANG");
00057     
00058     if (!old_locale || (strcmp(old_locale, locale) != 0))
00059     {
00060         LOGPRINTF("Locale has changed to %s", locale);
00061 
00062         // set locale in environment 
00063         g_setenv("LANG", locale, TRUE);
00064         setlocale(LC_ALL, "");
00065         
00066         // update text and refresh
00067         menu_set_text();
00068         fileview_update_screen_texts();
00069     }
00070 }

Here is the caller graph for this function:

static gboolean on_startup_complete ( gpointer  data  )  [static]

Definition at line 79 of file ctb/src/main.c.

References ipc_sys_startup_complete().

Referenced by main().

00080 {
00081     ipc_sys_startup_complete();
00082     return FALSE; // remove timer source
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* EMULATOR_HOSTNAME = "qemuarm" [static]

Definition at line 49 of file ctb/src/main.c.

Referenced by main().

const char* rc_filename = DATADIR "/" PACKAGE_NAME ".rc" [static]

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

Definition at line 47 of file ctb/src/main.c.

Referenced by main().

Generated by  doxygen 1.6.2-20100208