summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2012-10-09 06:36:29 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2012-10-09 06:40:16 +0200
commitda3e53215bee00779c75e338f25e568f26feba8f (patch)
tree0b0b9548d77788d3e6ab833ff21cbc529bccc78a /src
parent295c18ae47de0e42ff6a2011a6eccedcec3216ec (diff)
downloadlogdiag-da3e53215bee00779c75e338f25e568f26feba8f.tar.gz
logdiag-da3e53215bee00779c75e338f25e568f26feba8f.tar.xz
logdiag-da3e53215bee00779c75e338f25e568f26feba8f.zip
Load symbols from user XDG_DATA_HOME, too.
Diffstat (limited to 'src')
-rw-r--r--src/ld-window-main.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 21e9ee8..a12655c 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -51,6 +51,7 @@ struct _LdWindowMainPrivate
/* ===== Local functions =================================================== */
static void ld_window_main_finalize (GObject *gobject);
+static void load_library_directories (LdLibrary *library);
static void on_ui_proxy_connected (GtkUIManager *ui, GtkAction *action,
GtkWidget *proxy, LdWindowMain *window);
@@ -335,7 +336,7 @@ ld_window_main_init (LdWindowMain *self)
G_CALLBACK (on_diagram_selection_changed), self);
priv->library = ld_library_new ();
- ld_library_load (priv->library, PROJECT_SHARE_DIR "library");
+ load_library_directories (priv->library);
ld_diagram_view_set_diagram (priv->view, priv->diagram);
ld_diagram_view_set_library (priv->view, priv->library);
@@ -404,6 +405,32 @@ ld_window_main_finalize (GObject *gobject)
G_OBJECT_CLASS (ld_window_main_parent_class)->finalize (gobject);
}
+static void
+load_library_directories (LdLibrary *library)
+{
+ GFile *file_program, *file_user;
+ const gchar *program_dir;
+ gchar *user_dir;
+
+ program_dir = PROJECT_SHARE_DIR "library";
+ user_dir = g_build_filename (g_get_user_data_dir (),
+ PROJECT_NAME, "library", NULL);
+
+ file_program = g_file_new_for_path (program_dir);
+ file_user = g_file_new_for_path (user_dir);
+
+ ld_library_load (library, program_dir);
+
+ /* Don't try to load the same directory twice. */
+ if (!g_file_equal (file_program, file_user))
+ ld_library_load (library, user_dir);
+
+ g_object_unref (file_user);
+ g_object_unref (file_program);
+
+ g_free (user_dir);
+}
+
/*
* on_delete:
*