maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   how to determin current enabled theme in c++? (https://talk.maemo.org/showthread.php?t=54600)

jamie721 2010-05-30 22:12

how to determin current enabled theme in c++?
 
Is there a gconf key or a file which i can read to determine which theme is enabled ?

qwerty12 2010-05-30 23:52

Re: how to determin current enabled theme in c++?
 
PHP Code:

/* gcc pimp.c $(pkg-config --cflags --libs glib-2.0) */

#include <glib.h>

int main (void)
{
        
gchar *link_dest, *themedirname;
        
gchar *index_filename;
        
gchar *theme_name;
        
GKeyFile *keyfile;

        
link_dest g_file_read_link ("/etc/hildon/theme"NULL);
        
g_assert (link_dest);

        
themedirname g_path_get_basename (link_dest);
        
g_print ("Theme dirname: %s\n"themedirname);
        
g_free (themedirname);
        
g_free (link_dest);

        
index_filename g_build_filename (G_DIR_SEPARATOR_S "etc""hildon""theme""index.theme"NULL);
    
keyfile g_key_file_new ();
        
g_assert (g_key_file_load_from_file (keyfileindex_filenameG_KEY_FILE_NONENULL));
    
theme_name g_key_file_get_string (keyfile"Desktop Entry""Name"NULL);
        
g_print ("Theme name: %s\n"theme_name theme_name "bollocks");
        
g_free (theme_name);
    
g_key_file_free (keyfile);

        return 
0;


It's not what you asked for, but maybe you'll be able to figure out the equivalent in Qt (GTK has the gtk-theme-name property in the GtkSettings object; maybe Qt has something similar).

jamie721 2010-05-31 00:24

Re: how to determin current enabled theme in c++?
 
So what i can take from that is etc/hildon/theme/index.theme is some type of link to the current theme loaded. So i basically have to work out a way to extract it from there or use it. Ok thank you very much had a feeling it would be in etc or a gconf setting.

cheers for taking your time to show me that it was very informative.


All times are GMT. The time now is 12:04.

vBulletin® Version 3.8.8