/* compile with
 * gcc -g -Wall `pkg-config --cflags gio-2.0` `pkg-config --libs gio-2.0`
 */

#include <gio/gio.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
    GAppInfo *app;
    
    g_type_init ();
    
    app = g_app_info_get_default_for_type ("text/plain", FALSE);
    
    if (app) {
        printf("default for text/plain is %s\n", g_app_info_get_name (app));
        
        if (g_app_info_set_as_last_used_for_type (app, "text/plain", NULL)) {
            
            app = g_app_info_get_default_for_type ("text/plain", FALSE);
            if (app) {
                printf("after g_app_info_set_as_last_used_for_type\n");
                printf("default for text/plain is now %s\n",
                    g_app_info_get_name (app));
            }
        }
    }
    
    return 0;
}
