gchar * gedit_dirs_get_user_accels_file (void) { gchar *accels = NULL; #ifndef G_OS_WIN32 const gchar *envvar; const gchar *home; /* on linux accels are stored in .gnome2/accels * for historic reasons (backward compat with the * old libgnome that took care of saving them */ /* Support old libgnome env var */ envvar = g_getenv ("GNOME22_USER_DIR"); if (envvar != NULL) { accels = g_build_filename (envvar, "accels", "gedit", NULL); } else { home = g_get_home_dir (); if (home != NULL) { accels = g_build_filename (home, ".gnome2", "accels", "gedit", NULL); } } #else { gchar *config_dir = NULL; config_dir = gedit_dirs_get_user_config_dir (); accels = g_build_filename (config_dir, "accels", "gedit", NULL); g_free (config_dir); } #endif return accels; }
static void load_accels (void) { gchar *filename; filename = g_build_filename (gedit_dirs_get_user_config_dir (), "accels", NULL); if (filename != NULL) { gedit_debug_message (DEBUG_APP, "Loading keybindings from %s\n", filename); gtk_accel_map_load (filename); g_free (filename); } }
gchar * gedit_dirs_get_user_plugins_dir (void) { gchar *config_dir; gchar *plugin_dir; config_dir = gedit_dirs_get_user_config_dir (); plugin_dir = g_build_filename (config_dir, "plugins", NULL); g_free (config_dir); return plugin_dir; }
static gchar * get_print_settings_file (void) { const gchar *config_dir; gchar *settings = NULL; config_dir = gedit_dirs_get_user_config_dir (); if (config_dir != NULL) { settings = g_build_filename (config_dir, GEDIT_PRINT_SETTINGS_FILE, NULL); } return settings; }
static gchar * get_page_setup_file (void) { const gchar *config_dir; gchar *setup = NULL; config_dir = gedit_dirs_get_user_config_dir (); if (config_dir != NULL) { setup = g_build_filename (config_dir, GEDIT_PAGE_SETUP_FILE, NULL); } return setup; }
static gboolean ensure_user_config_dir (void) { const gchar *config_dir; gboolean ret = TRUE; gint res; config_dir = gedit_dirs_get_user_config_dir (); if (config_dir == NULL) { g_warning ("Could not get config directory\n"); return FALSE; } res = g_mkdir_with_parents (config_dir, 0755); if (res < 0) { g_warning ("Could not create config directory\n"); ret = FALSE; } return ret; }