const char *
nautilus_ui_string_get (const char *filename)
{
	static GHashTable *ui_cache = NULL;
	char *ui;
	char *path;

	if (ui_cache == NULL) {
		ui_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
		eel_debug_call_at_shutdown_with_data ((GFreeFunc)g_hash_table_destroy, ui_cache);
	}

	ui = g_hash_table_lookup (ui_cache, filename);
	if (ui == NULL) {
		path = nautilus_ui_file (filename);
		if (path == NULL || !g_file_get_contents (path, &ui, NULL, NULL)) {
			g_warning ("Unable to load ui file %s\n", filename); 
		} 
		g_free (path);
		g_hash_table_insert (ui_cache,
				     g_strdup (filename),
				     ui);
	}
	
	return ui;
}
static GHashTable *
get_types_table (void)
{
	static GHashTable *image_mime_types = NULL;
	GSList *format_list, *l;
	char **types;
	int i;

	if (image_mime_types == NULL) {
		image_mime_types =
			g_hash_table_new_full (g_str_hash, g_str_equal,
					       g_free, NULL);
		eel_debug_call_at_shutdown_with_data ((GFreeFunc)g_hash_table_destroy,
						      image_mime_types);

		format_list = gdk_pixbuf_get_formats ();
		for (l = format_list; l; l = l->next) {
			types = gdk_pixbuf_format_get_mime_types (l->data);

			for (i = 0; i < G_N_ELEMENTS (types); i++) {
				g_hash_table_insert (image_mime_types,
						     types [i],
						     GUINT_TO_POINTER (1));
			}

			g_free (types);
		}

		g_slist_free (format_list);
	}

	return image_mime_types;
}
GObject *
caja_signaller_get_current (void)
{
    static GObject *global_signaller = NULL;

    if (global_signaller == NULL)
    {
        global_signaller = g_object_new (caja_signaller_get_type (), NULL);
        eel_debug_call_at_shutdown_with_data (g_object_unref, global_signaller);
    }

    return global_signaller;
}
Exemple #4
0
void
eel_debug_call_at_shutdown (EelFunction function)
{
    eel_debug_call_at_shutdown_with_data ((GFreeFunc) function, NULL);
}