static void gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc) { gnomevfssrc->uri = NULL; gnomevfssrc->uri_name = NULL; gnomevfssrc->handle = NULL; gnomevfssrc->curoffset = 0; gnomevfssrc->seekable = FALSE; gnomevfssrc->iradio_mode = FALSE; gnomevfssrc->http_callbacks_pushed = FALSE; gnomevfssrc->iradio_name = NULL; gnomevfssrc->iradio_genre = NULL; gnomevfssrc->iradio_url = NULL; gnomevfssrc->iradio_title = NULL; g_static_mutex_lock (&count_lock); if (ref_count == 0) { /* gnome vfs engine init */ if (gnome_vfs_initialized () == FALSE) { gnome_vfs_init (); vfs_owner = TRUE; } } ref_count++; g_static_mutex_unlock (&count_lock); }
nsresult nsGnomeVFSProtocolHandler::Init() { #ifdef PR_LOGGING sGnomeVFSLog = PR_NewLogModule("gnomevfs"); #endif if (!gnome_vfs_initialized()) { if (!gnome_vfs_init()) { NS_WARNING("gnome_vfs_init failed"); return NS_ERROR_UNEXPECTED; } } nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); if (prefs) { InitSupportedProtocolsPref(prefs); prefs->AddObserver(MOZ_GNOMEVFS_SUPPORTED_PROTOCOLS, this, PR_FALSE); } return NS_OK; }
/** \return A new document just for you! \brief This function takes in a filename of a SVG document and turns it into a SPDocument. \param mod Module to use \param uri The path to the file (UTF-8) This function is really simple, it just calls sp_document_new... */ SPDocument * Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) { #ifdef WITH_GNOME_VFS if (!gnome_vfs_initialized() || gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) { // Use built-in loader instead of VFS for this return sp_document_new(uri, TRUE); } gchar * buffer = _load_uri(uri); if (buffer == NULL) { g_warning("Error: Could not open file '%s' with VFS\n", uri); return NULL; } SPDocument * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1); g_free(buffer); return doc; #else return sp_document_new (uri, TRUE); #endif }
static void gst_gnome_vfs_src_finalize (GObject * object) { GstGnomeVFSSrc *src = GST_GNOME_VFS_SRC (object); g_static_mutex_lock (&count_lock); ref_count--; if (ref_count == 0 && vfs_owner) { if (gnome_vfs_initialized () == TRUE) { gnome_vfs_shutdown (); } } g_static_mutex_unlock (&count_lock); if (src->uri) { gnome_vfs_uri_unref (src->uri); src->uri = NULL; } g_free (src->uri_name); src->uri_name = NULL; g_free (src->iradio_name); src->iradio_name = NULL; g_free (src->iradio_genre); src->iradio_genre = NULL; g_free (src->iradio_url); src->iradio_url = NULL; g_free (src->iradio_title); src->iradio_title = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); }
GSList* get_menu_data(gboolean show_search, gboolean show_run, gboolean show_places, gboolean show_logout, char* file_manager, char*logout) { /*FIXME... I'm leaking a bit of memory here */ Menu_list_item * dir_item; GSList* data = NULL; GMenuTree * menu_tree; const char * menu_file[] = {"gnomecc.menu", "preferences.menu", "settings.menu", NULL};// GMenuTreeDirectory *root; int i; if (!gnome_vfs_initialized()) gnome_vfs_init(); G_file_manager = file_manager; menu_tree = gmenu_tree_lookup("applications.menu", GMENU_TREE_FLAGS_NONE); if (menu_tree) { root = gmenu_tree_get_root_directory(menu_tree); if (root) { fill_er_up(root, &data); gmenu_tree_item_unref(root); } } data = g_slist_prepend(data, get_blank()); data = g_slist_append(data, get_separator()); menu_tree = gmenu_tree_lookup("gnomecc.menu", GMENU_TREE_FLAGS_NONE); if (menu_tree) { root = gmenu_tree_get_root_directory(menu_tree); if (root) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_DIRECTORY; dir_item->name = g_strdup("Control Centre"); dir_item->comment = g_strdup("Gnome Control Centre"); dir_item->null = NULL; dir_item->sublist = NULL; dir_item->icon = g_strdup("gnome-control-center"); data = g_slist_append(data, dir_item); fill_er_up(root, &dir_item->sublist); dir_item->sublist = g_slist_prepend(dir_item->sublist, get_blank()); dir_item->sublist = g_slist_append(dir_item->sublist, get_blank()); gmenu_tree_item_unref(root); } } menu_tree = gmenu_tree_lookup("settings.menu", GMENU_TREE_FLAGS_NONE); if (menu_tree) { root = gmenu_tree_get_root_directory(menu_tree); if (root) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_DIRECTORY; dir_item->name = g_strdup("Settings"); dir_item->comment = g_strdup("System Settings"); dir_item->sublist = NULL; dir_item->null = NULL; dir_item->icon = g_strdup("gnome-settings"); data = g_slist_append(data, dir_item); fill_er_up(root, &dir_item->sublist); dir_item->sublist = g_slist_prepend(dir_item->sublist, get_blank()); dir_item->sublist = g_slist_append(dir_item->sublist, get_blank()); gmenu_tree_item_unref(root); } } data = g_slist_append(data, get_separator()); if (show_places) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_DIRECTORY; dir_item->name = g_strdup("Places"); dir_item->icon = g_strdup("bookmark"); dir_item->comment = g_strdup("Your special places :-)"); dir_item->sublist = NULL; dir_item->monitor = monitor_places; data = g_slist_append(data, dir_item); update_places(&dir_item->sublist, file_manager); } if (show_search) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_SEARCH; dir_item->name = g_strdup("Find:"); dir_item->icon = g_strdup("stock_search"); dir_item->comment = g_strdup("Search"); dir_item->sublist = NULL; dir_item->search_entry = NULL; data = g_slist_append(data, dir_item); } if (show_run) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_RUN; dir_item->name = g_strdup("Run:"); dir_item->icon = g_strdup("exec"); dir_item->comment = g_strdup("Run a program"); dir_item->sublist = NULL; dir_item->search_entry = NULL; data = g_slist_append(data, dir_item); } if (show_logout) { dir_item = g_malloc(sizeof(Menu_list_item)); dir_item->item_type = MENU_ITEM_ENTRY; dir_item->name = g_strdup("Logout..."); dir_item->icon = g_strdup("gnome-logout"); dir_item->exec = g_strdup(logout); dir_item->desktop = g_strdup(""); dir_item->comment = g_strdup("Logout and related activities."); dir_item->sublist = NULL; data = g_slist_append(data, dir_item); } data = g_slist_append(data, get_blank()); return data; }
/** Application main. Initializes internationalization, libosso, app and appview. Calls user interface creation functions and gtk_main. Follows the component initialization order of osso-filemanager main. @param argc Number of command line arguments @param argv Command line arguments @return 0 if successful; otherwise error code */ int main(int argc, char *argv[]) { gboolean result; g_thread_init(NULL); dbus_g_thread_init(); gdk_threads_init(); mainThread = g_thread_self(); /* Allocate application data structures */ app_data = g_new0(AppData, 1); if (app_data == NULL) { OSSO_LOG_CRIT("Failed memory allocation: AppData"); exit(1); } /* there was no low memory ind from HW yet. */ app_data->low_memory = FALSE; app_data->app_ui_data = g_new0(AppUIData, 1); if (app_data->app_ui_data == NULL) { OSSO_LOG_CRIT("Failed memory allocation: AppUIData"); // free_app_data(); exit(1); } /* Add reference back to parent structure (AppData) */ app_data->app_ui_data->app_data = app_data; /* init comapp_system */ init_comapp_system(app_data); /* Initialize GnomeVFS */ result = gnome_vfs_init(); if (!result) { OSSO_LOG_CRIT("Failed initializing GnomeVFS"); return OSSO_ERROR; } /* Initialize GConf and read application configuration */ if (!init_settings(app_data)) { OSSO_LOG_CRIT("Failed initializing GConf"); return OSSO_ERROR; } if (!get_configuration(argc, argv, app_data)) { OSSO_LOG_CRIT("Failed reading configuration"); return OSSO_ERROR; } #ifdef ENABLE_NLS /* Initialize localization */ /* Gettext does not seem to work properly without the following function * call */ setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif /* ENABLE_NLS */ /* Initialize GTK */ //gtk_init(&argc, &argv); /* Initialize GTK+ and Hildon */ hildon_gtk_init(&argc, &argv); /* Create application UI */ ui_create_main_window(app_data); /* Initialize engine */ pdf_viewer_init(app_data->app_ui_data); app_data->app_ui_data->password_dialog = NULL; app_data->app_ui_data->replace_dialog = NULL; //hildon_gtk_window_take_screenshot(GTK_WINDOW(app_data->app_ui_data->app_view), TRUE); g_signal_connect(G_OBJECT(app_data->app_ui_data->app_view), "map-event", G_CALLBACK(game_get_screenshot), NULL); //prasanna GDK_THR_ENTER; gtk_main(); GDK_THR_LEAVE; if( !just_exit ) { g_debug( "Save configuration..." ); save_configuration(app_data); g_debug( "Deinit engine..." ); pdf_viewer_deinit(); g_debug( "Deinit compapp systems..." ); deinit_comapp_system(app_data); g_debug( "Deinit settings..." ); deinit_settings(); g_debug( "Deinit mime..." ); free_mime_filters(); free_application_mime_types(); g_debug( "Deinit gnomevfs..." ); if (gnome_vfs_initialized()) { gnome_vfs_shutdown(); } } /* Exit successfully, regardless of any errors */ g_debug( "Exit success" ); exit(EXIT_SUCCESS); }