void ob_debug_startup(void) { ObtPaths *p = obt_paths_new(); gchar *dir = g_build_filename(obt_paths_cache_home(p), "openbox", NULL); /* log messages to a log file! fancy, no? */ if (!obt_paths_mkdir_path(dir, 0777)) g_message(_("Unable to make directory '%s': %s"), dir, g_strerror(errno)); else { gchar *name = g_build_filename(obt_paths_cache_home(p), "openbox", "openbox.log", NULL); /* unlink it before opening to remove competition */ unlink(name); log_file = fopen(name, "w"); g_free(name); } rr_handler_id = g_log_set_handler("ObRender", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, log_handler, NULL); obt_handler_id = g_log_set_handler("Obt", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, log_handler, NULL); ob_handler_id = g_log_set_handler("Openbox", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, log_handler, NULL); ob_handler_prompt_id = g_log_set_handler("Openbox", G_LOG_LEVEL_MASK & ~G_LOG_LEVEL_DEBUG, prompt_handler, NULL); obt_paths_unref(p); g_free(dir); }
void session_startup(gint argc, gchar **argv) { gchar *dir; ObtPaths *p; if (!ob_sm_use) return; sm_argc = argc; sm_argv = argv; p = obt_paths_new(); dir = g_build_filename(obt_paths_cache_home(p), "openbox", "sessions", NULL); obt_paths_unref(p), p = NULL; if (!obt_paths_mkdir_path(dir, 0700)) { g_message(_("Unable to make directory \"%s\": %s"), dir, g_strerror(errno)); } if (ob_sm_save_file != NULL) { if (ob_sm_restore) { ob_debug_type(OB_DEBUG_SM, "Loading from session file %s", ob_sm_save_file); session_load_file(ob_sm_save_file); } } else { gchar *filename; /* this algo is from metacity */ filename = g_strdup_printf("%u-%u-%u.obs", (guint)time(NULL), (guint)getpid(), g_random_int()); ob_sm_save_file = g_build_filename(dir, filename, NULL); g_free(filename); } if (session_connect()) { session_setup_program(); session_setup_user(); session_setup_restart_style(TRUE); session_setup_pid(); session_setup_priority(); session_setup_clone_command(); } g_free(dir); }
./linktest exit #endif /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- linktest.c for the Openbox window manager Copyright (c) 2010 Dana Jansens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. See the COPYING file for a copy of the GNU General Public License. */ #include "obt/linkbase.h" #include "obt/paths.h" #include <glib.h> #include <locale.h> gint main() { ObtLinkBase *base; ObtPaths *paths; GMainLoop *loop; paths = obt_paths_new(); base = obt_linkbase_new(paths, setlocale(LC_MESSAGES, "")); printf("done\n"); return 0; loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); return 0; }