[planner: 2/61] Migrate to GSettings
- From: Mart Raudsepp <mraudsepp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [planner: 2/61] Migrate to GSettings
- Date: Sat, 12 Jun 2021 17:30:21 +0000 (UTC)
commit ad08ec89d1521601fc9c4be7d28198d8e6389fd0
Author: Yavor Doganov <yavor gnu org>
Date: Sat Oct 20 10:53:01 2018 +0300
Migrate to GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=691724
Mart: Adapted build system changes to meson
data/meson.build | 20 +-
data/meson_gconf.py | 28 ---
data/org.gnome.Planner.gschema.xml | 434 +++++++++++++++++++++++++++++++++++++
data/planner.convert | 170 +++++++++++++++
data/planner.schemas.in | 90 --------
meson.build | 4 +-
meson_post_install.sh | 2 +
po/POTFILES.in | 2 +-
src/planner-conf-gconf.c | 138 ++++++------
src/planner-conf.h | 21 +-
src/planner-gantt-chart.c | 18 +-
src/planner-gantt-view.c | 48 +---
src/planner-main.c | 76 +++++++
src/planner-msp-plugin.c | 15 +-
src/planner-print-dialog.c | 32 ++-
src/planner-resource-view.c | 44 +---
src/planner-task-tree.c | 2 +-
src/planner-task-view.c | 72 +-----
src/planner-usage-tree.c | 4 +-
src/planner-usage-view.c | 40 +---
src/planner-view.c | 62 +++---
src/planner-view.h | 6 +-
src/planner-window.c | 84 +++----
src/planner-xml-planner-plugin.c | 14 +-
24 files changed, 909 insertions(+), 517 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 1476d0bb..4be463f8 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -17,25 +17,17 @@ i18n.merge_file(
intltool_merge = find_program('intltool-merge')
intltool_cache = po_dir / '.intltool-merge-cache'
-intltool_schema_cmd = [intltool_merge, '-s', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
-gconfschemadir = planner_sysconfdir / 'gconf' / 'schemas'
-schema_file = 'planner.schemas'
-
-custom_target(
+schema_file = 'org.gnome.Planner.gschema.xml'
+install_data(
schema_file,
- input: schema_file + '.in',
- output: schema_file,
- command: intltool_schema_cmd,
- install: true,
- install_dir: gconfschemadir,
+ install_dir: planner_datadir / 'glib-2.0' / 'schemas',
)
-meson.add_install_script(
- 'meson_gconf.py',
- gconfschemadir,
- schema_file,
+install_data(
+ 'planner.convert',
+ install_dir: planner_datadir / 'GConf' / 'gsettings',
)
subdir('mime') # relies on intltool variables from above
diff --git a/data/org.gnome.Planner.gschema.xml b/data/org.gnome.Planner.gschema.xml
new file mode 100644
index 00000000..b1243627
--- /dev/null
+++ b/data/org.gnome.Planner.gschema.xml
@@ -0,0 +1,434 @@
+<schemalist gettext-domain="planner">
+ <schema id="org.gnome.Planner" path="/org/gnome/planner/">
+ <key name="last-dir" type="s">
+ <default>''</default>
+ </key>
+ <child name="views" schema="org.gnome.Planner.views"/>
+ <child name="ui" schema="org.gnome.Planner.ui"/>
+ <child name="plugins" schema="org.gnome.Planner.plugins"/>
+ </schema>
+ <schema id="org.gnome.Planner.views" path="/org/gnome/planner/views/">
+ <child name="gantt-view" schema="org.gnome.Planner.views.gantt-view"/>
+ <child name="task-view" schema="org.gnome.Planner.views.task-view"/>
+ <child name="resource-view" schema="org.gnome.Planner.views.resource-view"/>
+ <child name="resource-usage-view" schema="org.gnome.Planner.views.resource-usage-view"/>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view" path="/org/gnome/planner/views/gantt-view/">
+ <key name="highlight-critical-path" type="b">
+ <default>false</default>
+ <summary>Highlight critical path in Gantt view</summary>
+ <description>Whether to highlight the tasks along the cricital path in the Gantt view.</description>
+ </key>
+ <key name="display-nonstandard-days" type="b">
+ <default>false</default>
+ <summary>Display nonstandard days in Gantt view</summary>
+ <description>Whether to display nonstandard days in the Gantt view.</description>
+ </key>
+ <key name="print-enabled" type="b">
+ <default>true</default>
+ <summary>Print the Gantt view</summary>
+ <description>Whether printing of the Gantt view is enabled.</description>
+ </key>
+ <key name="show-guidelines" type="b">
+ <default>false</default>
+ </key>
+ <child name="assigned-to" schema="org.gnome.Planner.views.gantt-view.assigned-to"/>
+ <child name="complete" schema="org.gnome.Planner.views.gantt-view.complete"/>
+ <child name="cost" schema="org.gnome.Planner.views.gantt-view.cost"/>
+ <child name="duration" schema="org.gnome.Planner.views.gantt-view.duration"/>
+ <child name="finish" schema="org.gnome.Planner.views.gantt-view.finish"/>
+ <child name="name" schema="org.gnome.Planner.views.gantt-view.name"/>
+ <child name="slack" schema="org.gnome.Planner.views.gantt-view.slack"/>
+ <child name="start" schema="org.gnome.Planner.views.gantt-view.start"/>
+ <child name="wbs" schema="org.gnome.Planner.views.gantt-view.wbs"/>
+ <child name="work" schema="org.gnome.Planner.views.gantt-view.work"/>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.assigned-to"
path="/org/gnome/planner/views/gantt-view/assigned-to/">
+ <key name="order" type="i">
+ <default>8</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.complete"
path="/org/gnome/planner/views/gantt-view/complete/">
+ <key name="order" type="i">
+ <default>9</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.cost" path="/org/gnome/planner/views/gantt-view/cost/">
+ <key name="order" type="i">
+ <default>7</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.duration"
path="/org/gnome/planner/views/gantt-view/duration/">
+ <key name="order" type="i">
+ <default>5</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.finish" path="/org/gnome/planner/views/gantt-view/finish/">
+ <key name="order" type="i">
+ <default>3</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.name" path="/org/gnome/planner/views/gantt-view/name/">
+ <key name="order" type="i">
+ <default>1</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.slack" path="/org/gnome/planner/views/gantt-view/slack/">
+ <key name="order" type="i">
+ <default>6</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.start" path="/org/gnome/planner/views/gantt-view/start/">
+ <key name="order" type="i">
+ <default>2</default>
+ </key>
+ <key name="visible" type="b">
+ <default>false</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.wbs" path="/org/gnome/planner/views/gantt-view/wbs/">
+ <key name="order" type="i">
+ <default>0</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.gantt-view.work" path="/org/gnome/planner/views/gantt-view/work/">
+ <key name="order" type="i">
+ <default>4</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view" path="/org/gnome/planner/views/task-view/">
+ <key name="highlight-critical-path" type="b">
+ <default>false</default>
+ <summary>Highlight critical path in Task view</summary>
+ <description>Whether to highlight the tasks along the cricital path in the Task view.</description>
+ </key>
+ <key name="display-nonstandard-days" type="b">
+ <default>false</default>
+ <summary>Display nonstandard days in Task view</summary>
+ <description>Whether to display nonstandard days in the Task view.</description>
+ </key>
+ <key name="print-enabled" type="b">
+ <default>true</default>
+ <summary>Print the Task view</summary>
+ <description>Whether printing of the Task view is enabled.</description>
+ </key>
+ <child name="assigned-to" schema="org.gnome.Planner.views.task-view.assigned-to"/>
+ <child name="complete" schema="org.gnome.Planner.views.task-view.complete"/>
+ <child name="cost" schema="org.gnome.Planner.views.task-view.cost"/>
+ <child name="duration" schema="org.gnome.Planner.views.task-view.duration"/>
+ <child name="finish" schema="org.gnome.Planner.views.task-view.finish"/>
+ <child name="name" schema="org.gnome.Planner.views.task-view.name"/>
+ <child name="slack" schema="org.gnome.Planner.views.task-view.slack"/>
+ <child name="start" schema="org.gnome.Planner.views.task-view.start"/>
+ <child name="wbs" schema="org.gnome.Planner.views.task-view.wbs"/>
+ <child name="work" schema="org.gnome.Planner.views.task-view.work"/>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.assigned-to"
path="/org/gnome/planner/views/task-view/assigned-to/">
+ <key name="order" type="i">
+ <default>8</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.complete"
path="/org/gnome/planner/views/task-view/complete/">
+ <key name="order" type="i">
+ <default>9</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.cost" path="/org/gnome/planner/views/task-view/cost/">
+ <key name="order" type="i">
+ <default>7</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.duration"
path="/org/gnome/planner/views/task-view/duration/">
+ <key name="order" type="i">
+ <default>5</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.finish" path="/org/gnome/planner/views/task-view/finish/">
+ <key name="order" type="i">
+ <default>3</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.name" path="/org/gnome/planner/views/task-view/name/">
+ <key name="order" type="i">
+ <default>1</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.slack" path="/org/gnome/planner/views/task-view/slack/">
+ <key name="order" type="i">
+ <default>6</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.start" path="/org/gnome/planner/views/task-view/start/">
+ <key name="order" type="i">
+ <default>2</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.wbs" path="/org/gnome/planner/views/task-view/wbs/">
+ <key name="order" type="i">
+ <default>0</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.task-view.work" path="/org/gnome/planner/views/task-view/work/">
+ <key name="order" type="i">
+ <default>4</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view" path="/org/gnome/planner/views/resource-view/">
+ <key name="print-enabled" type="b">
+ <default>true</default>
+ <summary>Print the Resource view</summary>
+ <description>Whether printing of the Resource view is enabled.</description>
+ </key>
+ <child name="cost" schema="org.gnome.Planner.views.resource-view.cost"/>
+ <child name="email" schema="org.gnome.Planner.views.resource-view.email"/>
+ <child name="group" schema="org.gnome.Planner.views.resource-view.group"/>
+ <child name="name" schema="org.gnome.Planner.views.resource-view.name"/>
+ <child name="short-name" schema="org.gnome.Planner.views.resource-view.short-name"/>
+ <child name="type" schema="org.gnome.Planner.views.resource-view.type"/>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.cost"
path="/org/gnome/planner/views/resource-view/cost/">
+ <key name="order" type="i">
+ <default>5</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.email"
path="/org/gnome/planner/views/resource-view/email/">
+ <key name="order" type="i">
+ <default>4</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.group"
path="/org/gnome/planner/views/resource-view/group/">
+ <key name="order" type="i">
+ <default>3</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.name"
path="/org/gnome/planner/views/resource-view/name/">
+ <key name="order" type="i">
+ <default>0</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.short-name"
path="/org/gnome/planner/views/resource-view/short-name/">
+ <key name="order" type="i">
+ <default>1</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-view.type"
path="/org/gnome/planner/views/resource-view/type/">
+ <key name="order" type="i">
+ <default>2</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-usage-view"
path="/org/gnome/planner/views/resource-usage-view/">
+ <child name="resource-name" schema="org.gnome.Planner.views.resource-usage-view.resource-name"/>
+ <child name="task-name" schema="org.gnome.Planner.views.resource-usage-view.task-name"/>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-usage-view.resource-name"
path="/org/gnome/planner/views/resource-usage-view/resource-name/">
+ <key name="order" type="i">
+ <default>0</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.views.resource-usage-view.task-name"
path="/org/gnome/planner/views/resource-usage-view/task-name/">
+ <key name="order" type="i">
+ <default>1</default>
+ </key>
+ <key name="visible" type="b">
+ <default>true</default>
+ </key>
+ <key name="width" type="i">
+ <default>0</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.ui" path="/org/gnome/planner/ui/">
+ <key name="active-view" type="s">
+ <default>'gantt_view'</default>
+ <summary>The active view</summary>
+ <description>Which view to display in the user interface.</description>
+ </key>
+ <key name="main-window-height" type="i">
+ <default>550</default>
+ </key>
+ <key name="main-window-maximized" type="b">
+ <default>false</default>
+ </key>
+ <key name="main-window-position-x" type="i">
+ <default>0</default>
+ </key>
+ <key name="main-window-position-y" type="i">
+ <default>0</default>
+ </key>
+ <key name="main-window-width" type="i">
+ <default>800</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.plugins" path="/org/gnome/planner/plugins/">
+ <child name="msp-plugin" schema="org.gnome.Planner.plugins.msp-plugin"/>
+ <child name="xml-export" schema="org.gnome.Planner.plugins.xml-export"/>
+ </schema>
+ <schema id="org.gnome.Planner.plugins.msp-plugin" path="/org/gnome/planner/plugins/msp-plugin/">
+ <key name="last-dir" type="s">
+ <default>''</default>
+ </key>
+ </schema>
+ <schema id="org.gnome.Planner.plugins.xml-export" path="/org/gnome/planner/plugins/xml-export/">
+ <key name="last-dir" type="s">
+ <default>''</default>
+ </key>
+ </schema>
+</schemalist>
diff --git a/data/planner.convert b/data/planner.convert
new file mode 100644
index 00000000..3d0c4216
--- /dev/null
+++ b/data/planner.convert
@@ -0,0 +1,170 @@
+[org.gnome.Planner]
+last-dir = /apps/planner/general/last_dir
+
+[org.gnome.Planner.ui]
+active-view = /apps/planner/ui/active_view
+main-window-height = /apps/planner/ui/main_window_height
+main-window-maximized = /apps/planner/ui/main_window_maximized
+main-window-position-x = /apps/planner/ui/main_window_position_x
+main-window-position-y = /apps/planner/ui/main_window_position_y
+main-window-width = /apps/planner/ui/main_window_width
+
+[org.gnome.Planner.views.gantt-view]
+highlight-critical-path = /apps/planner/views/gantt_view/highlight_critical_path
+display-nonstandard-days = /apps/planner/views/gantt_view/display_nonstandard_days
+print-enabled = /apps/planner/views/gantt_view/print_enabled
+show-guidelines = /apps/planner/views/gantt_view/show_guidelines
+
+[org.gnome.Planner.views.task-view]
+highlight-critical-path = /apps/planner/views/task_view/highlight_critical_path
+display-nonstandard-days = /apps/planner/views/task_view/highlight_critical_path
+print-enabled = /apps/planner/views/task_view/print_enabled
+
+[org.gnome.Planner.views.resource-view]
+print-enabled = /apps/planner/views/resource_view/print_enabled
+
+[org.gnome.Planner.plugins.msp-plugin]
+last-dir = /apps/planner/plugins/msp_plugin/last_dir
+
+[org.gnome.Planner.plugins.xml-export]
+last-dir = /apps/planner/plugins/xml_export/last_dir
+
+[org.gnome.Planner.views.gantt-view.assigned-to]
+order = /apps/planner/gantt_view/columns/assigned_to/order
+visible = /apps/planner/gantt_view/columns/assigned_to/visible
+width = /apps/planner/gantt_view/columns/assigned_to/width
+
+[org.gnome.Planner.views.gantt-view.complete]
+order = /apps/planner/gantt_view/columns/complete/order
+visible = /apps/planner/gantt_view/columns/complete/visible
+width = /apps/planner/gantt_view/columns/complete/width
+
+[org.gnome.Planner.views.gantt-view.cost]
+order = /apps/planner/gantt_view/columns/cost/order
+visible = /apps/planner/gantt_view/columns/cost/visible
+width = /apps/planner/gantt_view/columns/cost/width
+
+[org.gnome.Planner.views.gantt-view.duration]
+order = /apps/planner/gantt_view/columns/duration/order
+visible = /apps/planner/gantt_view/columns/duration/visible
+width = /apps/planner/gantt_view/columns/duration/width
+
+[org.gnome.Planner.views.gantt-view.finish]
+order = /apps/planner/gantt_view/columns/finish/order
+visible = /apps/planner/gantt_view/columns/finish/visible
+width = /apps/planner/gantt_view/columns/finish/width
+
+[org.gnome.Planner.views.gantt-view.name]
+order = /apps/planner/gantt_view/columns/name/order
+visible = /apps/planner/gantt_view/columns/name/visible
+width = /apps/planner/gantt_view/columns/name/width
+
+[org.gnome.Planner.views.gantt-view.slack]
+order = /apps/planner/gantt_view/columns/slack/order
+visible = /apps/planner/gantt_view/columns/slack/visible
+width = /apps/planner/gantt_view/columns/slack/width
+
+[org.gnome.Planner.views.gantt-view.start]
+order = /apps/planner/gantt_view/columns/start/order
+visible = /apps/planner/gantt_view/columns/start/visible
+width = /apps/planner/gantt_view/columns/start/width
+
+[org.gnome.Planner.views.gantt-view.wbs]
+order = /apps/planner/gantt_view/columns/wbs/order
+visible = /apps/planner/gantt_view/columns/wbs/visible
+width = /apps/planner/gantt_view/columns/wbs/width
+
+[org.gnome.Planner.views.gantt-view.work]
+order = /apps/planner/gantt_view/columns/work/order
+visible = /apps/planner/gantt_view/columns/work/visible
+width = /apps/planner/gantt_view/columns/work/width
+
+[org.gnome.Planner.views.task-view.assigned-to]
+order = /apps/planner/task_view/columns/assigned_to/order
+visible = /apps/planner/task_view/columns/assigned_to/visible
+width = /apps/planner/task_view/columns/assigned_to/width
+
+[org.gnome.Planner.views.task-view.complete]
+order = /apps/planner/task_view/columns/complete/order
+visible = /apps/planner/task_view/columns/complete/visible
+width = /apps/planner/task_view/columns/complete/width
+
+[org.gnome.Planner.views.task-view.cost]
+order = /apps/planner/task_view/columns/cost/order
+visible = /apps/planner/task_view/columns/cost/visible
+width = /apps/planner/task_view/columns/cost/width
+
+[org.gnome.Planner.views.task-view.duration]
+order = /apps/planner/task_view/columns/duration/order
+visible = /apps/planner/task_view/columns/duration/visible
+width = /apps/planner/task_view/columns/duration/width
+
+[org.gnome.Planner.views.task-view.finish]
+order = /apps/planner/task_view/columns/finish/order
+visible = /apps/planner/task_view/columns/finish/visible
+width = /apps/planner/task_view/columns/finish/width
+
+[org.gnome.Planner.views.task-view.name]
+order = /apps/planner/task_view/columns/name/order
+visible = /apps/planner/task_view/columns/name/visible
+width = /apps/planner/task_view/columns/name/width
+
+[org.gnome.Planner.views.task-view.slack]
+order = /apps/planner/task_view/columns/slack/order
+visible = /apps/planner/task_view/columns/slack/visible
+width = /apps/planner/task_view/columns/slack/width
+
+[org.gnome.Planner.views.task-view.start]
+order = /apps/planner/task_view/columns/start/order
+visible = /apps/planner/task_view/columns/start/visible
+width = /apps/planner/task_view/columns/start/width
+
+[org.gnome.Planner.views.task-view.wbs]
+order = /apps/planner/task_view/columns/wbs/order
+visible = /apps/planner/task_view/columns/wbs/visible
+width = /apps/planner/task_view/columns/wbs/width
+
+[org.gnome.Planner.views.task-view.work]
+order = /apps/planner/task_view/columns/work/order
+visible = /apps/planner/task_view/columns/work/visible
+width = /apps/planner/task_view/columns/work/width
+
+[org.gnome.Planner.views.resource-view.cost]
+order = /apps/planner/resource_view/columns/cost/order
+visible = /apps/planner/resource_view/columns/cost/visible
+width = /apps/planner/resource_view/columns/cost/width
+
+[org.gnome.Planner.views.resource-view.email]
+order = /apps/planner/resource_view/columns/email/order
+visible = /apps/planner/resource_view/columns/email/visible
+width = /apps/planner/resource_view/columns/email/width
+
+[org.gnome.Planner.views.resource-view.group]
+order = /apps/planner/resource_view/columns/group/order
+visible = /apps/planner/resource_view/columns/group/visible
+width = /apps/planner/resource_view/columns/group/width
+
+[org.gnome.Planner.views.resource-view.name]
+order = /apps/planner/resource_view/columns/name/order
+visible = /apps/planner/resource_view/columns/name/visible
+width = /apps/planner/resource_view/columns/name/width
+
+[org.gnome.Planner.views.resource-view.short-name]
+order = /apps/planner/resource_view/columns/short_name/order
+visible = /apps/planner/resource_view/columns/short_name/visible
+width = /apps/planner/resource_view/columns/short_name/width
+
+[org.gnome.Planner.views.resource-view.type]
+order = /apps/planner/resource_view/columns/type/order
+visible = /apps/planner/resource_view/columns/type/visible
+width = /apps/planner/resource_view/columns/type/width
+
+[org.gnome.Planner.views.resource-usage-view.resource-name]
+order = /apps/planner/resource_usage_view/columns/resource_name/order
+visible = /apps/planner/resource_usage_view/columns/resource_name/visible
+width = /apps/planner/resource_usage_view/columns/resource_name/width
+
+[org.gnome.Planner.views.resource-usage-view.task-name]
+order = /apps/planner/resource_usage_view/columns/task_name/order
+visible = /apps/planner/resource_usage_view/columns/task_name/visible
+width = /apps/planner/resource_usage_view/columns/task_name/width
diff --git a/meson.build b/meson.build
index 9c24a7ff..9f3eb28d 100644
--- a/meson.build
+++ b/meson.build
@@ -46,10 +46,10 @@ eds_req = '>= 3.6'
glib_dep = dependency('glib-2.0', version: '>= 2.38.0')
gmodule_dep = dependency('gmodule-2.0')
gobject_dep = dependency('gobject-2.0')
+gio_dep = dependency('gobject-2.0')
gtk_dep = dependency('gtk+-2.0', version: '>= 2.24.0')
gnomecanvas_dep = dependency('libgnomecanvas-2.0', version: '>=2.10.0')
glade_dep = dependency('libglade-2.0', version: '>= 2.3.0')
-gconf_dep = dependency('gconf-2.0', version: '>= 2.10.0')
libxml_dep = dependency('libxml-2.0', version: '>= 2.6.27')
xslt_dep = dependency('libxslt', version: '>= 1.1.23')
exslt_dep = dependency('libexslt')
@@ -67,7 +67,7 @@ python_dep = python.dependency()
libeds_dep = dependency('libebook-1.2', version: eds_req, required: get_option('eds'))
libplanner_deps = [glib_dep, gmodule_dep, gobject_dep, libxml_dep, m_dep]
-planner_deps = [glib_dep, gobject_dep, gmodule_dep, gtk_dep, gnomecanvas_dep, glade_dep, gconf_dep]
+planner_deps = [glib_dep, gobject_dep, gmodule_dep, gio_dep, gtk_dep, gnomecanvas_dep, glade_dep]
subdir('po')
subdir('libplanner')
diff --git a/meson_post_install.sh b/meson_post_install.sh
index 117da7a3..2bd8a62e 100755
--- a/meson_post_install.sh
+++ b/meson_post_install.sh
@@ -6,6 +6,8 @@ if [ -z $MESON_INSTALL_PREFIX ]; then
fi
if [ -z $DESTDIR ]; then
+ echo 'Compiling gsettings schemas'
+ glib-compile-schemas "$MESON_INSTALL_PREFIX/share/glib-2.0/schemas"
echo 'Updating mime database'
update-mime-database "$MESON_INSTALL_PREFIX/share/mime"
echo 'Updating icon cache'
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 28641aff..92d85465 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -19,7 +19,7 @@ data/glade/task-input-dialog.glade
data/mime/planner.xml.in
data/planner.desktop.in
-data/planner.schemas.in
+data/org.gnome.Planner.gschema.xml
data/stylesheets/localizable.xml
libplanner/mrp-assignment.c
diff --git a/src/planner-conf-gconf.c b/src/planner-conf-gconf.c
index 0abf5f5c..fe6af6f1 100644
--- a/src/planner-conf-gconf.c
+++ b/src/planner-conf-gconf.c
@@ -19,141 +19,139 @@
*/
#include <config.h>
-#include <gconf/gconf-client.h>
+#include <gio/gio.h>
#include "planner-conf.h"
-#define GCONF_PREFIX "/apps/planner"
+GSettings *
+planner_conf_get_gsettings (const gchar *set)
+{
+ static GSettings *gen_settings = NULL;
+ static GSettings *ui_settings = NULL;
+ static GSettings *gantt_settings = NULL;
+ static GSettings *task_settings = NULL;
+ static GSettings *res_settings = NULL;
+ static GSettings *usage_settings = NULL;
+
+ if (!strcmp (set, "gen")) {
+ if (!gen_settings)
+ gen_settings = g_settings_new ("org.gnome.Planner");
+
+ return gen_settings;
+ }
-static GConfClient * conf_get_gconf_client (void);
-static gchar * conf_get_key (const gchar *key);
+ if (!strcmp (set, "ui")) {
+ if (!ui_settings)
+ ui_settings = g_settings_new ("org.gnome.Planner.ui");
-static GConfClient *
-conf_get_gconf_client (void)
-{
- static GConfClient *client = NULL;
+ return ui_settings;
+ }
- if (!client) {
- client = gconf_client_get_default ();
+ if (!strcmp (set, "gantt")) {
+ if (!gantt_settings)
+ gantt_settings = g_settings_new ("org.gnome.Planner.views.gantt-view");
+
+ return gantt_settings;
}
- return client;
-}
+ if (!strcmp (set, "task")) {
+ if (!task_settings)
+ task_settings = g_settings_new ("org.gnome.Planner.views.task-view");
-static gchar *
-conf_get_key (const gchar *key)
-{
- return g_strconcat (GCONF_PREFIX, key, NULL);
-}
+ return task_settings;
+ }
-gboolean
-planner_conf_dir_exists (const gchar *dir, GError **error)
-{
- GConfClient *client;
- gchar *full_dir;
- gboolean ret_val;
+ if (!strcmp (set, "res")) {
+ if (!res_settings)
+ res_settings = g_settings_new ("org.gnome.Planner.views.resource-view");
- client = conf_get_gconf_client ();
+ return res_settings;
+ }
- full_dir = conf_get_key (dir);
- ret_val = gconf_client_dir_exists (client, full_dir, error);
- g_free (full_dir);
+ if (!strcmp (set, "usage")) {
+ if (!usage_settings)
+ usage_settings = g_settings_new ("org.gnome.Planner.views.resource-usage-view");
- return ret_val;
+ return usage_settings;
+ }
+
+ return NULL;
}
gboolean
-planner_conf_get_bool (const gchar *key, GError **error)
+planner_conf_get_bool (const gchar *key, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gboolean ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_get_bool (client, full_key, error);
- g_free (full_key);
+ ret_val = g_settings_get_boolean (settings, key);
return ret_val;
}
gchar *
-planner_conf_get_string (const gchar *key, GError **error)
+planner_conf_get_string (const gchar *key, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gchar *ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_get_string (client, full_key, error);
- g_free (full_key);
+ ret_val = g_settings_get_string (settings, key);
return ret_val;
}
gint
-planner_conf_get_int (const gchar *key, GError **error)
+planner_conf_get_int (const gchar *key, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gint ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_get_int (client, full_key, error);
- g_free (full_key);
+ ret_val = g_settings_get_int (settings, key);
return ret_val;
}
gboolean
-planner_conf_set_bool (const gchar *key, gboolean value, GError **error)
+planner_conf_set_bool (const gchar *key, gboolean value, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gboolean ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_set_bool (client, full_key, value, error);
- g_free (full_key);
+ ret_val = g_settings_set_boolean (settings, key, value);
return ret_val;
}
gboolean
-planner_conf_set_string (const gchar *key, const gchar *value, GError **error)
+planner_conf_set_string (const gchar *key, const gchar *value, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gboolean ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_set_string (client, full_key, value, error);
- g_free (full_key);
+ ret_val = g_settings_set_string (settings, key, value);
return ret_val;
}
gboolean
-planner_conf_set_int (const gchar *key, gint value, GError **error)
+planner_conf_set_int (const gchar *key, gint value, const gchar *set)
{
- GConfClient *client;
- gchar *full_key;
+ GSettings *settings;
gboolean ret_val;
- client = conf_get_gconf_client ();
+ settings = planner_conf_get_gsettings (set);
- full_key = conf_get_key (key);
- ret_val = gconf_client_set_int (client, full_key, value, error);
- g_free (full_key);
+ ret_val = g_settings_set_int (settings, key, value);
return ret_val;
}
diff --git a/src/planner-conf.h b/src/planner-conf.h
index 92e6a47e..bc66a14f 100644
--- a/src/planner-conf.h
+++ b/src/planner-conf.h
@@ -21,24 +21,23 @@
#ifndef __PLANNER_CONF_H__
#define __PLANNER_CONF_H__
-gboolean planner_conf_dir_exists (const gchar *dir,
- GError **error);
-gboolean planner_conf_get_bool (const gchar *key,
- GError **error);
-gchar * planner_conf_get_string (const gchar *key,
- GError **error);
-gint planner_conf_get_int (const gchar *key,
- GError **error);
+GSettings * planner_conf_get_gsettings (const gchar *set);
+gboolean planner_conf_get_bool (const gchar *key,
+ const gchar *set);
+gchar * planner_conf_get_string (const gchar *key,
+ const gchar *set);
+gint planner_conf_get_int (const gchar *key,
+ const gchar *set);
gboolean planner_conf_set_bool (const gchar *key,
gboolean value,
- GError **error);
+ const gchar *set);
gboolean planner_conf_set_string (const gchar *key,
const gchar *value,
- GError **error);
+ const gchar *set);
gboolean planner_conf_set_int (const gchar *key,
gint value,
- GError **error);
+ const gchar *set);
#endif /* __PLANNER_CONF_H__ */
diff --git a/src/planner-gantt-chart.c b/src/planner-gantt-chart.c
index 289fd15a..68447544 100644
--- a/src/planner-gantt-chart.c
+++ b/src/planner-gantt-chart.c
@@ -53,9 +53,9 @@
/* Font width factor. */
static gdouble f = 1.0;
-#define CRITICAL_PATH_KEY "/views/gantt_view/highlight_critical_path"
-#define NOSTDDAYS_PATH_KEY "/views/gantt_view/display_nonstandard_days"
-#define GUIDELINES_PATH_KEY "/views/gantt_view/show_guidelines"
+#define CRITICAL_PATH_KEY "highlight-critical-path"
+#define NOSTDDAYS_PATH_KEY "display-nonstandard-days"
+#define GUIDELINES_PATH_KEY "show-guidelines"
typedef struct _TreeNode TreeNode;
@@ -390,10 +390,10 @@ gantt_chart_init (PlannerGanttChart *chart)
priv->relation_hash = g_hash_table_new (NULL, NULL);
priv->highlight_critical = planner_conf_get_bool (CRITICAL_PATH_KEY,
- NULL);
+ "gantt");
priv->nonstandard_days = planner_conf_get_bool (NOSTDDAYS_PATH_KEY,
- NULL);
- priv->guidelines = planner_conf_get_bool (GUIDELINES_PATH_KEY, NULL);
+ "gantt");
+ priv->guidelines = planner_conf_get_bool (GUIDELINES_PATH_KEY, "gantt");
g_object_set (G_OBJECT(chart->priv->background),
"show_guidelines",
@@ -1916,7 +1916,7 @@ planner_gantt_chart_set_highlight_critical_tasks (PlannerGanttChart *chart,
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
- planner_conf_set_bool (CRITICAL_PATH_KEY, state, NULL);
+ planner_conf_set_bool (CRITICAL_PATH_KEY, state, "gantt");
}
void
@@ -1942,7 +1942,7 @@ planner_gantt_chart_set_show_guidelines (PlannerGanttChart *chart,
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
- planner_conf_set_bool (GUIDELINES_PATH_KEY, state, NULL);
+ planner_conf_set_bool (GUIDELINES_PATH_KEY, state, "gantt");
}
gboolean
@@ -1979,7 +1979,7 @@ planner_gantt_chart_set_nonstandard_days (PlannerGanttChart *chart,
gtk_widget_queue_draw (GTK_WIDGET (priv->canvas));
- planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, NULL);
+ planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, "gantt");
}
gboolean
diff --git a/src/planner-gantt-view.c b/src/planner-gantt-view.c
index 8c839cd0..b9e3b560 100644
--- a/src/planner-gantt-view.c
+++ b/src/planner-gantt-view.c
@@ -1232,60 +1232,20 @@ gantt_view_save_columns (PlannerGanttView *view)
priv = view->priv;
- planner_view_column_save_helper (PLANNER_VIEW (view), GTK_TREE_VIEW (priv->tree));
+ planner_view_column_save_helper (PLANNER_VIEW (view),
+ GTK_TREE_VIEW (priv->tree), "gantt");
}
static void
gantt_view_load_columns (PlannerGanttView *view)
{
PlannerGanttViewPriv *priv;
- GList *columns, *l;
- GtkTreeViewColumn *column;
- const gchar *id;
- gint i;
priv = view->priv;
/* Load the columns. */
- planner_view_column_load_helper (PLANNER_VIEW (view), GTK_TREE_VIEW (priv->tree));
-
- /* Make things a bit more robust by setting defaults if we don't get any
- * visible columns. Should be done through a schema instead (but we'll
- * keep this since a lot of people get bad installations when installing
- * themselves).
- */
- columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (priv->tree));
- i = 0;
- for (l = columns; l; l = l->next) {
- if (gtk_tree_view_column_get_visible (l->data)) {
- i++;
- }
- }
-
- if (i == 0) {
- for (l = columns; l; l = l->next) {
- column = l->data;
-
- if (g_object_get_data (G_OBJECT (column), "custom")) {
- continue;
- }
-
- id = g_object_get_data (G_OBJECT (column), "id");
- if (!id) {
- continue;
- }
-
- if (strcmp (id, "wbs") == 0 ||
- strcmp (id, "name") == 0 ||
- strcmp (id, "work") == 0) {
- gtk_tree_view_column_set_visible (column, TRUE);
- } else {
- gtk_tree_view_column_set_visible (column, FALSE);
- }
- }
- }
-
- g_list_free (columns);
+ planner_view_column_load_helper (PLANNER_VIEW (view),
+ GTK_TREE_VIEW (priv->tree), "gantt");
}
PlannerView *
diff --git a/src/planner-main.c b/src/planner-main.c
index 18f196cd..ee07dece 100644
--- a/src/planner-main.c
+++ b/src/planner-main.c
@@ -46,11 +46,81 @@ static GOptionEntry options[] = {
{ NULL }
};
+static gchar *
+migrate_gconf_settings (const gchar *name)
+{
+ gboolean needed = TRUE;
+ GError *error = NULL;
+ GKeyFile *kf;
+ gchar **list;
+ gchar *msg = NULL;
+ gsize i, n;
+
+ kf = g_key_file_new ();
+
+ g_key_file_load_from_data_dirs (kf, "gsettings-data-convert",
+ NULL, G_KEY_FILE_NONE, NULL);
+ list = g_key_file_get_string_list (kf, "State", "converted", &n, NULL);
+
+ if (list) {
+ for (i = 0; i < n; i++)
+ if (!g_strcmp0 (list[i], name)) {
+ needed = FALSE;
+ break;
+ }
+
+ g_strfreev (list);
+ }
+
+ g_key_file_free (kf);
+
+ if (needed) {
+ g_spawn_command_line_sync ("gsettings-data-convert",
+ NULL, NULL, NULL, &error);
+ if (error) {
+ msg = g_strdup_printf (
+ _("Could not migrate old GConf settings: %s\n"
+ "Please make sure that GConf is installed "
+ "and the gsettings-data-convert tool is in "
+ "your PATH.\nAlternatively, ignore this "
+ "message and convert your old settings "
+ "manually."), error->message);
+ g_error_free (error);
+ } else {
+ msg = g_strdup (_("Old GConf settings were "
+ "migrated successfully."));
+
+ /* Allow some time for the GSettings backend
+ to record the changes, otherwise the
+ default values from the new schema might be
+ set. This timeout is still insufficient to
+ migrate all keys. */
+ sleep (1);
+ }
+ }
+
+ return msg;
+}
+
+static void
+show_migration_dialog (GtkWindow *window, gchar *msg)
+{
+ GtkWidget *dlg;
+
+ dlg = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
+ "%s", msg);
+ g_free (msg);
+ gtk_dialog_run (GTK_DIALOG (dlg));
+ gtk_widget_destroy (dlg);
+}
+
int
main (int argc, char **argv)
{
GtkWidget *main_window;
GError *error = NULL;
+ gchar *gconf_migration_msg = NULL;
gchar *filename;
gchar *locale_dir;
gint i;
@@ -78,6 +148,8 @@ main (int argc, char **argv)
/* Migrate configuration if necessary */
migrate_config_to_xdg_dir ();
+ gconf_migration_msg = migrate_gconf_settings ("planner.convert");
+
filename = mrp_paths_get_image_dir ("gnome-planner.png");
gtk_window_set_default_icon_from_file (filename, NULL);
g_free (filename);
@@ -95,6 +167,10 @@ main (int argc, char **argv)
application = planner_application_new ();
main_window = planner_application_new_window (application);
+ if (gconf_migration_msg)
+ show_migration_dialog (GTK_WINDOW (main_window),
+ gconf_migration_msg);
+
if ((geometry) && !gtk_window_parse_geometry (GTK_WINDOW (main_window), geometry))
g_warning(_("Invalid geometry string \"%s\"\n"), geometry);
diff --git a/src/planner-msp-plugin.c b/src/planner-msp-plugin.c
index 27c13e3a..42aff998 100644
--- a/src/planner-msp-plugin.c
+++ b/src/planner-msp-plugin.c
@@ -33,7 +33,9 @@
#include "planner-application.h"
#include "planner-plugin.h"
-#define CONF_MSP_PLUGIN_LAST_DIR "/plugins/msp_plugin/last_dir"
+#define SCHEMA "org.gnome.Planner.plugins.msp-plugin"
+
+static GSettings *settings;
struct _PlannerPluginPriv {
GtkActionGroup *actions;
@@ -175,8 +177,12 @@ msp_plugin_get_last_dir (PlannerPlugin *plugin)
{
gchar *dir;
- dir = planner_conf_get_string (CONF_MSP_PLUGIN_LAST_DIR, NULL);
- if (dir == NULL) {
+ if (!settings)
+ settings = g_settings_new (SCHEMA);
+
+ dir = g_settings_get_string (settings, "last-dir");
+ if (!dir[0]) {
+ g_free (dir);
dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
}
@@ -187,7 +193,8 @@ static void
msp_plugin_set_last_dir (PlannerPlugin *plugin,
const gchar *dir)
{
- planner_conf_set_string (CONF_MSP_PLUGIN_LAST_DIR, dir, NULL);
+ g_settings_set_string (settings, "last-dir", dir);
+ g_object_unref (settings);
}
static gchar *
diff --git a/src/planner-print-dialog.c b/src/planner-print-dialog.c
index b78a11ba..767cd326 100644
--- a/src/planner-print-dialog.c
+++ b/src/planner-print-dialog.c
@@ -276,10 +276,15 @@ print_dialog_create_page (PlannerWindow *window,
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (w), "view", l->data);
- str = g_strdup_printf ("/views/%s/print_enabled",
- planner_view_get_name (l->data));
- state = planner_conf_get_bool (str, NULL);
- g_free (str);
+ str = (gchar *) planner_view_get_name (l->data);
+ if (!strcmp (str, "gantt_view"))
+ state = planner_conf_get_bool ("print-enabled",
+ "gantt");
+ else if (!strcmp (str, "resource_view"))
+ state = planner_conf_get_bool ("print-enabled", "res");
+ else
+ state = planner_conf_get_bool ("print-enabled", "task");
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), state);
buttons = g_list_prepend (buttons, w);
@@ -300,7 +305,7 @@ planner_print_dialog_get_print_selection (GtkWidget *widget,
GList *buttons, *l;
GList *views = NULL;
PlannerView *view;
- gchar *str;
+ const gchar *str;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
@@ -322,10 +327,19 @@ planner_print_dialog_get_print_selection (GtkWidget *widget,
str = g_strdup_printf ("/views/%s/print_enabled",
planner_view_get_name (view));
- planner_conf_set_bool (str,
- gtk_toggle_button_get_active (button),
- NULL);
- g_free (str);
+ str = planner_view_get_name (view);
+ if (!strcmp (str, "gantt_view"))
+ planner_conf_set_bool ("print-enabled",
+ gtk_toggle_button_get_active (button),
+ "gantt");
+ else if (!strcmp (str, "resource_view"))
+ planner_conf_set_bool ("print-enabled",
+ gtk_toggle_button_get_active (button),
+ "res");
+ else
+ planner_conf_set_bool ("print-enabled",
+ gtk_toggle_button_get_active (button),
+ "task");
}
return views;
diff --git a/src/planner-resource-view.c b/src/planner-resource-view.c
index ec893656..3297b979 100644
--- a/src/planner-resource-view.c
+++ b/src/planner-resource-view.c
@@ -1233,7 +1233,7 @@ resource_view_setup_tree_view (PlannerView *view)
NULL, NULL);
g_object_set_data (G_OBJECT (col),
"data-func", resource_view_short_name_data_func);
- g_object_set_data (G_OBJECT (col), "id", "short_name");
+ g_object_set_data (G_OBJECT (col), "id", "short-name");
gtk_tree_view_append_column (tree_view, col);
g_signal_connect (col,
@@ -2435,55 +2435,21 @@ resource_view_save_columns (PlannerResourceView *view)
priv = view->priv;
planner_view_column_save_helper (PLANNER_VIEW (view),
- GTK_TREE_VIEW (priv->tree_view));
+ GTK_TREE_VIEW (priv->tree_view),
+ "res");
}
static void
resource_view_load_columns (PlannerResourceView *view)
{
PlannerResourceViewPriv *priv;
- GList *columns, *l;
- GtkTreeViewColumn *column;
- const gchar *id;
- gint i;
priv = view->priv;
/* Load the columns. */
planner_view_column_load_helper (PLANNER_VIEW (view),
- GTK_TREE_VIEW (priv->tree_view));
-
- /* Make things a bit more robust by setting defaults if we don't get any
- * visible columns. Should be done through a schema instead (but we'll
- * keep this since a lot of people get bad installations when installing
- * themselves).
- */
- columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (priv->tree_view));
- i = 0;
- for (l = columns; l; l = l->next) {
- if (gtk_tree_view_column_get_visible (l->data)) {
- i++;
- }
- }
-
- if (i == 0) {
- for (l = columns; l; l = l->next) {
- column = l->data;
-
- if (g_object_get_data (G_OBJECT (column), "custom")) {
- continue;
- }
-
- id = g_object_get_data (G_OBJECT (column), "id");
- if (!id) {
- continue;
- }
-
- gtk_tree_view_column_set_visible (column, TRUE);
- }
- }
-
- g_list_free (columns);
+ GTK_TREE_VIEW (priv->tree_view),
+ "res");
}
PlannerView *
diff --git a/src/planner-task-tree.c b/src/planner-task-tree.c
index 68be61ef..598fcba7 100644
--- a/src/planner-task-tree.c
+++ b/src/planner-task-tree.c
@@ -2541,7 +2541,7 @@ task_tree_add_column (PlannerTaskTree *tree,
NULL);
g_object_set_data (G_OBJECT (col),
"data-func", task_tree_assigned_to_data_func);
- g_object_set_data (G_OBJECT (col), "id", "assigned_to");
+ g_object_set_data (G_OBJECT (col), "id", "assigned-to");
break;
default:
diff --git a/src/planner-task-view.c b/src/planner-task-view.c
index df4d2fbe..d2ac262a 100644
--- a/src/planner-task-view.c
+++ b/src/planner-task-view.c
@@ -167,8 +167,8 @@ static const GtkToggleActionEntry toggle_entries[] = {
G_CALLBACK (task_view_nonstandard_days_cb), FALSE }
};
-#define CRITICAL_PATH_KEY "/views/task_view/highlight_critical_path"
-#define NOSTDDAYS_PATH_KEY "/views/task_view/display_nonstandard_days"
+#define CRITICAL_PATH_KEY "highlight-critical-path"
+#define NOSTDDAYS_PATH_KEY "display-nonstandard-days"
G_DEFINE_TYPE (PlannerTaskView, planner_task_view, PLANNER_TYPE_VIEW);
@@ -253,8 +253,8 @@ task_view_activate (PlannerView *view)
gtk_ui_manager_ensure_update (priv->ui_manager);
/* Set the initial UI state. */
- show_critical = planner_conf_get_bool (CRITICAL_PATH_KEY, NULL);
- show_nostd_days = planner_conf_get_bool (NOSTDDAYS_PATH_KEY, NULL);
+ show_critical = planner_conf_get_bool (CRITICAL_PATH_KEY, "task");
+ show_nostd_days = planner_conf_get_bool (NOSTDDAYS_PATH_KEY, "task");
planner_task_tree_set_highlight_critical (PLANNER_TASK_TREE (priv->tree),
show_critical);
planner_task_tree_set_nonstandard_days (PLANNER_TASK_TREE (priv->tree),
@@ -627,7 +627,7 @@ task_view_highlight_critical_cb (GtkAction *action,
PLANNER_TASK_TREE (priv->tree),
state);
- planner_conf_set_bool (CRITICAL_PATH_KEY, state, NULL);
+ planner_conf_set_bool (CRITICAL_PATH_KEY, state, "task");
}
static void
@@ -646,7 +646,7 @@ task_view_nonstandard_days_cb (GtkAction *action,
state);
- planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, NULL);
+ planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, "task");
}
static void
@@ -794,72 +794,20 @@ task_view_save_columns (PlannerView *view)
priv = PLANNER_TASK_VIEW (view)->priv;
- planner_view_column_save_helper (view, GTK_TREE_VIEW (priv->tree));
+ planner_view_column_save_helper (view, GTK_TREE_VIEW (priv->tree),
+ "task");
}
static void
task_view_load_columns (PlannerView *view)
{
PlannerTaskViewPriv *priv;
- GList *columns, *l;
- GtkTreeViewColumn *column;
- const gchar *id;
- gint i;
priv = PLANNER_TASK_VIEW (view)->priv;
/* Load the columns. */
- planner_view_column_load_helper (view, GTK_TREE_VIEW (priv->tree));
-
- /* Make things a bit more robust by setting defaults if we don't get any
- * visible columns. Should be done through a schema instead (but we'll
- * keep this since a lot of people get bad installations when installing
- * themselves).
- */
- columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (priv->tree));
- i = 0;
- for (l = columns; l; l = l->next) {
- if (gtk_tree_view_column_get_visible (l->data)) {
- i++;
- }
- }
-
- if (i == 0) {
- for (l = columns; l; l = l->next) {
- column = l->data;
-
- if (g_object_get_data (G_OBJECT (column), "custom")) {
- continue;
- }
-
- id = g_object_get_data (G_OBJECT (column), "id");
-
- g_print ("%s\n", id);
-
- if (!id) {
- continue;
- }
-
-
- if (strcmp (id, "wbs") == 0 ||
- strcmp (id, "name") == 0 ||
- strcmp (id, "start") == 0 ||
- strcmp (id, "finish") == 0 ||
- strcmp (id, "work") == 0 ||
- strcmp (id, "duration") == 0 ||
- strcmp (id, "duration") == 0 ||
- strcmp (id, "slack") == 0 ||
- strcmp (id, "cost") == 0 ||
- strcmp (id, "complete") == 0 ||
- strcmp (id, "assigned-to") == 0) {
- gtk_tree_view_column_set_visible (column, TRUE);
- } else {
- gtk_tree_view_column_set_visible (column, FALSE);
- }
- }
- }
-
- g_list_free (columns);
+ planner_view_column_load_helper (view, GTK_TREE_VIEW (priv->tree),
+ "task");
}
PlannerView *
diff --git a/src/planner-usage-tree.c b/src/planner-usage-tree.c
index 4afeff18..2e0736d8 100644
--- a/src/planner-usage-tree.c
+++ b/src/planner-usage-tree.c
@@ -322,7 +322,7 @@ usage_tree_add_column (GtkTreeView *tree, gint column, const gchar *title)
NULL, NULL);
g_object_set_data (G_OBJECT (col), "data-func",
usage_tree_resname_data_func);
- g_object_set_data (G_OBJECT (col), "id", "resource_name");
+ g_object_set_data (G_OBJECT (col), "id", "resource-name");
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 100);
gtk_tree_view_append_column (tree, col);
@@ -337,7 +337,7 @@ usage_tree_add_column (GtkTreeView *tree, gint column, const gchar *title)
NULL, NULL);
g_object_set_data (G_OBJECT (col), "data-func",
usage_tree_taskname_data_func);
- g_object_set_data (G_OBJECT (col), "id", "task_name");
+ g_object_set_data (G_OBJECT (col), "id", "task-name");
gtk_tree_view_column_set_resizable (col, TRUE);
gtk_tree_view_column_set_min_width (col, 100);
gtk_tree_view_append_column (tree, col);
diff --git a/src/planner-usage-view.c b/src/planner-usage-view.c
index 38a25f39..e85e2fa4 100644
--- a/src/planner-usage-view.c
+++ b/src/planner-usage-view.c
@@ -789,55 +789,19 @@ usage_view_save_columns (PlannerUsageView *view)
priv = view->priv;
planner_view_column_save_helper (PLANNER_VIEW (view),
- GTK_TREE_VIEW (priv->tree));
+ GTK_TREE_VIEW (priv->tree), "usage");
}
static void
usage_view_load_columns (PlannerUsageView *view)
{
PlannerUsageViewPriv *priv;
- GList *columns, *l;
- GtkTreeViewColumn *column;
- const gchar *id;
- gint i;
priv = view->priv;
/* Load the columns. */
planner_view_column_load_helper (PLANNER_VIEW (view),
- GTK_TREE_VIEW (priv->tree));
-
- /* Make things a bit more robust by setting defaults if we don't get any
- * visible columns. Should be done through a schema instead (but we'll
- * keep this since a lot of people get bad installations when installing
- * themselves).
- */
- columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (priv->tree));
- i = 0;
- for (l = columns; l; l = l->next) {
- if (gtk_tree_view_column_get_visible (l->data)) {
- i++;
- }
- }
-
- if (i == 0) {
- for (l = columns; l; l = l->next) {
- column = l->data;
-
- if (g_object_get_data (G_OBJECT (column), "custom")) {
- continue;
- }
-
- id = g_object_get_data (G_OBJECT (column), "id");
- if (!id) {
- continue;
- }
-
- gtk_tree_view_column_set_visible (column, TRUE);
- }
- }
-
- g_list_free (columns);
+ GTK_TREE_VIEW (priv->tree), "usage");
}
PlannerView *
diff --git a/src/planner-view.c b/src/planner-view.c
index ca35aeac..ecd406ad 100644
--- a/src/planner-view.c
+++ b/src/planner-view.c
@@ -197,12 +197,13 @@ column_sort_func (gconstpointer a,
void
planner_view_column_load_helper (PlannerView *view,
- GtkTreeView *tree)
+ GtkTreeView *tree,
+ const gchar *set)
{
GList *columns, *l;
+ GSettings *settings, *child;
GtkTreeViewColumn *column;
const gchar *id;
- gchar *key;
gboolean visible, order;
gint width;
@@ -219,26 +220,20 @@ planner_view_column_load_helper (PlannerView *view,
continue;
}
- key = g_strdup_printf ("/%s/columns/%s/visible",
- planner_view_get_name (view), id);
- visible = planner_conf_get_bool (key, NULL);
+ settings = planner_conf_get_gsettings (set);
+ child = g_settings_get_child (settings, id);
+
+ visible = g_settings_get_boolean (child, "visible");
gtk_tree_view_column_set_visible (column, visible);
- g_free (key);
- key = g_strdup_printf ("/%s/columns/%s/order",
- planner_view_get_name (view), id);
- order = planner_conf_get_int (key, NULL);
+ order = g_settings_get_int (child, "order");
g_object_set_data (G_OBJECT (column), "order", GINT_TO_POINTER (order));
- g_free (key);
- key = g_strdup_printf ("/%s/columns/%s/width",
- planner_view_get_name (view),
- id);
- width = planner_conf_get_int (key, NULL);
+ width = g_settings_get_int (child, "width");
if (width > 0) {
gtk_tree_view_column_set_fixed_width (column, width);
}
- g_free (key);
+ g_object_unref (child);
}
/* Sort the list of columns in the right order. */
@@ -257,12 +252,13 @@ planner_view_column_load_helper (PlannerView *view,
void
planner_view_column_save_helper (PlannerView *view,
- GtkTreeView *tree)
+ GtkTreeView *tree,
+ const gchar *set)
{
GList *columns, *l;
+ GSettings *settings, *child;
GtkTreeViewColumn *column;
const gchar *id;
- gchar *key;
gint i;
columns = gtk_tree_view_get_columns (tree);
@@ -278,24 +274,20 @@ planner_view_column_save_helper (PlannerView *view,
continue;
}
- key = g_strdup_printf ("/%s/columns/%s/visible",
- planner_view_get_name (view), id);
- planner_conf_set_bool (key,
- gtk_tree_view_column_get_visible (column),
- NULL);
- g_free (key);
-
- key = g_strdup_printf ("/%s/columns/%s/order",
- planner_view_get_name (view), id);
- planner_conf_set_int (key, i, NULL);
- g_free (key);
-
- key = g_strdup_printf ("/%s/columns/%s/width",
- planner_view_get_name (view), id);
- planner_conf_set_int (key,
- gtk_tree_view_column_get_width (column),
- NULL);
- g_free (key);
+ settings = planner_conf_get_gsettings (set);
+ child = g_settings_get_child (settings, id);
+ g_settings_delay (child);
+
+ g_settings_set_boolean (child, "visible",
+ gtk_tree_view_column_get_visible (column));
+
+ g_settings_set_int (child, "order", i);
+
+ g_settings_set_int (child, "width",
+ gtk_tree_view_column_get_width (column));
+
+ g_settings_apply (child);
+ g_object_unref (child);
}
g_list_free (columns);
diff --git a/src/planner-view.h b/src/planner-view.h
index 662312c7..78859e11 100644
--- a/src/planner-view.h
+++ b/src/planner-view.h
@@ -85,9 +85,11 @@ void planner_view_print (PlannerView *view,
gint page_nr);
void planner_view_print_cleanup (PlannerView *view);
void planner_view_column_load_helper (PlannerView *view,
- GtkTreeView *tree);
+ GtkTreeView *tree,
+ const gchar *set);
void planner_view_column_save_helper (PlannerView *view,
- GtkTreeView *tree);
+ GtkTreeView *tree,
+ const gchar *set);
#endif /* __PLANNER_VIEW_H__ */
diff --git a/src/planner-window.c b/src/planner-window.c
index 3276eb53..9212b8c0 100644
--- a/src/planner-window.c
+++ b/src/planner-window.c
@@ -192,17 +192,13 @@ static void window_connect_proxy_cb (GtkUIManager *manager,
GtkWidget *proxy,
PlannerWindow *window);
-#define CONF_WINDOW_DIR "/ui"
-#define CONF_WINDOW_MAXIMIZED "/ui/main_window_maximized"
-#define CONF_WINDOW_WIDTH "/ui/main_window_width"
-#define CONF_WINDOW_HEIGHT "/ui/main_window_height"
-#define CONF_WINDOW_POS_X "/ui/main_window_position_x"
-#define CONF_WINDOW_POS_Y "/ui/main_window_position_y"
-#define CONF_ACTIVE_VIEW "/ui/active_view"
-#define CONF_LAST_DIR "/general/last_dir"
-
-#define DEFAULT_WINDOW_WIDTH 800
-#define DEFAULT_WINDOW_HEIGHT 550
+#define CONF_WINDOW_MAXIMIZED "main-window-maximized"
+#define CONF_WINDOW_WIDTH "main-window-width"
+#define CONF_WINDOW_HEIGHT "main-window-height"
+#define CONF_WINDOW_POS_X "main-window-position-x"
+#define CONF_WINDOW_POS_Y "main-window-position-y"
+#define CONF_ACTIVE_VIEW "active-view"
+#define CONF_LAST_DIR "last-dir"
#define VIEW_PATH "/menu/View/Views placeholder"
#define VIEW_GROUP "view group"
@@ -727,7 +723,7 @@ window_populate (PlannerWindow *window)
/* Load plugins. */
priv->plugins = planner_plugin_loader_load (window);
- str = planner_conf_get_string (CONF_ACTIVE_VIEW, NULL);
+ str = planner_conf_get_string (CONF_ACTIVE_VIEW, "ui");
if (str) {
gboolean found;
@@ -798,7 +794,8 @@ window_view_selected (PlannerSidebar *sidebar,
priv->current_view = view;
- planner_conf_set_string (CONF_ACTIVE_VIEW, planner_view_get_name (view), NULL);
+ planner_conf_set_string (CONF_ACTIVE_VIEW,
+ planner_view_get_name (view), "ui");
}
static void
@@ -838,9 +835,10 @@ get_last_dir (PlannerWindow *window)
{
gchar *last_dir;
- last_dir = planner_conf_get_string (CONF_LAST_DIR, NULL);
+ last_dir = planner_conf_get_string (CONF_LAST_DIR, "gen");
- if (last_dir == NULL) {
+ if (!last_dir[0]) {
+ g_free (last_dir);
last_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
}
@@ -902,7 +900,7 @@ window_open_cb (GtkAction *action,
if (filename) {
last_dir = g_path_get_dirname (filename);
g_free (filename);
- planner_conf_set_string (CONF_LAST_DIR, last_dir, NULL);
+ planner_conf_set_string (CONF_LAST_DIR, last_dir, "gen");
g_free (last_dir);
}
}
@@ -1572,7 +1570,7 @@ window_do_save_as (PlannerWindow *window)
}
last_dir = g_path_get_dirname (filename);
- planner_conf_set_string (CONF_LAST_DIR, last_dir, NULL);
+ planner_conf_set_string (CONF_LAST_DIR, last_dir, "gen");
g_free (last_dir);
g_free (filename);
@@ -1953,7 +1951,7 @@ window_save_state (PlannerWindow *window)
maximized = FALSE;
}
- planner_conf_set_bool (CONF_WINDOW_MAXIMIZED, maximized, NULL);
+ planner_conf_set_bool (CONF_WINDOW_MAXIMIZED, maximized, "ui");
/* If maximized don't save the size and position */
if (!maximized) {
@@ -1961,56 +1959,38 @@ window_save_state (PlannerWindow *window)
int x, y;
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
- planner_conf_set_int (CONF_WINDOW_WIDTH, width, NULL);
- planner_conf_set_int (CONF_WINDOW_HEIGHT, height, NULL);
+ planner_conf_set_int (CONF_WINDOW_WIDTH, width, "ui");
+ planner_conf_set_int (CONF_WINDOW_HEIGHT, height, "ui");
gtk_window_get_position (GTK_WINDOW (window), &x, &y);
- planner_conf_set_int (CONF_WINDOW_POS_X, x, NULL);
- planner_conf_set_int (CONF_WINDOW_POS_Y, y, NULL);
+ planner_conf_set_int (CONF_WINDOW_POS_X, x, "ui");
+ planner_conf_set_int (CONF_WINDOW_POS_Y, y, "ui");
}
+
+ g_settings_sync ();
}
static void
window_restore_state (PlannerWindow *window)
{
- gboolean exists;
gboolean maximized;
int width, height;
int x, y;
- exists = planner_conf_dir_exists (CONF_WINDOW_DIR, NULL);
-
- if (exists) {
- maximized = planner_conf_get_bool (CONF_WINDOW_MAXIMIZED,
- NULL);
-
- if (maximized) {
- gtk_window_maximize (GTK_WINDOW (window));
- } else {
- width = planner_conf_get_int (CONF_WINDOW_WIDTH,
- NULL);
- height = planner_conf_get_int (CONF_WINDOW_HEIGHT,
- NULL);
+ maximized = planner_conf_get_bool (CONF_WINDOW_MAXIMIZED, "ui");
- if (width == 0) {
- width = DEFAULT_WINDOW_WIDTH;
- }
- if (height == 0) {
- height = DEFAULT_WINDOW_HEIGHT;
- }
+ if (maximized) {
+ gtk_window_maximize (GTK_WINDOW (window));
+ } else {
+ width = planner_conf_get_int (CONF_WINDOW_WIDTH, "ui");
+ height = planner_conf_get_int (CONF_WINDOW_HEIGHT, "ui");
- gtk_window_set_default_size (GTK_WINDOW (window),
- width, height);
+ gtk_window_set_default_size (GTK_WINDOW (window), width, height);
- x = planner_conf_get_int (CONF_WINDOW_POS_X,
- NULL);
- y = planner_conf_get_int (CONF_WINDOW_POS_Y,
- NULL);
+ x = planner_conf_get_int (CONF_WINDOW_POS_X, "ui");
+ y = planner_conf_get_int (CONF_WINDOW_POS_Y, "ui");
- gtk_window_move (GTK_WINDOW (window), x, y);
- }
- } else {
- gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
+ gtk_window_move (GTK_WINDOW (window), x, y);
}
}
diff --git a/src/planner-xml-planner-plugin.c b/src/planner-xml-planner-plugin.c
index 8945407c..58c37554 100644
--- a/src/planner-xml-planner-plugin.c
+++ b/src/planner-xml-planner-plugin.c
@@ -30,8 +30,9 @@
#include "planner-window.h"
#include "planner-plugin.h"
-#define CONF_MAIN_LAST_XML_EXPORT_DIR "/plugins/xml_export/last_dir"
+#define SCHEMA "org.gnome.Planner.plugins.xml-export"
+static GSettings *settings;
struct _PlannerPluginPriv {
GtkWidget *dialog;
@@ -61,8 +62,12 @@ get_last_dir (void)
{
gchar *last_dir;
- last_dir = planner_conf_get_string (CONF_MAIN_LAST_XML_EXPORT_DIR, NULL);
- if (last_dir == NULL) {
+ if (!settings)
+ settings = g_settings_new (SCHEMA);
+
+ last_dir = g_settings_get_string (settings, "last-dir");
+ if (!last_dir[0]) {
+ g_free (last_dir);
last_dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
}
@@ -152,8 +157,9 @@ xml_planner_plugin_export (GtkAction *action,
}
last_dir = g_path_get_dirname (real_filename);
- planner_conf_set_string (CONF_MAIN_LAST_XML_EXPORT_DIR, last_dir, NULL);
+ g_settings_set_string (settings, "last-dir", last_dir);
g_free (last_dir);
+ g_object_unref (settings);
g_free (real_filename);
g_free (filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]