GList * rb_get_plugin_paths (void) { GList *paths; char *path; paths = NULL; if (!eel_gconf_get_boolean (CONF_PLUGIN_DISABLE_USER)) { /* deprecated path, should be removed some time in the future */ path = g_build_filename (rb_dot_dir (), "plugins", NULL); paths = g_list_prepend (paths, path); path = g_build_filename (rb_user_data_dir (), "plugins", NULL); paths = g_list_prepend (paths, path); } #ifdef USE_UNINSTALLED_DIRS path = g_build_filename (UNINSTALLED_PLUGINS_LOCATION, NULL); paths = g_list_prepend (paths, path); path = g_build_filename ("..", UNINSTALLED_PLUGINS_LOCATION, NULL); paths = g_list_prepend (paths, path); #endif path = g_strdup (RB_PLUGIN_DIR); paths = g_list_prepend (paths, path); paths = g_list_reverse (paths); return paths; }
static char * rb_find_user_file (const char *dir, const char *name, GError **error) { GError *temp_err = NULL; char *srcpath; char *destpath; GFile *src; GFile *dest; char *use_path; /* if the file exists in the target dir, return the path */ destpath = g_build_filename (dir, name, NULL); dest = g_file_new_for_path (destpath); if (g_file_query_exists (dest, NULL) == TRUE) { g_object_unref (dest); rb_debug ("found user dir path for '%s': %s", name, destpath); return destpath; } /* doesn't exist in the target dir, so try to move it from the .gnome2 dir */ srcpath = g_build_filename (rb_dot_dir (), name, NULL); src = g_file_new_for_path (srcpath); if (g_file_query_exists (src, NULL)) { g_file_move (src, dest, G_FILE_COPY_NONE, NULL, NULL, NULL, &temp_err); if (temp_err != NULL) { rb_debug ("failed to move user file '%s' from .gnome2 dir, returning .gnome2 path %s: %s", name, srcpath, temp_err->message); use_path = g_file_get_path (src); g_set_error (error, temp_err->domain, temp_err->code, _("Unable to move %s to %s: %s"), srcpath, destpath, temp_err->message); g_error_free (temp_err); } else { rb_debug ("moved user file '%s' from .gnome2 dir, returning user dir path %s", name, destpath); use_path = g_file_get_path (dest); } } else { rb_debug ("no existing file for '%s', returning user dir path %s", name, destpath); use_path = g_file_get_path (dest); } g_free (srcpath); g_free (destpath); g_object_unref (src); g_object_unref (dest); return use_path; }
/** * rb_stock_icons_init: * * Initializes the stock icons, adding the necessary filesystem * locations to the GTK icon search path. Must be called on startup. */ void rb_stock_icons_init (void) { GtkIconTheme *theme = gtk_icon_theme_get_default (); int i; int icon_size; char *dot_icon_dir; /* add our icon search paths. the rb_dot_dir() path is deprecated * and should be removed at some point. */ dot_icon_dir = g_build_filename (rb_dot_dir (), "icons", NULL); gtk_icon_theme_append_search_path (theme, dot_icon_dir); g_free (dot_icon_dir); dot_icon_dir = g_build_filename (rb_user_data_dir (), "icons", NULL); gtk_icon_theme_append_search_path (theme, dot_icon_dir); g_free (dot_icon_dir); gtk_icon_theme_append_search_path (theme, SHARE_DIR G_DIR_SEPARATOR_S "icons"); #ifdef USE_UNINSTALLED_DIRS gtk_icon_theme_append_search_path (theme, SHARE_UNINSTALLED_DIR G_DIR_SEPARATOR_S "icons"); #endif /* add inline icons */ gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL); for (i = 0; i < (int) G_N_ELEMENTS (inline_icons); i++) { GdkPixbuf *pixbuf; pixbuf = gdk_pixbuf_new_from_inline (-1, inline_icons[i].data, FALSE, NULL); g_assert (pixbuf); gtk_icon_theme_add_builtin_icon (inline_icons[i].name, icon_size, pixbuf); } }