bool zathura_init(zathura_t* zathura) { if (zathura == NULL) { return false; } /* create zathura (config/data) directory */ create_directories(zathura); /* load plugins */ zathura_plugin_manager_load(zathura->plugins.manager); /* configuration */ config_load_default(zathura); config_load_files(zathura); /* UI */ if (!init_ui(zathura)) { goto error_free; } /* database */ init_database(zathura); /* bookmarks */ zathura->bookmarks.bookmarks = girara_sorted_list_new2( (girara_compare_function_t)zathura_bookmarks_compare, (girara_free_function_t)zathura_bookmark_free); /* jumplist */ init_jumplist(zathura); /* CSS for index mode */ init_css(zathura); /* Shortcut helpers */ init_shortcut_helpers(zathura); /* Start D-Bus service */ bool dbus = true; girara_setting_get(zathura->ui.session, "dbus-service", &dbus); if (dbus == true) { zathura->dbus = zathura_dbus_new(zathura); } return true; error_free: if (zathura->ui.page_widget != NULL) { g_object_unref(zathura->ui.page_widget); } return false; }
HRESULT setup_jumplist(wstring appid, int n, wstring titles[], wstring cmds[], wstring icons[], int ii[]) { OSVERSIONINFO ver; ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&ver); //printf("setup_jumplist\n"); // if running under the machine older than Windows 7, silently return. if (!((ver.dwMajorVersion == 6 && ver.dwMinorVersion >= 1) || ver.dwMajorVersion >= 7)) { return S_OK; } HRESULT hr = S_OK; hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(hr)) return hr; hr = clear_jumplist(); hr = S_OK; if (SUCCEEDED(hr)) { IObjectCollection * pobjs = init_jumplist(); //printf("setup_jumplist items %p\n", pobjs); if (pobjs) { for (int i = 0; i < n; ++i) { hr = register_task(pobjs, titles[i], cmds[i], icons[i], ii[i]); if (FAILED(hr)) { break; } } if (SUCCEEDED(hr)) hr = create_jumplist(appid, pobjs); pobjs->lpVtbl->Release((void *)pobjs); } } CoUninitialize(); return hr; }