summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt36
-rw-r--r--NEWS1
-rw-r--r--Win32Depends.cmake4
-rw-r--r--config.h.in1
-rw-r--r--share/org.logdiag.gschema.xml17
-rw-r--r--src/ld-window-main.c15
-rw-r--r--src/logdiag.c9
7 files changed, 80 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 151e000..2c8a144 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,7 +256,40 @@ if (GTK_DOC_FOUND)
HTML ${project_DOC_DIR}/html)
endif (GTK_DOC_FOUND)
+# GSettings
+find_program (GLIB_COMPILE_SCHEMAS_EXECUTABLE glib-compile-schemas)
+if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
+ message (FATAL_ERROR "glib-compile-schemas not found")
+endif (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
+
+set (GSETTINGS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/share")
+set (GSETTINGS_SCHEMAS "${GSETTINGS_DIR}/org.logdiag.gschema.xml")
+
+add_custom_target (logdiag_gschema_check
+ COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} --dry-run "${GSETTINGS_DIR}"
+ DEPENDS "${GSETTINGS_SCHEMAS}"
+ COMMENT "Checking GSettings schema files" VERBATIM)
+
+if (OPTION_NOINSTALL)
+ set (GSETTINGS_COMPILED_SCHEMA "${CMAKE_CURRENT_BINARY_DIR}/gschemas.compiled")
+
+ add_custom_command (OUTPUT "${GSETTINGS_COMPILED_SCHEMA}"
+ COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
+ "--targetdir=${CMAKE_CURRENT_BINARY_DIR}" "${GSETTINGS_DIR}"
+ DEPENDS "${GSETTINGS_SCHEMAS}"
+ COMMENT "Compiling GSettings schema files" VERBATIM)
+ add_custom_target (logdiag_gschema ALL DEPENDS "${GSETTINGS_COMPILED_SCHEMA}")
+endif (OPTION_NOINSTALL)
+
# Installation
+install (FILES ${GSETTINGS_SCHEMAS}
+ DESTINATION share/glib-2.0/schemas)
+install (CODE " # DESTDIR is not in use on Windows
+ if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")
+ execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE}
+ \"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\")
+ endif (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")")
+
install (DIRECTORY share/gui share/library
DESTINATION share/${CMAKE_PROJECT_NAME})
@@ -266,7 +299,8 @@ if (WIN32)
${WIN32_DEPENDS_PATH}/bin/
DESTINATION .
FILES_MATCHING PATTERN "*.dll"
- PATTERN "libgettext*" EXCLUDE)
+ PATTERN "libgettext*" EXCLUDE
+ PATTERN "libintl*" EXCLUDE)
install (DIRECTORY
${WIN32_DEPENDS_PATH}/etc/
DESTINATION etc)
diff --git a/NEWS b/NEWS
index 58f9ef2..45ed6f7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
Version TBD
- Added scrolling using the middle mouse button.
+ - View menu settings are remembered.
- Fixed command line parsing on Windows,
it's not limited to the system ANSI codepage anymore.
- Fixed checking for the shift key when selecting.
diff --git a/Win32Depends.cmake b/Win32Depends.cmake
index c128950..c2baea3 100644
--- a/Win32Depends.cmake
+++ b/Win32Depends.cmake
@@ -67,8 +67,8 @@ set (pkg_mingw_lua_md5
set (pkg_opensuse_root "http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_11.4/noarch/")
set (pkg_opensuse_listing "${working_dir}/opensuse-listing")
set (pkg_opensuse_names
- "mingw32-libjson-glib"
- "mingw32-json-glib-devel")
+ "mingw32-libjson-glib" "mingw32-json-glib-devel"
+ "mingw32-glib2-tools" "mingw32-libintl")
set (pkg_opensuse_strip "usr/i686-w64-mingw32/sys-root/mingw")
# Stage 1: retrieve openSUSE package links
diff --git a/config.h.in b/config.h.in
index 0cc98c6..665ddec 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,6 +15,7 @@
#if ${OPTION_NOINSTALL}
/* For developers. */
#define PROJECT_SHARE_DIR "${CMAKE_SOURCE_DIR}/share/"
+ #define PROJECT_GSETTINGS_DIR "${CMAKE_BINARY_DIR}"
#elif defined (_WIN32)
#define PROJECT_SHARE_DIR "share/${PROJECT_NAME}/"
#else
diff --git a/share/org.logdiag.gschema.xml b/share/org.logdiag.gschema.xml
new file mode 100644
index 0000000..515e0b8
--- /dev/null
+++ b/share/org.logdiag.gschema.xml
@@ -0,0 +1,17 @@
+<schemalist>
+ <schema id="org.logdiag" path="/apps/logdiag/" gettext-domain="logdiag">
+ <key name="show-main-toolbar" type="b">
+ <default>true</default>
+ <summary>Whether to show the main toolbar</summary>
+ </key>
+ <key name="show-library-toolbar" type="b">
+ <default>true</default>
+ <summary>Whether to show the library toolbar</summary>
+ </key>
+ <key name="show-grid" type="b">
+ <default>true</default>
+ <summary>Whether to show the grid</summary>
+ </key>
+ </schema>
+</schemalist>
+
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 3602edb..22278ab 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -18,6 +18,7 @@
struct _LdWindowMainPrivate
{
+ GSettings *settings;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
@@ -353,6 +354,19 @@ ld_window_main_init (LdWindowMain *self)
/* Realize the window. */
gtk_widget_show_all (GTK_WIDGET (self));
+
+ /* Set up GSettings. */
+ priv->settings = g_settings_new ("org." PROJECT_NAME);
+
+ g_settings_bind (priv->settings, "show-main-toolbar",
+ gtk_action_group_get_action (priv->action_group,
+ "MainToolbar"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (priv->settings, "show-library-toolbar",
+ gtk_action_group_get_action (priv->action_group,
+ "LibraryToolbar"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (priv->settings, "show-grid",
+ gtk_action_group_get_action (priv->action_group,
+ "ShowGrid"), "active", G_SETTINGS_BIND_DEFAULT);
}
static void
@@ -369,6 +383,7 @@ ld_window_main_finalize (GObject *gobject)
g_object_unref (self->priv->diagram);
g_object_unref (self->priv->ui_manager);
g_object_unref (self->priv->action_group);
+ g_object_unref (self->priv->settings);
if (self->priv->filename)
g_free (self->priv->filename);
diff --git a/src/logdiag.c b/src/logdiag.c
index 1175ec6..904514e 100644
--- a/src/logdiag.c
+++ b/src/logdiag.c
@@ -131,6 +131,15 @@ main (int argc, char *argv[])
}
#endif
+#ifdef PROJECT_GSETTINGS_DIR
+ /* This is enabled when the build is set up for developing, so the
+ * application can find it's schema. It might also find use when
+ * installing the application into a location that's missing from
+ * g_get_system_data_dirs(), for example /usr/local or ~/.local.
+ */
+ g_setenv ("GSETTINGS_SCHEMA_DIR", PROJECT_GSETTINGS_DIR, 0);
+#endif /* PROJECT_GSETTINGS_DIR */
+
gtk_window_set_default_icon_name (PROJECT_NAME);
/* TODO: Be able to open multiple files. */