summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-screenshot/Makefile.am46
-rw-r--r--mate-screenshot/mate-screenshot.c112
-rw-r--r--mate-screenshot/mate-screenshot.schemas.in81
-rw-r--r--mate-screenshot/org.mate.screenshot.gschema.xml.in29
4 files changed, 100 insertions, 168 deletions
diff --git a/mate-screenshot/Makefile.am b/mate-screenshot/Makefile.am
index d83f5869..66de5dd0 100644
--- a/mate-screenshot/Makefile.am
+++ b/mate-screenshot/Makefile.am
@@ -5,9 +5,6 @@ INCLUDES = \
-I$(srcdir) \
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DUIDIR=\""$(uidir)"\" \
- $(MATE_UTILS_CFLAGS) \
- $(LIBCANBERRA_GTK_CFLAGS) \
- $(GTHREAD_CFLAGS) \
$(NULL)
bin_PROGRAMS = \
@@ -28,13 +25,23 @@ mate_screenshot_SOURCES = \
screenshot-xfer.h \
$(NULL)
+mate_screenshot_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(LIBCANBERRA_GTK_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(NULL)
+
mate_screenshot_LDFLAGS = -export-dynamic
mate_screenshot_LDADD = \
$(XSHAPE_LIBS) \
- $(MATE_UTILS_LIBS) \
+ $(GLIB_LIBS) \
+ $(GIO_LIBS) \
$(LIBCANBERRA_GTK_LIBS) \
$(GTHREAD_LIBS) \
+ $(GTK_LIBS) \
-lm \
$(NULL)
@@ -50,35 +57,24 @@ ui_DATA = \
mate-screenshot.ui \
$(NULL)
+gsettingsschema_in_files = org.mate.screenshot.gschema.xml.in
+gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
+.PRECIOUS: $(gsettings_SCHEMAS)
+
+@INTLTOOL_XML_NOMERGE_RULE@
+
+@GSETTINGS_RULES@
+
EXTRA_DIST = \
- $(schemas_in_files) \
+ $(gsettingsschema_in_files) \
$(mate_screenshot_in_files) \
$(man_MANS) \
$(ui_DATA) \
$(NULL)
-schemasdir = $(MATECONF_SCHEMA_FILE_DIR)
-schemas_in_files = \
- mate-screenshot.schemas.in \
- $(NULL)
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
-
-@INTLTOOL_SCHEMAS_RULE@
-
-if MATECONF_SCHEMAS_INSTALL
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schemas_DATA) ; do \
- MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/mate-screenshot/$$p ; \
- done ; \
- fi
-else
-install-data-local:
-endif
-
CLEANFILES = \
$(BUILT_SOURCES) \
- $(schemas_in_files:.schemas.in=.schemas) \
+ $(gsettings_SCHEMAS) \
$(mate_screenshot_DATA) \
$(sys_DATA)
diff --git a/mate-screenshot/mate-screenshot.c b/mate-screenshot/mate-screenshot.c
index c3c40e07..f3db5794 100644
--- a/mate-screenshot/mate-screenshot.c
+++ b/mate-screenshot/mate-screenshot.c
@@ -25,7 +25,6 @@
/* MAYBE I LIED... -jrb */
#include <config.h>
-#include <mateconf/mateconf-client.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <sys/types.h>
@@ -50,13 +49,13 @@
#define SCREENSHOOTER_ICON "applets-screenshooter"
-#define MATE_SCREENSHOT_MATECONF "/apps/mate-screenshot"
-#define INCLUDE_BORDER_KEY MATE_SCREENSHOT_MATECONF "/include_border"
-#define INCLUDE_POINTER_KEY MATE_SCREENSHOT_MATECONF "/include_pointer"
-#define LAST_SAVE_DIRECTORY_KEY MATE_SCREENSHOT_MATECONF "/last_save_directory"
-#define BORDER_EFFECT_KEY MATE_SCREENSHOT_MATECONF "/border_effect"
-#define DELAY_KEY MATE_SCREENSHOT_MATECONF "/delay"
-
+#define MATE_SCREENSHOT_SCHEMA "org.mate.screenshot"
+#define INCLUDE_BORDER_KEY "include-border"
+#define INCLUDE_POINTER_KEY "include-pointer"
+#define LAST_SAVE_DIRECTORY_KEY "last-save-directory"
+#define BORDER_EFFECT_KEY "border-effect"
+#define DELAY_KEY "delay"
+#define CAJA_PREFERENCES_SCHEMA "org.mate.caja.preferences"
enum
{
@@ -97,6 +96,7 @@ static char *last_save_dir = NULL;
static char *window_title = NULL;
static char *temporary_file = NULL;
static gboolean save_immediately = FALSE;
+static GSettings *settings = NULL;
/* Options */
static gboolean take_window_shot = FALSE;
@@ -548,21 +548,15 @@ create_interactive_dialog (void)
}
static void
-save_folder_to_mateconf (ScreenshotDialog *dialog)
+save_folder_to_settings (ScreenshotDialog *dialog)
{
- MateConfClient *mateconf_client;
char *folder;
- mateconf_client = mateconf_client_get_default ();
-
folder = screenshot_dialog_get_folder (dialog);
- /* Error is NULL, as there's nothing we can do */
- mateconf_client_set_string (mateconf_client,
- LAST_SAVE_DIRECTORY_KEY, folder,
- NULL);
+ g_settings_set_string (settings,
+ LAST_SAVE_DIRECTORY_KEY, folder);
g_free (folder);
- g_object_unref (mateconf_client);
}
static void
@@ -626,7 +620,7 @@ save_callback (TransferResult result,
if (result == TRANSFER_OK)
{
- save_folder_to_mateconf (dialog);
+ save_folder_to_settings (dialog);
set_recent_entry (dialog);
gtk_widget_destroy (toplevel);
@@ -1124,21 +1118,35 @@ prepare_screenshot_timeout (gpointer data)
static gchar *
get_desktop_dir (void)
{
- MateConfClient *mateconf_client;
gboolean desktop_is_home_dir = FALSE;
gchar *desktop_dir;
+ const char * const *schemas;
+ gboolean schema_exists = FALSE;
+ gint i;
+
+ /* Check if caja schema is installed before trying to read settings */
+ schemas = g_settings_list_schemas ();
+ for (i = 0; schemas[i] != NULL; i++) {
+ if (g_strcmp0 (schemas[i], CAJA_PREFERENCES_SCHEMA) == 0) {
+ schema_exists = TRUE;
+ break;
+ }
+ }
+
+ if (schema_exists) {
+ GSettings *caja_prefs;
+
+ caja_prefs = g_settings_new (CAJA_PREFERENCES_SCHEMA);
+ desktop_is_home_dir = g_settings_get_boolean (caja_prefs, "desktop-is-home-dir");
+
+ g_object_unref (caja_prefs);
+ }
- mateconf_client = mateconf_client_get_default ();
- desktop_is_home_dir = mateconf_client_get_bool (mateconf_client,
- "/apps/caja/preferences/desktop_is_home_dir",
- NULL);
if (desktop_is_home_dir)
desktop_dir = g_strconcat ("file://", g_get_home_dir (), NULL);
else
desktop_dir = g_strconcat ("file://", g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP), NULL);
- g_object_unref (mateconf_client);
-
return desktop_dir;
}
@@ -1176,14 +1184,9 @@ expand_initial_tilde (const char *path)
static void
load_options (void)
{
- MateConfClient *mateconf_client;
-
- mateconf_client = mateconf_client_get_default ();
-
/* Find various dirs */
- last_save_dir = mateconf_client_get_string (mateconf_client,
- LAST_SAVE_DIRECTORY_KEY,
- NULL);
+ last_save_dir = g_settings_get_string (settings,
+ LAST_SAVE_DIRECTORY_KEY);
if (!last_save_dir || !last_save_dir[0])
{
last_save_dir = get_desktop_dir ();
@@ -1195,46 +1198,30 @@ load_options (void)
last_save_dir = tmp;
}
- include_border = mateconf_client_get_bool (mateconf_client,
- INCLUDE_BORDER_KEY,
- NULL);
+ include_border = g_settings_get_boolean (settings,
+ INCLUDE_BORDER_KEY);
- include_pointer = mateconf_client_get_bool (mateconf_client,
- INCLUDE_POINTER_KEY,
- NULL);
+ include_pointer = g_settings_get_boolean (settings,
+ INCLUDE_POINTER_KEY);
- border_effect = mateconf_client_get_string (mateconf_client,
- BORDER_EFFECT_KEY,
- NULL);
+ border_effect = g_settings_get_string (settings,
+ BORDER_EFFECT_KEY);
if (!border_effect)
border_effect = g_strdup ("none");
- delay = mateconf_client_get_int (mateconf_client, DELAY_KEY, NULL);
-
- g_object_unref (mateconf_client);
+ delay = g_settings_get_int (settings, DELAY_KEY);
}
static void
save_options (void)
{
- MateConfClient *mateconf_client;
-
- mateconf_client = mateconf_client_get_default ();
-
- /* Error is NULL, as there's nothing we can do */
-
- mateconf_client_set_bool (mateconf_client,
- INCLUDE_BORDER_KEY, include_border,
- NULL);
- mateconf_client_set_bool (mateconf_client,
- INCLUDE_POINTER_KEY, include_pointer,
- NULL);
- mateconf_client_set_int (mateconf_client, DELAY_KEY, delay, NULL);
- mateconf_client_set_string (mateconf_client,
- BORDER_EFFECT_KEY, border_effect,
- NULL);
-
- g_object_unref (mateconf_client);
+ g_settings_set_boolean (settings,
+ INCLUDE_BORDER_KEY, include_border);
+ g_settings_set_boolean (settings,
+ INCLUDE_POINTER_KEY, include_pointer);
+ g_settings_set_int (settings, DELAY_KEY, delay);
+ g_settings_set_string (settings,
+ BORDER_EFFECT_KEY, border_effect);
}
@@ -1325,6 +1312,7 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name (SCREENSHOOTER_ICON);
screenshooter_init_stock_icons ();
+ settings = g_settings_new (MATE_SCREENSHOT_SCHEMA);
load_options ();
/* allow the command line to override options */
if (window_arg)
diff --git a/mate-screenshot/mate-screenshot.schemas.in b/mate-screenshot/mate-screenshot.schemas.in
deleted file mode 100644
index a8c2dca4..00000000
--- a/mate-screenshot/mate-screenshot.schemas.in
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-
-<mateconfschemafile>
- <schemalist>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/take_window_shot</key>
- <applyto>/apps/mate-screenshot/take_window_shot</applyto>
- <owner>mate-screenshot</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Window-specific screenshot (deprecated)</short>
- <long>Grab just the current window, rather than the whole desktop.
- This key has been deprecated and it is no longer in use.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/delay</key>
- <applyto>/apps/mate-screenshot/delay</applyto>
- <owner>mate-screenshot</owner>
- <type>int</type>
- <default>0</default>
- <locale name="C">
- <short>Screenshot delay</short>
- <long>The number of seconds to wait before taking the screenshot.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/last_save_directory</key>
- <applyto>/apps/mate-screenshot/last_save_directory</applyto>
- <owner>mate-screenshot</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Screenshot directory</short>
- <long>The directory the last screenshot was saved in.</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/include_border</key>
- <applyto>/apps/mate-screenshot/include_border</applyto>
- <owner>mate-screenshot</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Include Border</short>
- <long>Include the window manager border along with the screenshot</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/include_pointer</key>
- <applyto>/apps/mate-screenshot/include_pointer</applyto>
- <owner>mate-screenshot</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Include Pointer</short>
- <long>Include the pointer in the screenshot</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/mate-screenshot/border_effect</key>
- <applyto>/apps/mate-screenshot/border_effect</applyto>
- <owner>mate-screenshot</owner>
- <type>string</type>
- <default>none</default>
- <locale name="C">
- <short>Border Effect</short>
- <long>Effect to add to the outside of a border. Possible values are "shadow", "none", and "border".
- </long>
- </locale>
- </schema>
-
- </schemalist>
-</mateconfschemafile>
diff --git a/mate-screenshot/org.mate.screenshot.gschema.xml.in b/mate-screenshot/org.mate.screenshot.gschema.xml.in
new file mode 100644
index 00000000..fddddbb3
--- /dev/null
+++ b/mate-screenshot/org.mate.screenshot.gschema.xml.in
@@ -0,0 +1,29 @@
+<schemalist gettext-domain="mate-utils-2.0">
+ <schema id="org.mate.screenshot" path="/org/mate/screenshot/">
+ <key name="delay" type="i">
+ <default>0</default>
+ <_summary>Screenshot delay</_summary>
+ <_description>The number of seconds to wait before taking the screenshot.</_description>
+ </key>
+ <key name="last-save-directory" type="s">
+ <default>''</default>
+ <_summary>Screenshot directory</_summary>
+ <_description>The directory the last screenshot was saved in.</_description>
+ </key>
+ <key name="include-border" type="b">
+ <default>true</default>
+ <_summary>Include Border</_summary>
+ <_description>Include the window manager border along with the screenshot</_description>
+ </key>
+ <key name="include-pointer" type="b">
+ <default>true</default>
+ <_summary>Include Pointer</_summary>
+ <_description>Include the pointer in the screenshot</_description>
+ </key>
+ <key name="border-effect" type="s">
+ <default>'none'</default>
+ <_summary>Border Effect</_summary>
+ <_description>Effect to add to the outside of a border. Possible values are "shadow", "none", and "border".</_description>
+ </key>
+ </schema>
+</schemalist>