summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stickynotes/Makefile.am21
-rw-r--r--stickynotes/org.mate.stickynotes.gschema.xml.in.in69
-rw-r--r--stickynotes/stickynotes.c59
-rw-r--r--stickynotes/stickynotes.schemas.in161
-rw-r--r--stickynotes/stickynotes_applet.c86
-rw-r--r--stickynotes/stickynotes_applet.h6
-rw-r--r--stickynotes/stickynotes_applet_callbacks.c84
-rw-r--r--stickynotes/stickynotes_applet_callbacks.h2
8 files changed, 160 insertions, 328 deletions
diff --git a/stickynotes/Makefile.am b/stickynotes/Makefile.am
index 612e8687..2206d305 100644
--- a/stickynotes/Makefile.am
+++ b/stickynotes/Makefile.am
@@ -12,7 +12,7 @@ if BUILD_STICKYNOTES_APPLET
INCLUDES = \
-I. \
-I$(srcdir) \
- $(MATE_APPLETS3_CFLAGS) \
+ $(MATE_APPLETS4_CFLAGS) \
$(LIBMATEWNCK_CFLAGS) \
$(XML2_CFLAGS) \
-DSTICKYNOTES_MENU_UI_DIR=\""$(uidir)"\"\
@@ -33,7 +33,7 @@ stickynotes_applet_SOURCES = \
stickynotes_applet_callbacks.c
stickynotes_applet_LDADD = \
- $(MATE_APPLETS3_LIBS) \
+ $(MATE_APPLETS4_LIBS) \
$(LIBMATEWNCK_LIBS) \
$(XML2_LIBS) \
-lX11
@@ -43,10 +43,12 @@ builder_DATA = $(builder_files)
uidir = $(datadir)/mate-2.0/ui
ui_DATA = $(ui_files)
-schemasdir = @MATECONF_SCHEMA_FILE_DIR@
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+@INTLTOOL_XML_NOMERGE_RULE@
+gsettings_SCHEMAS = org.mate.stickynotes.gschema.xml
+@GSETTINGS_RULES@
-@INTLTOOL_SCHEMAS_RULE@
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
+ $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
appletdir = $(datadir)/mate-panel/applets
applet_DATA = $(applet_in_files:.mate-panel-applet.in=.mate-panel-applet)
@@ -67,19 +69,14 @@ org.mate.panel.applet.StickyNotesAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS) *.gschema.valid
-if MATECONF_SCHEMAS_INSTALL
-install-data-local:
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) \
- $(MATECONFTOOL) --makefile-install-rule $(schemas_DATA)
-endif
endif
EXTRA_DIST = \
$(builder_files) \
$(ui_files) \
- $(schemas_in_files) \
+ $(gsettings_SCHEMAS_in_in) \
$(service_in_files) \
org.mate.applets.StickyNotesApplet.mate-panel-applet.in.in
diff --git a/stickynotes/org.mate.stickynotes.gschema.xml.in.in b/stickynotes/org.mate.stickynotes.gschema.xml.in.in
new file mode 100644
index 00000000..a2e4ad34
--- /dev/null
+++ b/stickynotes/org.mate.stickynotes.gschema.xml.in.in
@@ -0,0 +1,69 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.mate.stickynotes" path="/org/mate/stickynotes/">
+ <key name="default-width" type="i">
+ <default>100</default>
+ <_summary>Default width for new notes</_summary>
+ <_description>Default width for new sticky notes in pixels.</_description>
+ </key>
+ <key name="default-height" type="i">
+ <default>100</default>
+ <_summary>Default height for new notes</_summary>
+ <_description>Default height for new sticky notes in pixels.</_description>
+ </key>
+ <key name="default-color" type="s">
+ <default>'#ECF833'</default>
+ <_summary>Default color for new notes</_summary>
+ <_description>Default color for new sticky notes. This should be in html hex specification, for example "#30FF50".</_description>
+ </key>
+ <key name="default-font-color" type="s">
+ <default>'#000000'</default>
+ <_summary>Default color for font</_summary>
+ <_description>Default font color for new sticky notes. This should be in html hex specification, for example "#000000".</_description>
+ </key>
+ <key name="default-font" type="s">
+ <default>'Sans 10'</default>
+ <_summary>Default font for new notes</_summary>
+ <_description>Default font for new sticky notes. This should be a Pango Font Name, for example "Sans Italic 10".</_description>
+ </key>
+ <key name="sticky" type="b">
+ <default>true</default>
+ <_summary>Sticky notes' workspace stickyness</_summary>
+ <_description>Specifies whether the sticky notes are visible on ALL workspaces on the desktop, or not.</_description>
+ </key>
+ <key name="locked" type="b">
+ <default>false</default>
+ <_summary>Sticky notes' locked state</_summary>
+ <_description>Specifies whether the sticky notes are locked (non-editable) or not.</_description>
+ </key>
+ <key name="date-format" type="s">
+ <default>'%x'</default>
+ <_summary>Date format of note's title</_summary>
+ <_description>By default, sticky notes are given the current date as the title when they are created. This format is used; anything that can be parsed by strftime() is valid.</_description>
+ </key>
+ <key name="use-system-color" type="b">
+ <default>true</default>
+ <_summary>Whether to use the default system color</_summary>
+ <_description>If this option is disabled, a custom color can be used as the default color for all sticky notes.</_description>
+ </key>
+ <key name="use-system-font" type="b">
+ <default>true</default>
+ <_summary>Whether to use the default system font</_summary>
+ <_description>If this option is disabled, a custom font can be used as the default font for all sticky notes.</_description>
+ </key>
+ <key name="force-default" type="b">
+ <default>false</default>
+ <_summary>Whether to force the default color and font on all notes</_summary>
+ <_description>If this option is enabled, the custom colors and fonts that have been assigned to individual notes will be ignored.</_description>
+ </key>
+ <key name="desktop-hide" type="b">
+ <default>true</default>
+ <_summary>Whether to hide all notes when the desktop is selected</_summary>
+ <_description>If this option is enabled, selecting the desktop in any way will automatically hide all the open notes.</_description>
+ </key>
+ <key name="confirm-deletion" type="b">
+ <default>true</default>
+ <_summary>Whether to ask for confirmation when deleting a note</_summary>
+ <_description>Empty notes are always deleted without confirmation.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index 20e020bf..6d8d0072 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -166,16 +166,13 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
note->h = h;
/* Customize the window */
- if (mateconf_client_get_bool(stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL))
+ if (g_settings_get_boolean (stickynotes->settings, "sticky"))
gtk_window_stick(GTK_WINDOW(note->w_window));
if (w == 0 || h == 0)
gtk_window_resize (GTK_WINDOW(note->w_window),
- mateconf_client_get_int(stickynotes->mateconf,
- MATECONF_PATH "/defaults/width", NULL),
- mateconf_client_get_int(stickynotes->mateconf,
- MATECONF_PATH "/defaults/height", NULL));
+ g_settings_get_int (stickynotes->settings, "default-width"),
+ g_settings_get_int (stickynotes->settings, "default-height"));
else
gtk_window_resize (GTK_WINDOW(note->w_window),
note->w,
@@ -330,9 +327,7 @@ void stickynote_change_properties (StickyNote *note)
color_str = g_strdup (note->color);
else
{
- color_str = mateconf_client_get_string (
- stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", NULL);
+ color_str = g_settings_get_string (stickynotes->settings, "default-color");
}
if (color_str)
@@ -347,9 +342,7 @@ void stickynote_change_properties (StickyNote *note)
color_str = g_strdup (note->font_color);
else
{
- color_str = mateconf_client_get_string (
- stickynotes->mateconf,
- MATECONF_PATH "/defaults/font_color", NULL);
+ color_str = g_settings_get_string (stickynotes->settings, "default-font-color");
}
if (color_str)
@@ -395,7 +388,7 @@ void stickynote_set_title(StickyNote *note, const gchar *title)
/* If title is NULL, use the current date as the title. */
if (!title) {
gchar *date_title, *tmp;
- gchar *date_format = mateconf_client_get_string(stickynotes->mateconf, MATECONF_PATH "/settings/date_format", NULL);
+ gchar *date_format = g_settings_get_string (stickynotes->settings, "date-format");
if (!date_format)
date_format = g_strdup ("%x");
tmp = get_current_date (date_format);
@@ -447,31 +440,22 @@ stickynote_set_color (StickyNote *note,
/* If "force_default" is enabled or color_str is NULL,
* then we use the default color instead of color_str. */
- if (!color_str || mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL))
+ if (!color_str || g_settings_get_boolean (stickynotes->settings, "force-default"))
{
- if (mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color", NULL))
+ if (g_settings_get_boolean (stickynotes->settings, "use-system-color"))
color_str_actual = NULL;
else
- color_str_actual = mateconf_client_get_string (
- stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", NULL);
+ color_str_actual = g_settings_get_string (stickynotes->settings, "default-color");
}
else
color_str_actual = g_strdup (color_str);
- if (!font_color_str || mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL))
+ if (!font_color_str || g_settings_get_boolean (stickynotes->settings, "force-default"))
{
- if (mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color", NULL))
+ if (g_settings_get_boolean (stickynotes->settings, "use-system-color"))
font_color_str_actual = NULL;
else
- font_color_str_actual = mateconf_client_get_string (
- stickynotes->mateconf,
- MATECONF_PATH "/defaults/font_color",
- NULL);
+ font_color_str_actual = g_settings_get_string (stickynotes->settings, "default-font-color");
}
else
font_color_str_actual = g_strdup (font_color_str);
@@ -587,17 +571,12 @@ stickynote_set_font (StickyNote *note, const gchar *font_str, gboolean save)
/* If "force_default" is enabled or font_str is NULL,
* then we use the default font instead of font_str. */
- if (!font_str || mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL))
+ if (!font_str || g_settings_get_boolean (stickynotes->settings, "force-default"))
{
- if (mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_font",
- NULL))
+ if (g_settings_get_boolean (stickynotes->settings, "use-system-font"))
font_str_actual = NULL;
else
- font_str_actual = mateconf_client_get_string (
- stickynotes->mateconf,
- MATECONF_PATH "/defaults/font", NULL);
+ font_str_actual = g_settings_get_string (stickynotes->settings, "default-font");
}
else
font_str_actual = g_strdup (font_str);
@@ -655,8 +634,7 @@ stickynote_set_visible (StickyNote *note, gboolean visible)
gtk_window_move (GTK_WINDOW (note->w_window),
note->x, note->y);
/* Put the note on all workspaces if necessary. */
- if (mateconf_client_get_bool(stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL))
+ if (g_settings_get_boolean (stickynotes->settings, "sticky"))
gtk_window_stick(GTK_WINDOW(note->w_window));
else if (note->workspace > 0)
{
@@ -722,7 +700,7 @@ void stickynotes_remove(StickyNote *note)
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(note->w_window));
if (stickynote_get_empty(note)
- || !mateconf_client_get_bool(stickynotes->mateconf, MATECONF_PATH "/settings/confirm_deletion", NULL)
+ || !g_settings_get_boolean (stickynotes->settings, "confirm-deletion")
|| gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
stickynote_free(note);
@@ -781,8 +759,7 @@ stickynotes_save_now (void)
xid = GDK_WINDOW_XID (gtk_widget_get_window (note->w_window));
matewnck_win = matewnck_window_get (xid);
- if (!mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL) &&
+ if (!g_settings_get_boolean (stickynotes->settings, "sticky") &&
matewnck_win)
note->workspace = 1 +
matewnck_workspace_get_number (
diff --git a/stickynotes/stickynotes.schemas.in b/stickynotes/stickynotes.schemas.in
deleted file mode 100644
index 62186ed0..00000000
--- a/stickynotes/stickynotes.schemas.in
+++ /dev/null
@@ -1,161 +0,0 @@
-<mateconfschemafile>
-<schemalist>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/defaults/width</key>
- <applyto>/apps/stickynotes_applet/defaults/width</applyto>
- <owner>stickynotes_applet</owner>
- <type>int</type>
- <default>100</default>
- <locale name="C">
- <short>Default width for new notes</short>
- <long>Default width for new sticky notes in pixels.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/defaults/height</key>
- <applyto>/apps/stickynotes_applet/defaults/height</applyto>
- <owner>stickynotes_applet</owner>
- <type>int</type>
- <default>100</default>
- <locale name="C">
- <short>Default height for new notes</short>
- <long>Default height for new sticky notes in pixels.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/defaults/color</key>
- <applyto>/apps/stickynotes_applet/defaults/color</applyto>
- <owner>stickynotes_applet</owner>
- <type>string</type>
- <default>#ECF833</default>
- <locale name="C">
- <short>Default color for new notes</short>
- <long>Default color for new sticky notes. This should be in html hex specification, for example "#30FF50".</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/defaults/font_color</key>
- <applyto>/apps/stickynotes_applet/defaults/font_color</applyto>
- <owner>stickynotes_applet</owner>
- <type>string</type>
- <default>#000000</default>
- <locale name="C">
- <short>Default color for font</short>
- <long>Default font color for new sticky notes. This should be in html hex specification, for example "#000000".</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/defaults/font</key>
- <applyto>/apps/stickynotes_applet/defaults/font</applyto>
- <owner>stickynotes_applet</owner>
- <type>string</type>
- <default>Sans 10</default>
- <locale name="C">
- <short>Default font for new notes</short>
- <long>Default font for new sticky notes. This should be a Pango Font Name, for example "Sans Italic 10".</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/sticky</key>
- <applyto>/apps/stickynotes_applet/settings/sticky</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Sticky notes' workspace stickyness</short>
- <long>Specifies whether the sticky notes are visible on ALL workspaces on the desktop, or not.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/locked</key>
- <applyto>/apps/stickynotes_applet/settings/locked</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Sticky notes' locked state</short>
- <long>Specifies whether the sticky notes are locked (non-editable) or not.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/date_format</key>
- <applyto>/apps/stickynotes_applet/settings/date_format</applyto>
- <owner>stickynotes_applet</owner>
- <type>string</type>
- <default>%x</default>
- <locale name="C">
- <short>Date format of note's title</short>
- <long>By default, sticky notes are given the current date as the title when they are created. This format is used; anything that can be parsed by strftime() is valid.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/use_system_color</key>
- <applyto>/apps/stickynotes_applet/settings/use_system_color</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to use the default system color</short>
- <long>If this option is disabled, a custom color can be used as the default color for all sticky notes.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/use_system_font</key>
- <applyto>/apps/stickynotes_applet/settings/use_system_font</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to use the default system font</short>
- <long>If this option is disabled, a custom font can be used as the default font for all sticky notes.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/force_default</key>
- <applyto>/apps/stickynotes_applet/settings/force_default</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Whether to force the default color and font on all notes</short>
- <long>If this option is enabled, the custom colors and fonts that have been assigned to individual notes will be ignored.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/desktop_hide</key>
- <applyto>/apps/stickynotes_applet/settings/desktop_hide</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to hide all notes when the desktop is selected</short>
- <long>If this option is enabled, selecting the desktop in any way will automatically hide all the open notes.</long>
- </locale>
-</schema>
-
-<schema>
- <key>/schemas/apps/stickynotes_applet/settings/confirm_deletion</key>
- <applyto>/apps/stickynotes_applet/settings/confirm_deletion</applyto>
- <owner>stickynotes_applet</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to ask for confirmation when deleting a note</short>
- <long>Empty notes are always deleted without confirmation.</long>
- </locale>
-</schema>
-
-</schemalist>
-</mateconfschemafile>
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 8db1584f..c9209e13 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -165,21 +165,17 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
gdk_pixbuf_get_height (stickynotes->icon_normal));
stickynotes_make_prelight_icon (stickynotes->icon_prelight,
stickynotes->icon_normal, 30);
- stickynotes->mateconf = mateconf_client_get_default();
+ stickynotes->settings = g_settings_new (STICKYNOTES_SCHEMA);
stickynotes->visible = TRUE;
stickynotes_applet_init_icons();
stickynotes_applet_init_prefs();
- /* Watch MateConf values */
- mateconf_client_add_dir (stickynotes->mateconf, MATECONF_PATH,
- MATECONF_CLIENT_PRELOAD_NONE, NULL);
- mateconf_client_notify_add (stickynotes->mateconf, MATECONF_PATH "/defaults",
- (MateConfClientNotifyFunc) preferences_apply_cb,
- NULL, NULL, NULL);
- mateconf_client_notify_add (stickynotes->mateconf, MATECONF_PATH "/settings",
- (MateConfClientNotifyFunc) preferences_apply_cb,
- NULL, NULL, NULL);
+ /* Watch GSettings values */
+ g_signal_connect (stickynotes->settings,
+ "changed",
+ G_CALLBACK (preferences_apply_cb),
+ NULL);
/* Max height for large notes*/
stickynotes->max_height = 0.8*gdk_screen_get_height( gdk_screen_get_default() );
@@ -290,8 +286,7 @@ void stickynotes_applet_init_prefs(void)
g_object_unref(group);
}
- if (!mateconf_client_key_is_writable(stickynotes->mateconf,
- MATECONF_PATH "/defaults/width", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "default-width"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "width_label")),
@@ -300,8 +295,7 @@ void stickynotes_applet_init_prefs(void)
stickynotes->builder, "width_spin")),
FALSE);
}
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/height", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "default-height"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "height_label")),
@@ -310,16 +304,14 @@ void stickynotes_applet_init_prefs(void)
stickynotes->builder, "height_spin")),
FALSE);
}
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "default-color"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_color_label")),
FALSE);
gtk_widget_set_sensitive (stickynotes->w_prefs_color, FALSE);
}
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font_color", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "default-font-color"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_font_color_label")),
@@ -327,27 +319,22 @@ void stickynotes_applet_init_prefs(void)
gtk_widget_set_sensitive (stickynotes->w_prefs_font_color,
FALSE);
}
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "use-system-color"))
gtk_widget_set_sensitive (stickynotes->w_prefs_sys_color,
FALSE);
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "default-font"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_font_label")),
FALSE);
gtk_widget_set_sensitive (stickynotes->w_prefs_font, FALSE);
}
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_font", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "use-system-font"))
gtk_widget_set_sensitive (stickynotes->w_prefs_sys_font,
FALSE);
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "sticky"))
gtk_widget_set_sensitive (stickynotes->w_prefs_sticky, FALSE);
- if (!mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL))
+ if (!g_settings_is_writable (stickynotes->settings, "force-default"))
gtk_widget_set_sensitive (stickynotes->w_prefs_force, FALSE);
stickynotes_applet_update_prefs();
@@ -469,40 +456,30 @@ stickynotes_applet_update_prefs (void)
char *color_str, *font_color_str;
GdkColor color, font_color;
- gint width = mateconf_client_get_int(stickynotes->mateconf,
- MATECONF_PATH "/defaults/width", NULL);
+ gint width = g_settings_get_int (stickynotes->settings, "default-width");
width = MAX (width, 1);
- height = mateconf_client_get_int (stickynotes->mateconf,
- MATECONF_PATH "/defaults/height", NULL);
+ height = g_settings_get_int (stickynotes->settings, "default-height");
height = MAX (height, 1);
- sys_color = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color", NULL);
- sys_font = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_font", NULL);
- sticky = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL);
- force_default = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL);
- font_str = mateconf_client_get_string (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font", NULL);
- desktop_hide = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/desktop_hide", NULL);
+ sys_color = g_settings_get_boolean (stickynotes->settings, "use-system-color");
+ sys_font = g_settings_get_boolean (stickynotes->settings, "use-system-font");
+ sticky = g_settings_get_boolean (stickynotes->settings, "sticky");
+ force_default = g_settings_get_boolean (stickynotes->settings, "force-default");
+ font_str = g_settings_get_string (stickynotes->settings, "default-font");
+ desktop_hide = g_settings_get_boolean (stickynotes->settings, "desktop-hide");
if (!font_str)
{
font_str = g_strdup ("Sans 10");
}
- color_str = mateconf_client_get_string (stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", NULL);
+ color_str = g_settings_get_string (stickynotes->settings, "default-color");
if (!color_str)
{
color_str = g_strdup ("#ECF833");
}
- font_color_str = mateconf_client_get_string (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font_color", NULL);
+ font_color_str = g_settings_get_string (stickynotes->settings, "default-font-color");
if (!font_color_str)
{
font_color_str = g_strdup ("#000000");
@@ -541,8 +518,7 @@ stickynotes_applet_update_prefs (void)
GTK_FONT_BUTTON (stickynotes->w_prefs_font), font_str);
g_free (font_str);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", NULL))
+ if (g_settings_is_writable (stickynotes->settings, "default-color"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_color_label")),
@@ -550,8 +526,7 @@ stickynotes_applet_update_prefs (void)
gtk_widget_set_sensitive (stickynotes->w_prefs_color,
!sys_color);
}
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/prefs_font_color", NULL))
+ if (g_settings_is_writable (stickynotes->settings, "default-font-color"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_font_color_label")),
@@ -559,8 +534,7 @@ stickynotes_applet_update_prefs (void)
gtk_widget_set_sensitive (stickynotes->w_prefs_font_color,
!sys_color);
}
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font", NULL))
+ if (g_settings_is_writable (stickynotes->settings, "default-font"))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "prefs_font_label")),
@@ -575,8 +549,8 @@ void stickynotes_applet_update_menus(void)
GList *l;
gboolean inconsistent = FALSE;
- gboolean locked = mateconf_client_get_bool(stickynotes->mateconf, MATECONF_PATH "/settings/locked", NULL);
- gboolean locked_writable = mateconf_client_key_is_writable(stickynotes->mateconf, MATECONF_PATH "/settings/locked", NULL);
+ gboolean locked = g_settings_get_boolean (stickynotes->settings, "locked");
+ gboolean locked_writable = g_settings_is_writable (stickynotes->settings, "locked");
for (l = stickynotes->notes; l != NULL; l = l->next) {
StickyNote *note = l->data;
diff --git a/stickynotes/stickynotes_applet.h b/stickynotes/stickynotes_applet.h
index 4c66dd92..a4eb0cfa 100644
--- a/stickynotes/stickynotes_applet.h
+++ b/stickynotes/stickynotes_applet.h
@@ -24,11 +24,11 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <mate-panel-applet.h>
-#include <mateconf/mateconf-client.h>
-#define MATECONF_PATH "/apps/stickynotes_applet"
+#define STICKYNOTES_SCHEMA "org.mate.stickynotes"
#define BUILDER_PATH GTK_BUILDERDIR "/stickynotes.ui"
#define ICON_PATH STICKYNOTES_ICONDIR
@@ -61,7 +61,7 @@ typedef struct
GdkPixbuf *icon_normal; /* Normal applet icon */
GdkPixbuf *icon_prelight; /* Prelighted applet icon */
- MateConfClient *mateconf; /* MateConf Client */
+ GSettings *settings; /* Shared GSettings */
gint max_height;
guint last_timeout_data;
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index ec736d5a..93ac4808 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -144,8 +144,7 @@ static GdkFilterReturn desktop_window_event_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
{
- gboolean desktop_hide = mateconf_client_get_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/desktop_hide", NULL);
+ gboolean desktop_hide = g_settings_get_boolean (stickynotes->settings, "desktop-hide");
if (desktop_hide &&
(((XEvent*)xevent)->xany.type == PropertyNotify) &&
(((XEvent*)xevent)->xproperty.atom == gdk_x11_get_xatom_by_name ("_NET_WM_USER_TIME"))) {
@@ -366,8 +365,8 @@ void menu_toggle_lock_cb(GtkAction *action, StickyNotesApplet *applet)
{
gboolean locked = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (mateconf_client_key_is_writable(stickynotes->mateconf, MATECONF_PATH "/settings/locked", NULL))
- mateconf_client_set_bool(stickynotes->mateconf, MATECONF_PATH "/settings/locked", locked, NULL);
+ if (g_settings_is_writable (stickynotes->settings, "locked"))
+ g_settings_set_boolean (stickynotes->settings, "locked", locked);
}
/* Menu Callback : Configure preferences */
@@ -444,38 +443,20 @@ preferences_save_cb (gpointer data)
gboolean desktop_hide = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (stickynotes->w_prefs_desktop));
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/width", NULL))
- mateconf_client_set_int (stickynotes->mateconf,
- MATECONF_PATH "/defaults/width", width, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/defaults/height", NULL))
- mateconf_client_set_int (stickynotes->mateconf,
- MATECONF_PATH "/defaults/height", height, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color", NULL))
- mateconf_client_set_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_color",
- sys_color, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_font", NULL))
- mateconf_client_set_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/use_system_font",
- sys_font, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", NULL))
- mateconf_client_set_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/sticky", sticky, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default", NULL))
- mateconf_client_set_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/force_default",
- force_default, NULL);
- if (mateconf_client_key_is_writable (stickynotes->mateconf,
- MATECONF_PATH "/settings/desktop_hide", NULL))
- mateconf_client_set_bool (stickynotes->mateconf,
- MATECONF_PATH "/settings/desktop_hide",
- desktop_hide, NULL);
+ if (g_settings_is_writable (stickynotes->settings,"default-width"))
+ g_settings_set_int (stickynotes->settings,"default-width", width);
+ if (g_settings_is_writable (stickynotes->settings,"default-height"))
+ g_settings_set_int (stickynotes->settings,"default-height", height);
+ if (g_settings_is_writable (stickynotes->settings,"use-system-color"))
+ g_settings_set_boolean (stickynotes->settings,"use-system-color", sys_color);
+ if (g_settings_is_writable (stickynotes->settings,"use-system-font"))
+ g_settings_set_boolean (stickynotes->settings,"use-system-font", sys_font);
+ if (g_settings_is_writable (stickynotes->settings,"sticky"))
+ g_settings_set_boolean (stickynotes->settings,"sticky", sticky);
+ if (g_settings_is_writable (stickynotes->settings,"force-default"))
+ g_settings_set_boolean (stickynotes->settings,"force-default", force_default);
+ if (g_settings_is_writable (stickynotes->settings,"desktop-hide"))
+ g_settings_set_boolean (stickynotes->settings,"desktop-hide", desktop_hide);
}
/* Preferences Callback : Change color. */
@@ -500,11 +481,8 @@ preferences_color_cb (GtkWidget *button, gpointer data)
font_color.green / 256,
font_color.blue / 256);
- mateconf_client_set_string (stickynotes->mateconf,
- MATECONF_PATH "/defaults/color", color_str, NULL);
- mateconf_client_set_string (stickynotes->mateconf,
- MATECONF_PATH "/defaults/font_color", font_color_str,
- NULL);
+ g_settings_set_string (stickynotes->settings, "default-color", color_str);
+ g_settings_set_string (stickynotes->settings, "default-font-color", font_color_str);
g_free (color_str);
g_free (font_color_str);
@@ -516,19 +494,18 @@ void preferences_font_cb (GtkWidget *button, gpointer data)
const char *font_str;
font_str = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
- mateconf_client_set_string(stickynotes->mateconf,
- MATECONF_PATH "/defaults/font", font_str, NULL);
+ g_settings_set_string (stickynotes->settings, "default-font", font_str);
}
/* Preferences Callback : Apply to existing notes. */
-void preferences_apply_cb(MateConfClient *client, guint cnxn_id, MateConfEntry *entry, gpointer data)
+void preferences_apply_cb(GSettings *settings, gchar *key, gpointer data)
{
GList *l;
StickyNote *note;
- if (!strcmp (entry->key, MATECONF_PATH "/settings/sticky"))
+ if (!strcmp (key, "sticky"))
{
- if (mateconf_value_get_bool(entry->value))
+ if (g_settings_get_boolean (settings, key))
for (l = stickynotes->notes; l; l = l->next)
{
note = l->data;
@@ -543,20 +520,19 @@ void preferences_apply_cb(MateConfClient *client, guint cnxn_id, MateConfEntry *
}
}
- else if (!strcmp (entry->key, MATECONF_PATH "/settings/locked"))
+ else if (!strcmp (key, "locked"))
{
for (l = stickynotes->notes; l; l = l->next)
{
note = l->data;
stickynote_set_locked (note,
- mateconf_value_get_bool (entry->value));
+ g_settings_get_boolean (settings, key));
}
stickynotes_save();
}
- else if (!strcmp (entry->key,
- MATECONF_PATH "/settings/use_system_color") ||
- !strcmp (entry->key, MATECONF_PATH "/defaults/color"))
+ else if (!strcmp (key, "use-system-color") ||
+ !strcmp (key, "default-color"))
{
for (l = stickynotes->notes; l; l = l->next)
{
@@ -567,8 +543,8 @@ void preferences_apply_cb(MateConfClient *client, guint cnxn_id, MateConfEntry *
}
}
- else if (!strcmp (entry->key, MATECONF_PATH "/settings/use_system_font") ||
- !strcmp (entry->key, MATECONF_PATH "/defaults/font"))
+ else if (!strcmp (key, "use-system-font") ||
+ !strcmp (key, "default-font"))
{
for (l = stickynotes->notes; l; l = l->next)
{
@@ -577,7 +553,7 @@ void preferences_apply_cb(MateConfClient *client, guint cnxn_id, MateConfEntry *
}
}
- else if (!strcmp (entry->key, MATECONF_PATH "/settings/force_default"))
+ else if (!strcmp (key, "force-default"))
{
for (l = stickynotes->notes; l; l = l->next)
{
diff --git a/stickynotes/stickynotes_applet_callbacks.h b/stickynotes/stickynotes_applet_callbacks.h
index 8506a985..287f366f 100644
--- a/stickynotes/stickynotes_applet_callbacks.h
+++ b/stickynotes/stickynotes_applet_callbacks.h
@@ -50,7 +50,7 @@ void menu_about_cb(GtkAction *action, StickyNotesApplet *applet);
void preferences_save_cb(gpointer data);
void preferences_color_cb (GtkWidget *button, gpointer data);
void preferences_font_cb (GtkWidget *button, gpointer data);
-void preferences_apply_cb(MateConfClient *client, guint cnxn_id, MateConfEntry *entry, gpointer data);
+void preferences_apply_cb(GSettings *settings, gchar *key, gpointer data);
void preferences_response_cb(GtkWidget *dialog, gint response, gpointer data);
gboolean preferences_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data);