diff options
25 files changed, 1345 insertions, 398 deletions
diff --git a/Makefile.am b/Makefile.am index 7395e0e..217eb8a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,9 @@ -SUBDIRS = \ - po \ - libmate-desktop \ - docs \ - man +SUBDIRS = \ + po \ + libmate-desktop \ + docs \ + man \ + schemas if MATE_ABOUT_ENABLED SUBDIRS += mate-about @@ -1 +1,4 @@ +mate-desktop 1.5.0 + * port to new thumbnail spec (code from gnome-desktop 3.x) + * added gsettings schemas from now deprecated libmate diff --git a/configure.in b/configure.in index 5256117..30c2991 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ m4_define([mate_platform], [1]) -m4_define([mate_minor], [4]) -m4_define([mate_micro], [1]) +m4_define([mate_minor], [5]) +m4_define([mate_micro], [0]) m4_define(mate_version, [mate_platform.mate_minor.mate_micro]), @@ -128,13 +128,13 @@ esac GDK_PIXBUF_REQUIRED=2.4.0 GLIB_REQUIRED=2.19.1 -MATECONF_REQUIRED=1.1.0 +GIO_REQUIRED=2.25.0 XRANDR_REQUIRED=1.2 #AC_SUBST(GTK_REQUIRED) AC_SUBST(GLIB_REQUIRED) AC_SUBST(GDK_PIXBUF_REQUIRED) -AC_SUBST(MATECONF_REQUIRED) +AC_SUBST(GIO_REQUIRED) AC_SUBST(XRANDR_REQUIRED) dnl ---------------------------------------------------------------------------- @@ -211,10 +211,7 @@ AC_SUBST(RANDR_PACKAGE) dnl pkg-config dependency checks -PKG_CHECK_MODULES(MATE_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED mateconf-2.0 >= $MATECONF_REQUIRED $STARTUP_NOTIFICATION_PACKAGE $RANDR_PACKAGE) - -dnl for mate-about -AM_PATH_PYTHON +PKG_CHECK_MODULES(MATE_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GIO_REQUIRED $STARTUP_NOTIFICATION_PACKAGE $RANDR_PACKAGE) PKG_CHECK_MODULES(MATE_ABOUT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) AC_SUBST(MATE_ABOUT_CFLAGS) @@ -269,6 +266,7 @@ if test "x$enable_libunique" = "xyes"; then fi fi +GLIB_GSETTINGS dnl Do not use AC_PROG_AWK since we need the full pathname. AC_PATH_PROGS(AWK, mawk gawk nawk awk, ) @@ -309,6 +307,8 @@ desktop-docs/Makefile desktop-docs/fdl/Makefile desktop-docs/gpl/Makefile desktop-docs/lgpl/Makefile +schemas/Makefile +schemas/org.mate.interface.gschema.xml man/Makefile ]) diff --git a/libmate-desktop/libmateui/mate-bg.h b/libmate-desktop/libmateui/mate-bg.h index 0b5ec60..279842c 100644 --- a/libmate-desktop/libmateui/mate-bg.h +++ b/libmate-desktop/libmateui/mate-bg.h @@ -30,7 +30,7 @@ #endif #include <gdk/gdk.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include <libmateui/mate-desktop-thumbnail.h> #include <libmateui/mate-bg-crossfade.h> @@ -45,7 +45,7 @@ extern "C" { #define MATE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG)) #define MATE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG, MateBGClass)) -#define MATE_BG_KEY_DIR "/desktop/mate/background" +#define MATE_BG_SCHEMA "org.mate.background" typedef struct _MateBG MateBG; typedef struct _MateBGClass MateBGClass; @@ -67,10 +67,8 @@ typedef enum { GType mate_bg_get_type (void); MateBG * mate_bg_new (void); -void mate_bg_load_from_preferences (MateBG *bg, - MateConfClient *client); -void mate_bg_save_to_preferences (MateBG *bg, - MateConfClient *client); +void mate_bg_load_from_preferences (MateBG *bg); +void mate_bg_save_to_preferences (MateBG *bg); /* Setters */ void mate_bg_set_filename (MateBG *bg, const char *filename); diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c index a46fc27..d2a373b 100644 --- a/libmate-desktop/mate-bg.c +++ b/libmate-desktop/mate-bg.c @@ -41,19 +41,19 @@ Author: Soren Sandmann <[email protected]> #include <cairo.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #define MATE_DESKTOP_USE_UNSTABLE_API #include <libmateui/mate-bg.h> #include <libmateui/mate-bg-crossfade.h> -#define BG_KEY_DRAW_BACKGROUND MATE_BG_KEY_DIR "/draw_background" -#define BG_KEY_PRIMARY_COLOR MATE_BG_KEY_DIR "/primary_color" -#define BG_KEY_SECONDARY_COLOR MATE_BG_KEY_DIR "/secondary_color" -#define BG_KEY_COLOR_TYPE MATE_BG_KEY_DIR "/color_shading_type" -#define BG_KEY_PICTURE_PLACEMENT MATE_BG_KEY_DIR "/picture_options" -#define BG_KEY_PICTURE_OPACITY MATE_BG_KEY_DIR "/picture_opacity" -#define BG_KEY_PICTURE_FILENAME MATE_BG_KEY_DIR "/picture_filename" +#define BG_KEY_DRAW_BACKGROUND "draw-background" +#define BG_KEY_PRIMARY_COLOR "primary-color" +#define BG_KEY_SECONDARY_COLOR "secondary-color" +#define BG_KEY_COLOR_TYPE "color-shading-type" +#define BG_KEY_PICTURE_PLACEMENT "picture-options" +#define BG_KEY_PICTURE_OPACITY "picture-opacity" +#define BG_KEY_PICTURE_FILENAME "picture-filename" /* We keep the large pixbufs around if the next update in the slideshow is less than 60 seconds away */ @@ -221,59 +221,6 @@ color_to_string (const GdkColor *color) color->blue >> 8); } -static MateConfEnumStringPair placement_lookup[] = { - { MATE_BG_PLACEMENT_CENTERED, "centered" }, - { MATE_BG_PLACEMENT_FILL_SCREEN, "stretched" }, - { MATE_BG_PLACEMENT_SCALED, "scaled" }, - { MATE_BG_PLACEMENT_ZOOMED, "zoom" }, - { MATE_BG_PLACEMENT_TILED, "wallpaper" }, - { MATE_BG_PLACEMENT_SPANNED, "spanned" }, - { 0, NULL } -}; - -static MateConfEnumStringPair color_type_lookup[] = { - { MATE_BG_COLOR_SOLID, "solid" }, - { MATE_BG_COLOR_H_GRADIENT, "horizontal-gradient" }, - { MATE_BG_COLOR_V_GRADIENT, "vertical-gradient" }, - { 0, NULL } -}; - -static void -color_type_from_string (const char *string, - MateBGColorType *color_type) -{ - *color_type = MATE_BG_COLOR_SOLID; - - if (string) { - mateconf_string_to_enum (color_type_lookup, - string, (int *)color_type); - } -} - -static const char * -color_type_to_string (MateBGColorType color_type) -{ - return mateconf_enum_to_string (color_type_lookup, color_type); -} - -static void -placement_from_string (const char *string, - MateBGPlacement *placement) -{ - *placement = MATE_BG_PLACEMENT_ZOOMED; - - if (string) { - mateconf_string_to_enum (placement_lookup, - string, (int *)placement); - } -} - -static const char * -placement_to_string (MateBGPlacement placement) -{ - return mateconf_enum_to_string (placement_lookup, placement); -} - static gboolean do_changed (MateBG *bg) { @@ -343,21 +290,22 @@ queue_transitioned (MateBG *bg) } void -mate_bg_load_from_preferences (MateBG *bg, - MateConfClient *client) +mate_bg_load_from_preferences (MateBG *bg) { char *tmp; char *filename; MateBGColorType ctype; GdkColor c1, c2; MateBGPlacement placement; + GSettings *settings; g_return_if_fail (MATE_IS_BG (bg)); - g_return_if_fail (client != NULL); + + settings = g_settings_new (MATE_BG_SCHEMA); /* Filename */ filename = NULL; - tmp = mateconf_client_get_string (client, BG_KEY_PICTURE_FILENAME, NULL); + tmp = g_settings_get_string(settings, BG_KEY_PICTURE_FILENAME); if (tmp != NULL && *tmp != '\0') { if (g_utf8_validate (tmp, -1, NULL) && g_file_test (tmp, G_FILE_TEST_EXISTS)) { @@ -369,41 +317,32 @@ mate_bg_load_from_preferences (MateBG *bg, /* Fall back to default background if filename was set but no longer exists */ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { - MateConfValue *default_value; g_free (filename); filename = NULL; + + /* FIXME: default value? */ - default_value = - mateconf_client_get_default_from_schema (client, - BG_KEY_PICTURE_FILENAME, - NULL); - if (default_value != NULL) { - filename = g_strdup (mateconf_value_get_string (default_value)); - mateconf_value_free (default_value); - } } } g_free (tmp); /* Colors */ - tmp = mateconf_client_get_string (client, BG_KEY_PRIMARY_COLOR, NULL); + tmp = g_settings_get_string (settings, BG_KEY_PRIMARY_COLOR); color_from_string (tmp, &c1); g_free (tmp); - tmp = mateconf_client_get_string (client, BG_KEY_SECONDARY_COLOR, NULL); + tmp = g_settings_get_string (settings, BG_KEY_SECONDARY_COLOR); color_from_string (tmp, &c2); g_free (tmp); /* Color type */ - tmp = mateconf_client_get_string (client, BG_KEY_COLOR_TYPE, NULL); - color_type_from_string (tmp, &ctype); - g_free (tmp); + ctype = g_settings_get_enum (settings, BG_KEY_COLOR_TYPE); /* Placement */ - tmp = mateconf_client_get_string (client, BG_KEY_PICTURE_PLACEMENT, NULL); - placement_from_string (tmp, &placement); - g_free (tmp); + placement = g_settings_get_enum (settings, BG_KEY_PICTURE_PLACEMENT); + + g_object_unref (settings); mate_bg_set_color (bg, ctype, &c1, &c2); mate_bg_set_placement (bg, placement); @@ -413,34 +352,38 @@ mate_bg_load_from_preferences (MateBG *bg, } void -mate_bg_save_to_preferences (MateBG *bg, - MateConfClient *client) +mate_bg_save_to_preferences (MateBG *bg) { - const char *color_type; - const char *placement; - const gchar *filename; - gchar *primary; - gchar *secondary; + MateBGColorType color_type; + MateBGPlacement placement; + const gchar *filename; + gchar *primary; + gchar *secondary; + GSettings *settings; + + settings = g_settings_new (MATE_BG_SCHEMA); primary = color_to_string (&bg->primary); secondary = color_to_string (&bg->secondary); - color_type = color_type_to_string (bg->color_type); + color_type = bg->color_type; - if (bg->filename) { + if (bg->filename) { filename = bg->filename; - placement = placement_to_string (bg->placement); - } - else { - filename = "(none)"; - placement = "none"; - } - - mateconf_client_set_string (client, BG_KEY_PICTURE_FILENAME, filename, NULL); - mateconf_client_set_string (client, BG_KEY_PRIMARY_COLOR, primary, NULL); - mateconf_client_set_string (client, BG_KEY_SECONDARY_COLOR, secondary, NULL); - mateconf_client_set_string (client, BG_KEY_COLOR_TYPE, color_type, NULL); - mateconf_client_set_string (client, BG_KEY_PICTURE_PLACEMENT, placement, NULL); + placement = bg->placement; + } + else { + filename = "(none)"; + placement = MATE_BG_PLACEMENT_ZOOMED; + } + + g_settings_set_string (settings, BG_KEY_PICTURE_FILENAME, filename); + g_settings_set_string (settings, BG_KEY_PRIMARY_COLOR, primary); + g_settings_set_string (settings, BG_KEY_SECONDARY_COLOR, secondary); + g_settings_set_enum (settings, BG_KEY_COLOR_TYPE, color_type); + g_settings_set_enum (settings, BG_KEY_PICTURE_PLACEMENT, placement); + + g_object_unref (settings); g_free (primary); g_free (secondary); diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c index 8b45bab..2911ef5 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -2,6 +2,7 @@ * mate-thumbnail.c: Utilities for handling thumbnails * * Copyright (C) 2002 Red Hat, Inc. + * Copyright (C) 2010 Carlos Garcia Campos <[email protected]> * * This file is part of the Mate Library. * @@ -17,8 +18,8 @@ * * You should have received a copy of the GNU Library General Public * License along with the Mate Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. * * Author: Alexander Larsson <[email protected]> */ @@ -41,60 +42,234 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include "libmateui/mate-desktop-thumbnail.h" -#include <mateconf/mateconf.h> -#include <mateconf/mateconf-client.h> #include <glib/gstdio.h> +#include <gio/gunixinputstream.h> +#include <glib-unix.h> #define SECONDS_BETWEEN_STATS 10 struct _MateDesktopThumbnailFactoryPrivate { - MateDesktopThumbnailSize size; + MateDesktopThumbnailSize size; - GMutex* lock; + GMutex lock; - GHashTable *scripts_hash; - guint thumbnailers_notify; - guint reread_scheduled; -}; + GList *thumbnailers; + GHashTable *mime_types_map; + GList *monitors; -static const char* appname = "mate-thumbnail-factory"; + GSettings *settings; + gboolean loaded : 1; + gboolean disabled : 1; + gchar **disabled_types; +}; -static void mate_desktop_thumbnail_factory_init(MateDesktopThumbnailFactory* factory); -static void mate_desktop_thumbnail_factory_class_init(MateDesktopThumbnailFactoryClass* class); +static const char *appname = "mate-thumbnail-factory"; -G_DEFINE_TYPE (MateDesktopThumbnailFactory, mate_desktop_thumbnail_factory, G_TYPE_OBJECT) +static void mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory); +static void mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *class); +G_DEFINE_TYPE (MateDesktopThumbnailFactory, + mate_desktop_thumbnail_factory, + G_TYPE_OBJECT) #define parent_class mate_desktop_thumbnail_factory_parent_class #define MATE_DESKTOP_THUMBNAIL_FACTORY_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE((object), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((object), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryPrivate)) typedef struct { - gint width; - gint height; - gint input_width; - gint input_height; - gboolean preserve_aspect_ratio; + gint width; + gint height; + gint input_width; + gint input_height; + gboolean preserve_aspect_ratio; } SizePrepareContext; #define LOAD_BUFFER_SIZE 4096 +#define THUMBNAILER_ENTRY_GROUP "Thumbnailer Entry" +#define THUMBNAILER_EXTENSION ".thumbnailer" + +typedef struct { + volatile gint ref_count; + + gchar *path; + + gchar *try_exec; + gchar *command; + gchar **mime_types; +} Thumbnailer; + +static Thumbnailer * +thumbnailer_ref (Thumbnailer *thumb) +{ + g_return_val_if_fail (thumb != NULL, NULL); + g_return_val_if_fail (thumb->ref_count > 0, NULL); + + g_atomic_int_inc (&thumb->ref_count); + return thumb; +} + +static void +thumbnailer_unref (Thumbnailer *thumb) +{ + g_return_if_fail (thumb != NULL); + g_return_if_fail (thumb->ref_count > 0); + + if (g_atomic_int_dec_and_test (&thumb->ref_count)) + { + g_free (thumb->path); + g_free (thumb->try_exec); + g_free (thumb->command); + g_strfreev (thumb->mime_types); + + g_slice_free (Thumbnailer, thumb); + } +} + +static Thumbnailer * +thumbnailer_load (Thumbnailer *thumb) +{ + GKeyFile *key_file; + GError *error = NULL; + + key_file = g_key_file_new (); + if (!g_key_file_load_from_file (key_file, thumb->path, 0, &error)) + { + g_warning ("Failed to load thumbnailer from \"%s\": %s\n", thumb->path, error->message); + g_error_free (error); + thumbnailer_unref (thumb); + g_key_file_free (key_file); + + return NULL; + } + + if (!g_key_file_has_group (key_file, THUMBNAILER_ENTRY_GROUP)) + { + g_warning ("Invalid thumbnailer: missing group \"%s\"\n", THUMBNAILER_ENTRY_GROUP); + thumbnailer_unref (thumb); + g_key_file_free (key_file); + + return NULL; + } + + thumb->command = g_key_file_get_string (key_file, THUMBNAILER_ENTRY_GROUP, "Exec", NULL); + if (!thumb->command) + { + g_warning ("Invalid thumbnailer: missing Exec key\n"); + thumbnailer_unref (thumb); + g_key_file_free (key_file); + + return NULL; + } + + thumb->mime_types = g_key_file_get_string_list (key_file, THUMBNAILER_ENTRY_GROUP, "MimeType", NULL, NULL); + if (!thumb->mime_types) + { + g_warning ("Invalid thumbnailer: missing MimeType key\n"); + thumbnailer_unref (thumb); + g_key_file_free (key_file); + + return NULL; + } + + thumb->try_exec = g_key_file_get_string (key_file, THUMBNAILER_ENTRY_GROUP, "TryExec", NULL); + + g_key_file_free (key_file); + + return thumb; +} + +static Thumbnailer * +thumbnailer_reload (Thumbnailer *thumb) +{ + g_return_val_if_fail (thumb != NULL, NULL); + + g_free (thumb->command); + thumb->command = NULL; + g_strfreev (thumb->mime_types); + thumb->mime_types = NULL; + g_free (thumb->try_exec); + thumb->try_exec = NULL; + + return thumbnailer_load (thumb); +} + +static Thumbnailer * +thumbnailer_new (const gchar *path) +{ + Thumbnailer *thumb; + + thumb = g_slice_new0 (Thumbnailer); + thumb->ref_count = 1; + thumb->path = g_strdup (path); + + return thumbnailer_load (thumb); +} + +static gboolean +thumbnailer_try_exec (Thumbnailer *thumb) +{ + gchar *path; + gboolean retval; + + if (G_UNLIKELY (!thumb)) + return FALSE; + + /* TryExec is optinal, but Exec isn't, so we assume + * the thumbnailer can be run when TryExec is not present + */ + if (!thumb->try_exec) + return TRUE; + + path = g_find_program_in_path (thumb->try_exec); + retval = path != NULL; + g_free (path); + + return retval; +} + +static gpointer +init_thumbnailers_dirs (gpointer data) +{ + const gchar * const *data_dirs; + gchar **thumbs_dirs; + guint i, length; + + data_dirs = g_get_system_data_dirs (); + length = g_strv_length ((char **) data_dirs); + + thumbs_dirs = g_new (gchar *, length + 2); + thumbs_dirs[0] = g_build_filename (g_get_user_data_dir (), "thumbnailers", NULL); + for (i = 0; i < length; i++) + thumbs_dirs[i + 1] = g_build_filename (data_dirs[i], "thumbnailers", NULL); + thumbs_dirs[length + 1] = NULL; + + return thumbs_dirs; +} + +static const gchar * const * +get_thumbnailers_dirs (void) +{ + static GOnce once_init = G_ONCE_INIT; + return g_once (&once_init, init_thumbnailers_dirs, NULL); +} + static void -size_prepared_cb (GdkPixbufLoader *loader, +size_prepared_cb (GdkPixbufLoader *loader, int width, int height, gpointer data) { SizePrepareContext *info = data; - + g_return_if_fail (width > 0 && height > 0); - + info->input_width = width; info->input_height = height; - + if (width < info->width && height < info->height) return; - - if (info->preserve_aspect_ratio && + + if (info->preserve_aspect_ratio && (info->width > 0 || info->height > 0)) { if (info->width < 0) { @@ -120,10 +295,43 @@ size_prepared_cb (GdkPixbufLoader *loader, if (info->height > 0) height = info->height; } - + gdk_pixbuf_loader_set_size (loader, width, height); } +static GdkPixbufLoader * +create_loader (GFile *file, + const guchar *data, + gsize size) +{ + GdkPixbufLoader *loader; + GError *error = NULL; + char *mime_type; + char *filename; + + loader = NULL; + + /* need to specify the type here because the gdk_pixbuf_loader_write + doesn't have access to the filename in order to correct detect + the image type. */ + filename = g_file_get_basename (file); + mime_type = g_content_type_guess (filename, data, size, NULL); + g_free (filename); + + if (mime_type != NULL) { + loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, &error); + } + + if (loader == NULL) { + g_warning ("Unable to create loader for mime type %s: %s", mime_type, error->message); + g_clear_error (&error); + loader = gdk_pixbuf_loader_new (); + } + g_free (mime_type); + + return loader; +} + static GdkPixbuf * _gdk_pixbuf_new_from_uri_at_scale (const char *uri, gint width, @@ -131,10 +339,10 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, gboolean preserve_aspect_ratio) { gboolean result; - char buffer[LOAD_BUFFER_SIZE]; + guchar buffer[LOAD_BUFFER_SIZE]; gsize bytes_read; - GdkPixbufLoader *loader; - GdkPixbuf *pixbuf; + GdkPixbufLoader *loader = NULL; + GdkPixbuf *pixbuf; GdkPixbufAnimation *animation; GdkPixbufAnimationIter *iter; gboolean has_frame; @@ -142,6 +350,7 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, GFile *file; GFileInfo *file_info; GInputStream *input_stream; + GError *error = NULL; g_return_val_if_fail (uri != NULL, NULL); @@ -171,22 +380,30 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, } if (input_stream == NULL) { - input_stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL)); - if (input_stream == NULL) { - g_object_unref (file); - return NULL; + /* part of this code is taken from libgsystem */ + int fd; + char *path = g_file_get_path (file); + #ifdef O_NOATIME + fd = g_open (path, O_RDONLY | O_NOATIME, 0); + /* Only the owner or superuser may use O_NOATIME; so we may get + * EPERM. EINVAL may happen if the kernel is really old... + */ + if (fd == -1 && (errno == EPERM || errno == EINVAL)) + #endif + fd = g_open (path, O_RDONLY, 0); + if (fd >= 0) { + input_stream = g_unix_input_stream_new (fd, TRUE); + if (input_stream == NULL) { + if (error != NULL) { + g_warning ("Unable to create an input stream for %s: %s", uri, error->message); + g_clear_error (&error); + } + g_object_unref (file); + return NULL; + } } } - loader = gdk_pixbuf_loader_new (); - if (1 <= width || 1 <= height) { - info.width = width; - info.height = height; - info.input_width = info.input_height = 0; - info.preserve_aspect_ratio = preserve_aspect_ratio; - g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), &info); - } - has_frame = FALSE; result = FALSE; @@ -196,7 +413,11 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, buffer, sizeof (buffer), NULL, - NULL); + &error); + if (error != NULL) { + g_warning ("Error reading from %s: %s", uri, error->message); + g_clear_error (&error); + } if (bytes_read == -1) { break; } @@ -205,10 +426,24 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, break; } + if (loader == NULL) { + loader = create_loader (file, buffer, bytes_read); + if (1 <= width || 1 <= height) { + info.width = width; + info.height = height; + info.input_width = info.input_height = 0; + info.preserve_aspect_ratio = preserve_aspect_ratio; + g_signal_connect (loader, "size-prepared", G_CALLBACK (size_prepared_cb), &info); + } + g_assert (loader != NULL); + } + if (!gdk_pixbuf_loader_write (loader, (unsigned char *)buffer, bytes_read, - NULL)) { + &error)) { + g_warning ("Error creating thumbnail for %s: %s", uri, error->message); + g_clear_error (&error); result = FALSE; break; } @@ -255,199 +490,338 @@ mate_desktop_thumbnail_factory_finalize (GObject *object) { MateDesktopThumbnailFactory *factory; MateDesktopThumbnailFactoryPrivate *priv; - MateConfClient *client; - + factory = MATE_DESKTOP_THUMBNAIL_FACTORY (object); priv = factory->priv; - if (priv->reread_scheduled != 0) { - g_source_remove (priv->reread_scheduled); - priv->reread_scheduled = 0; - } + if (priv->thumbnailers) + { + g_list_free_full (priv->thumbnailers, (GDestroyNotify)thumbnailer_unref); + priv->thumbnailers = NULL; + } - if (priv->thumbnailers_notify != 0) { - client = mateconf_client_get_default (); - mateconf_client_notify_remove (client, priv->thumbnailers_notify); - priv->thumbnailers_notify = 0; - g_object_unref (client); - } + if (priv->mime_types_map) + { + g_hash_table_destroy (priv->mime_types_map); + priv->mime_types_map = NULL; + } - if (priv->scripts_hash) + if (priv->monitors) { - g_hash_table_destroy (priv->scripts_hash); - priv->scripts_hash = NULL; + g_list_free_full (priv->monitors, (GDestroyNotify)g_object_unref); + priv->monitors = NULL; } - if (priv->lock) + g_mutex_clear (&priv->lock); + + if (priv->disabled_types) { - g_mutex_free (priv->lock); - priv->lock = NULL; + g_strfreev (priv->disabled_types); + priv->disabled_types = NULL; + } + + if (priv->settings) + { + g_object_unref (priv->settings); + priv->settings = NULL; } if (G_OBJECT_CLASS (parent_class)->finalize) (* G_OBJECT_CLASS (parent_class)->finalize) (object); } -/* Must be called on main thread */ -static GHashTable * -read_scripts (void) +/* These should be called with the lock held */ +static void +mate_desktop_thumbnail_factory_register_mime_types (MateDesktopThumbnailFactory *factory, + Thumbnailer *thumb) { - GHashTable *scripts_hash; - MateConfClient *client; - GSList *subdirs, *l; - char *subdir, *enable, *escape, *commandkey, *command, *mimetype; - - client = mateconf_client_get_default (); + MateDesktopThumbnailFactoryPrivate *priv = factory->priv; + gint i; - if (mateconf_client_get_bool (client, - "/desktop/mate/thumbnailers/disable_all", - NULL)) + for (i = 0; thumb->mime_types[i]; i++) { - g_object_unref (G_OBJECT (client)); - return NULL; + if (!g_hash_table_lookup (priv->mime_types_map, thumb->mime_types[i])) + g_hash_table_insert (priv->mime_types_map, + g_strdup (thumb->mime_types[i]), + thumbnailer_ref (thumb)); } +} - scripts_hash = g_hash_table_new_full (g_str_hash, - g_str_equal, - g_free, g_free); +static void +mate_desktop_thumbnail_factory_add_thumbnailer (MateDesktopThumbnailFactory *factory, + Thumbnailer *thumb) +{ + MateDesktopThumbnailFactoryPrivate *priv = factory->priv; + mate_desktop_thumbnail_factory_register_mime_types (factory, thumb); + priv->thumbnailers = g_list_prepend (priv->thumbnailers, thumb); +} - subdirs = mateconf_client_all_dirs (client, "/desktop/mate/thumbnailers", NULL); +static gboolean +mate_desktop_thumbnail_factory_is_disabled (MateDesktopThumbnailFactory *factory, + const gchar *mime_type) +{ + MateDesktopThumbnailFactoryPrivate *priv = factory->priv; + guint i; - for (l = subdirs; l != NULL; l = l->next) - { - subdir = l->data; + if (priv->disabled) + return TRUE; - enable = g_strdup_printf ("%s/enable", subdir); - if (mateconf_client_get_bool (client, - enable, - NULL)) - { - commandkey = g_strdup_printf ("%s/command", subdir); - command = mateconf_client_get_string (client, commandkey, NULL); - g_free (commandkey); - - if (command != NULL) { - mimetype = strrchr (subdir, '/'); - if (mimetype != NULL) - { - mimetype++; /* skip past slash */ - - /* Convert '@' to slash in mimetype */ - escape = strchr (mimetype, '@'); - if (escape != NULL) - *escape = '/'; - - /* Convert any remaining '@' to '+' in mimetype */ - while ((escape = strchr (mimetype, '@')) != NULL) - *escape = '+'; - - g_hash_table_insert (scripts_hash, - g_strdup (mimetype), command); - } - else - { - g_free (command); - } - } - } - g_free (enable); + if (!priv->disabled_types) + return FALSE; - g_free (subdir); + for (i = 0; priv->disabled_types[i]; i++) + { + if (g_strcmp0 (priv->disabled_types[i], mime_type) == 0) + return TRUE; } - g_slist_free(subdirs); - - g_object_unref (G_OBJECT (client)); + return FALSE; +} - return scripts_hash; +static gboolean +remove_thumbnailer_from_mime_type_map (gchar *key, + Thumbnailer *value, + gchar *path) +{ + return (strcmp (value->path, path) == 0); } -/* Must be called on main thread */ static void -mate_desktop_thumbnail_factory_reread_scripts (MateDesktopThumbnailFactory *factory) +update_or_create_thumbnailer (MateDesktopThumbnailFactory *factory, + const gchar *path) { MateDesktopThumbnailFactoryPrivate *priv = factory->priv; - GHashTable *scripts_hash; + GList *l; + Thumbnailer *thumb; + gboolean found = FALSE; - scripts_hash = read_scripts (); + g_mutex_lock (&priv->lock); - g_mutex_lock (priv->lock); + for (l = priv->thumbnailers; l && !found; l = g_list_next (l)) + { + thumb = (Thumbnailer *)l->data; - if (priv->scripts_hash != NULL) - g_hash_table_destroy (priv->scripts_hash); + if (strcmp (thumb->path, path) == 0) + { + found = TRUE; + + /* First remove the mime_types associated to this thumbnailer */ + g_hash_table_foreach_remove (priv->mime_types_map, + (GHRFunc)remove_thumbnailer_from_mime_type_map, + (gpointer)path); + if (!thumbnailer_reload (thumb)) + priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l); + else + mate_desktop_thumbnail_factory_register_mime_types (factory, thumb); + } + } - priv->scripts_hash = scripts_hash; + if (!found) + { + thumb = thumbnailer_new (path); + if (thumb) + mate_desktop_thumbnail_factory_add_thumbnailer (factory, thumb); + } - g_mutex_unlock (priv->lock); + g_mutex_unlock (&priv->lock); } -static gboolean -reread_idle_callback (gpointer user_data) +static void +remove_thumbnailer (MateDesktopThumbnailFactory *factory, + const gchar *path) { - MateDesktopThumbnailFactory *factory = user_data; MateDesktopThumbnailFactoryPrivate *priv = factory->priv; + GList *l; + Thumbnailer *thumb; - mate_desktop_thumbnail_factory_reread_scripts (factory); + g_mutex_lock (&priv->lock); - g_mutex_lock (priv->lock); - priv->reread_scheduled = 0; - g_mutex_unlock (priv->lock); + for (l = priv->thumbnailers; l; l = g_list_next (l)) + { + thumb = (Thumbnailer *)l->data; - return FALSE; + if (strcmp (thumb->path, path) == 0) + { + priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l); + g_hash_table_foreach_remove (priv->mime_types_map, + (GHRFunc)remove_thumbnailer_from_mime_type_map, + (gpointer)path); + thumbnailer_unref (thumb); + + break; + } + } + + g_mutex_unlock (&priv->lock); +} + +static void +thumbnailers_directory_changed (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type, + MateDesktopThumbnailFactory *factory) +{ + gchar *path; + + switch (event_type) + { + case G_FILE_MONITOR_EVENT_CREATED: + case G_FILE_MONITOR_EVENT_CHANGED: + case G_FILE_MONITOR_EVENT_DELETED: + path = g_file_get_path (file); + if (!g_str_has_suffix (path, THUMBNAILER_EXTENSION)) + { + g_free (path); + return; + } + + if (event_type == G_FILE_MONITOR_EVENT_DELETED) + remove_thumbnailer (factory, path); + else + update_or_create_thumbnailer (factory, path); + + g_free (path); + break; + default: + break; + } } static void -schedule_reread (MateConfClient* client, - guint cnxn_id, - MateConfEntry *entry, - gpointer user_data) +mate_desktop_thumbnail_factory_load_thumbnailers (MateDesktopThumbnailFactory *factory) { - MateDesktopThumbnailFactory *factory = user_data; MateDesktopThumbnailFactoryPrivate *priv = factory->priv; + const gchar * const *dirs; + guint i; - g_mutex_lock (priv->lock); + if (priv->loaded) + return; - if (priv->reread_scheduled == 0) + dirs = get_thumbnailers_dirs (); + for (i = 0; dirs[i]; i++) { - priv->reread_scheduled = g_idle_add (reread_idle_callback, - factory); + const gchar *path = dirs[i]; + GDir *dir; + GFile *dir_file; + GFileMonitor *monitor; + const gchar *dirent; + + dir = g_dir_open (path, 0, NULL); + if (!dir) + continue; + + /* Monitor dir */ + dir_file = g_file_new_for_path (path); + monitor = g_file_monitor_directory (dir_file, + G_FILE_MONITOR_NONE, + NULL, NULL); + if (monitor) + { + g_signal_connect (monitor, "changed", + G_CALLBACK (thumbnailers_directory_changed), + factory); + priv->monitors = g_list_prepend (priv->monitors, monitor); + } + g_object_unref (dir_file); + + while ((dirent = g_dir_read_name (dir))) + { + Thumbnailer *thumb; + gchar *filename; + + if (!g_str_has_suffix (dirent, THUMBNAILER_EXTENSION)) + continue; + + filename = g_build_filename (path, dirent, NULL); + thumb = thumbnailer_new (filename); + g_free (filename); + + if (thumb) + mate_desktop_thumbnail_factory_add_thumbnailer (factory, thumb); + } + + g_dir_close (dir); } - g_mutex_unlock (priv->lock); + priv->loaded = TRUE; } - static void -mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory) +external_thumbnailers_disabled_all_changed_cb (GSettings *settings, + const gchar *key, + MateDesktopThumbnailFactory *factory) { - MateConfClient *client; - MateDesktopThumbnailFactoryPrivate *priv; + MateDesktopThumbnailFactoryPrivate *priv = factory->priv; - factory->priv = MATE_DESKTOP_THUMBNAIL_FACTORY_GET_PRIVATE (factory); + g_mutex_lock (&priv->lock); - priv = factory->priv; + priv->disabled = g_settings_get_boolean (priv->settings, "disable-all"); + if (priv->disabled) + { + g_strfreev (priv->disabled_types); + priv->disabled_types = NULL; + } + else + { + priv->disabled_types = g_settings_get_strv (priv->settings, "disable"); + mate_desktop_thumbnail_factory_load_thumbnailers (factory); + } - priv->size = MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL; + g_mutex_unlock (&priv->lock); +} - priv->scripts_hash = NULL; +static void +external_thumbnailers_disabled_changed_cb (GSettings *settings, + const gchar *key, + MateDesktopThumbnailFactory *factory) +{ + MateDesktopThumbnailFactoryPrivate *priv = factory->priv; - priv->lock = g_mutex_new (); + g_mutex_lock (&priv->lock); - client = mateconf_client_get_default (); - mateconf_client_add_dir (client, - "/desktop/mate/thumbnailers", - MATECONF_CLIENT_PRELOAD_RECURSIVE, NULL); + if (priv->disabled) + return; + g_strfreev (priv->disabled_types); + priv->disabled_types = g_settings_get_strv (priv->settings, "disable"); - mate_desktop_thumbnail_factory_reread_scripts (factory); + g_mutex_unlock (&priv->lock); +} - priv->thumbnailers_notify = mateconf_client_notify_add (client, "/desktop/mate/thumbnailers", - schedule_reread, factory, NULL, - NULL); +static void +mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory) +{ + MateDesktopThumbnailFactoryPrivate *priv; + + factory->priv = MATE_DESKTOP_THUMBNAIL_FACTORY_GET_PRIVATE (factory); - g_object_unref (G_OBJECT (client)); + priv = factory->priv; + + priv->size = MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL; + + priv->mime_types_map = g_hash_table_new_full (g_str_hash, + g_str_equal, + (GDestroyNotify)g_free, + (GDestroyNotify)thumbnailer_unref); + + g_mutex_init (&priv->lock); + + priv->settings = g_settings_new ("org.mate.desktop.thumbnailers"); + priv->disabled = g_settings_get_boolean (priv->settings, "disable-all"); + if (!priv->disabled) + priv->disabled_types = g_settings_get_strv (priv->settings, "disable"); + g_signal_connect (priv->settings, "changed::disable-all", + G_CALLBACK (external_thumbnailers_disabled_all_changed_cb), + factory); + g_signal_connect (priv->settings, "changed::disable", + G_CALLBACK (external_thumbnailers_disabled_changed_cb), + factory); + + if (!priv->disabled) + mate_desktop_thumbnail_factory_load_thumbnailers (factory); } static void @@ -456,7 +830,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (class); - + gobject_class->finalize = mate_desktop_thumbnail_factory_finalize; g_type_class_add_private (class, sizeof (MateDesktopThumbnailFactoryPrivate)); @@ -469,7 +843,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla * Creates a new #MateDesktopThumbnailFactory. * * This function must be called on the main thread. - * + * * Return value: a new #MateDesktopThumbnailFactory * * Since: 2.2 @@ -478,11 +852,11 @@ MateDesktopThumbnailFactory * mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size) { MateDesktopThumbnailFactory *factory; - + factory = g_object_new (MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, NULL); - + factory->priv->size = size; - + return factory; } @@ -524,9 +898,9 @@ mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory, g_assert (digest_len == 16); file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - - path = g_build_filename (g_get_home_dir (), - ".thumbnails", + + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", (priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", file, NULL); @@ -586,8 +960,8 @@ mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailF file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - path = g_build_filename (g_get_home_dir (), - ".thumbnails/fail", + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails/fail", appname, file, NULL); @@ -607,55 +981,52 @@ mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailF return res; } -static gboolean mimetype_supported_by_gdk_pixbuf(const char* mime_type) +static gboolean +mimetype_supported_by_gdk_pixbuf (const char *mime_type) { - guint i; - static GHashTable* formats_hash = NULL; - gchar* key; - gboolean result; - - if (!formats_hash) - { - GSList* formats; - GSList* list; - - formats_hash = g_hash_table_new_full(g_str_hash, g_content_type_equals, g_free, NULL); + guint i; + static gsize formats_hash = 0; + gchar *key; + gboolean result; - formats = gdk_pixbuf_get_formats(); - list = formats; + if (g_once_init_enter (&formats_hash)) { + GSList *formats, *list; + GHashTable *hash; - while (list) - { - GdkPixbufFormat* format = list->data; - gchar** mime_types = gdk_pixbuf_format_get_mime_types(format); + hash = g_hash_table_new_full (g_str_hash, + (GEqualFunc) g_content_type_equals, + g_free, NULL); - for (i = 0; mime_types[i] != NULL; i++) - { - g_hash_table_insert(formats_hash, (gpointer) g_content_type_from_mime_type(mime_types[i]), GUINT_TO_POINTER(1)); - } + formats = gdk_pixbuf_get_formats (); + list = formats; - g_strfreev(mime_types); + while (list) { + GdkPixbufFormat *format = list->data; + gchar **mime_types; - list = list->next; - } + mime_types = gdk_pixbuf_format_get_mime_types (format); - g_slist_free(formats); - } + for (i = 0; mime_types[i] != NULL; i++) + g_hash_table_insert (hash, + (gpointer) g_content_type_from_mime_type (mime_types[i]), + GUINT_TO_POINTER (1)); - key = g_content_type_from_mime_type(mime_type); + g_strfreev (mime_types); + list = list->next; + } + g_slist_free (formats); - if (g_hash_table_lookup(formats_hash, key)) - { - result = TRUE; - } - else - { - result = FALSE; - } + g_once_init_leave (&formats_hash, (gsize) hash); + } - g_free(key); + key = g_content_type_from_mime_type (mime_type); + if (g_hash_table_lookup ((void*)formats_hash, key)) + result = TRUE; + else + result = FALSE; + g_free (key); - return result; + return result; } /** @@ -680,21 +1051,26 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto const char *mime_type, time_t mtime) { - gboolean have_script; + gboolean have_script = FALSE; /* Don't thumbnail thumbnails */ if (uri && strncmp (uri, "file:/", 6) == 0 && - strstr (uri, "/.thumbnails/") != NULL) + strstr (uri, "/thumbnails/") != NULL) return FALSE; - + if (!mime_type) return FALSE; - g_mutex_lock (factory->priv->lock); - have_script = (factory->priv->scripts_hash != NULL && - g_hash_table_lookup (factory->priv->scripts_hash, mime_type)); - g_mutex_unlock (factory->priv->lock); + g_mutex_lock (&factory->priv->lock); + if (!mate_desktop_thumbnail_factory_is_disabled (factory, mime_type)) + { + Thumbnailer *thumb; + + thumb = g_hash_table_lookup (factory->priv->mime_types_map, mime_type); + have_script = thumbnailer_try_exec (thumb); + } + g_mutex_unlock (&factory->priv->lock); if (have_script || mimetype_supported_by_gdk_pixbuf (mime_type)) { @@ -702,13 +1078,13 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto uri, mtime); } - + return FALSE; } static char * expand_thumbnailing_script (const char *script, - const int size, + const int size, const char *inuri, const char *outfile) { @@ -718,7 +1094,7 @@ expand_thumbnailing_script (const char *script, gboolean got_in; str = g_string_new (NULL); - + got_in = FALSE; last = script; while ((p = strchr (last, '%')) != NULL) @@ -786,7 +1162,7 @@ expand_thumbnailing_script (const char *script, * * Usage of this function is threadsafe. * - * Return value: thumbnail pixbuf if thumbnailing succeeded, %NULL otherwise. + * Return value: (transfer full): thumbnail pixbuf if thumbnailing succeeded, %NULL otherwise. * * Since: 2.2 **/ @@ -809,7 +1185,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * g_return_val_if_fail (mime_type != NULL, NULL); /* Doesn't access any volatile fields in factory, so it's threadsafe */ - + size = 128; if (factory->priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_LARGE) size = 256; @@ -817,15 +1193,17 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * pixbuf = NULL; script = NULL; - g_mutex_lock (factory->priv->lock); - if (factory->priv->scripts_hash != NULL) + g_mutex_lock (&factory->priv->lock); + if (!mate_desktop_thumbnail_factory_is_disabled (factory, mime_type)) { - script = g_hash_table_lookup (factory->priv->scripts_hash, mime_type); - if (script) - script = g_strdup (script); - } - g_mutex_unlock (factory->priv->lock); + Thumbnailer *thumb; + thumb = g_hash_table_lookup (factory->priv->mime_types_map, mime_type); + if (thumb) + script = g_strdup (thumb->command); + } + g_mutex_unlock (&factory->priv->lock); + if (script) { int fd; @@ -846,7 +1224,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * } g_free (expanded_script); - g_unlink(tmpname); + g_unlink (tmpname); g_free (tmpname); } @@ -866,7 +1244,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * "mate-original-height")); } } - + if (pixbuf == NULL) return NULL; @@ -879,7 +1257,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); - + if (width > size || height > size) { const gchar *orig_width, *orig_height; @@ -898,11 +1276,11 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * if (orig_height != NULL) { gdk_pixbuf_set_option (scaled, "tEXt::Thumb::Image::Height", orig_height); } - + g_object_unref (pixbuf); pixbuf = scaled; } - + if (original_width > 0) { g_snprintf (dimension, sizeof (dimension), "%i", original_width); gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Width", dimension); @@ -924,8 +1302,8 @@ make_thumbnail_dirs (MateDesktopThumbnailFactory *factory) res = FALSE; - thumbnail_dir = g_build_filename (g_get_home_dir (), - ".thumbnails", + thumbnail_dir = g_build_filename (g_get_user_cache_dir (), + "thumbnails", NULL); if (!g_file_test (thumbnail_dir, G_FILE_TEST_IS_DIR)) { @@ -944,7 +1322,7 @@ make_thumbnail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (image_dir); - + return res; } @@ -958,8 +1336,8 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) res = FALSE; - thumbnail_dir = g_build_filename (g_get_home_dir (), - ".thumbnails", + thumbnail_dir = g_build_filename (g_get_user_cache_dir (), + "thumbnails", NULL); if (!g_file_test (thumbnail_dir, G_FILE_TEST_IS_DIR)) { @@ -988,7 +1366,7 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (fail_dir); g_free (app_dir); - + return res; } @@ -996,9 +1374,9 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) /** * mate_desktop_thumbnail_factory_save_thumbnail: * @factory: a #MateDesktopThumbnailFactory - * @thumbnail: the thumbnail as a pixbuf + * @thumbnail: the thumbnail as a pixbuf * @uri: the uri of a file - * @original_mtime: the modification time of the original file + * @original_mtime: the modification time of the original file * * Saves @thumbnail at the right place. If the save fails a * failed thumbnail is written. @@ -1023,6 +1401,7 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact GChecksum *checksum; guint8 digest[16]; gsize digest_len = sizeof (digest); + GError *error; checksum = g_checksum_new (G_CHECKSUM_MD5); g_checksum_update (checksum, (const guchar *) uri, strlen (uri)); @@ -1032,8 +1411,8 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - path = g_build_filename (g_get_home_dir (), - ".thumbnails", + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", (priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", file, NULL); @@ -1061,15 +1440,16 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", original_mtime); width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width"); height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height"); - if (width != NULL && height != NULL) + error = NULL; + if (width != NULL && height != NULL) saved_ok = gdk_pixbuf_save (thumbnail, tmp_path, - "png", NULL, + "png", &error, "tEXt::Thumb::Image::Width", width, "tEXt::Thumb::Image::Height", height, "tEXt::Thumb::URI", uri, @@ -1079,21 +1459,24 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact else saved_ok = gdk_pixbuf_save (thumbnail, tmp_path, - "png", NULL, + "png", &error, "tEXt::Thumb::URI", uri, "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", NULL); - + if (saved_ok) { g_chmod (tmp_path, 0600); - g_rename(tmp_path, path); + g_rename (tmp_path, path); } else { + g_warning ("Failed to create thumbnail %s: %s", tmp_path, error->message); mate_desktop_thumbnail_factory_create_failed_thumbnail (factory, uri, original_mtime); + g_unlink (tmp_path); + g_clear_error (&error); } g_free (path); @@ -1136,8 +1519,8 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - path = g_build_filename (g_get_home_dir (), - ".thumbnails/fail", + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails/fail", appname, file, NULL); @@ -1163,12 +1546,12 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", mtime); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); saved_ok = gdk_pixbuf_save (pixbuf, tmp_path, - "png", NULL, + "png", NULL, "tEXt::Thumb::URI", uri, "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", @@ -1194,8 +1577,7 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact * Return value: A string with the MD5 digest of the uri string. * * Since: 2.2 - * - * @Deprecated: 2.22: Use #GChecksum instead + * Deprecated: 2.22: Use #GChecksum instead **/ char * mate_desktop_thumbnail_md5 (const char *uri) @@ -1227,13 +1609,13 @@ mate_desktop_thumbnail_path_for_uri (const char *uri, md5 = mate_desktop_thumbnail_md5 (uri); file = g_strconcat (md5, ".png", NULL); g_free (md5); - - path = g_build_filename (g_get_home_dir (), - ".thumbnails", + + path = g_build_filename (g_get_user_cache_dir (), + "thumbnails", (size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", file, NULL); - + g_free (file); return path; @@ -1256,7 +1638,7 @@ mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf, const char *uri) { const char *thumb_uri; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; @@ -1284,19 +1666,19 @@ mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, { const char *thumb_uri, *thumb_mtime_str; time_t thumb_mtime; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; if (strcmp (uri, thumb_uri) != 0) return FALSE; - + thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); if (!thumb_mtime_str) return FALSE; thumb_mtime = atol (thumb_mtime_str); if (mtime != thumb_mtime) return FALSE; - + return TRUE; } diff --git a/libmate-desktop/mate-desktop-utils.c b/libmate-desktop/mate-desktop-utils.c index 003a37f..a0a6877 100644 --- a/libmate-desktop/mate-desktop-utils.c +++ b/libmate-desktop/mate-desktop-utils.c @@ -26,7 +26,7 @@ #include <config.h> #include <glib.h> -#include <mateconf/mateconf-client.h> +#include <gio/gio.h> #include <glib/gi18n-lib.h> #define MATE_DESKTOP_USE_UNSTABLE_API @@ -57,7 +57,7 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv) int i, j; char **term_argv = NULL; int term_argc = 0; - MateConfClient *client; + GSettings *settings; gchar *terminal = NULL; @@ -81,14 +81,13 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv) *argc = i; } - client = mateconf_client_get_default (); - terminal = mateconf_client_get_string (client, "/desktop/mate/applications/terminal/exec", NULL); - g_object_unref (client); + settings = g_settings_new ("org.mate.applications-terminal"); + terminal = g_settings_get_string (settings, "exec"); if (terminal) { gchar *command_line; gchar *exec_flag; - exec_flag = mateconf_client_get_string (client, "/desktop/mate/applications/terminal/exec_arg", NULL); + exec_flag = g_settings_get_string (settings, "exec-arg"); if (exec_flag == NULL) command_line = g_strdup (terminal); @@ -105,6 +104,7 @@ mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv) g_free (exec_flag); g_free (terminal); } + g_object_unref (settings); if (term_argv == NULL) { char *check; diff --git a/schemas/Makefile.am b/schemas/Makefile.am new file mode 100644 index 0000000..f415f72 --- /dev/null +++ b/schemas/Makefile.am @@ -0,0 +1,28 @@ +gsettings_SCHEMAS = \ + org.mate.accessibility-keyboard.gschema.xml \ + org.mate.accessibility-startup.gschema.xml \ + org.mate.applications-at-mobility.gschema.xml \ + org.mate.applications-at-visual.gschema.xml \ + org.mate.applications-browser.gschema.xml \ + org.mate.applications-office.gschema.xml \ + org.mate.applications-terminal.gschema.xml \ + org.mate.background.gschema.xml \ + org.mate.file-views.gschema.xml \ + org.mate.interface.gschema.xml \ + org.mate.lockdown.gschema.xml \ + org.mate.peripherals-keyboard.gschema.xml \ + org.mate.peripherals-mouse.gschema.xml \ + org.mate.sound.gschema.xml \ + org.mate.thumbnail-cache.gschema.xml \ + org.mate.thumbnailers.gschema.xml \ + org.mate.typing-break.gschema.xml +@GSETTINGS_RULES@ + +org.mate.background.gschema.xml: org.mate.background.gschema.xml.in Makefile + $(AM_V_GEN) $(SED) -e 's^\@datadir\@^$(datadir)^g' < $(srcdir)/org.mate.background.gschema.xml.in > org.mate.background.gschema.xml + +EXTRA_DIST = \ + $(gsettings_SCHEMAS) + +CLEANFILES = \ + org.mate.background.gschema.xml diff --git a/schemas/org.mate.accessibility-keyboard.gschema.xml b/schemas/org.mate.accessibility-keyboard.gschema.xml new file mode 100644 index 0000000..8b3d533 --- /dev/null +++ b/schemas/org.mate.accessibility-keyboard.gschema.xml @@ -0,0 +1,76 @@ +<schemalist> + <schema id="org.mate.accessibility-keyboard" path="/desktop/mate/accessibility/keyboard/"> + <key name="enable" type="b"> + <default>false</default> + </key> + <key name="feature-state-change-beep" type="b"> + <default>false</default> + </key> + <key name="timeout-enable" type="b"> + <default>false</default> + </key> + <key name="timeout" type="i"> + <default>200</default> + </key> + <key name="bouncekeys-enable" type="b"> + <default>false</default> + </key> + <key name="bouncekeys-delay" type="i"> + <default>300</default> + <summary>minimum interval in milliseconds</summary> + <description>Ignore multiple presses of the _same_ key within @delay milliseconds.</description> + </key> + <key name="bouncekeys-beep-reject" type="b"> + <default>false</default> + </key> + <key name="mousekeys-enable" type="b"> + <default>false</default> + </key> + <key name="mousekeys-max-speed" type="i"> + <default>10</default> + <summary>Pixels per seconds</summary> + <description>How many pixels per second to move at the maximum speed.</description> + </key> + <key name="mousekeys-accel-time" type="i"> + <default>300</default> + <summary>How long to accelerate in milliseconds</summary> + <description>How many milliseconds it takes to go from 0 to maximum speed.</description> + </key> + <key name="mousekeys-init-delay" type="i"> + <default>300</default> + <summary>Initial delay in milliseconds</summary> + <description>How many milliseconds to wait before mouse movement keys start to operate.</description> + </key> + <key name="slowkeys-enable" type="b"> + <default>false</default> + </key> + <key name="slowkeys-delay" type="i"> + <default>300</default> + <summary>Minimum interval in milliseconds</summary> + <description>Do not accept a key as being pressed unless held for @delay milliseconds.</description> + </key> + <key name="slowkeys-beep-press" type="b"> + <default>false</default> + </key> + <key name="slowkeys-beep-accept" type="b"> + <default>false</default> + </key> + <key name="slowkeys-beep-reject" type="b"> + <default>false</default> + </key> + <key name="stickykeys-enable" type="b"> + <default>false</default> + </key> + <key name="stickykeys-two-key-off" type="b"> + <default>false</default> + <description>Disable if two keys are pressed at the same time.</description> + </key> + <key name="stickykeys-modifier-beep" type="b"> + <default>false</default> + <description>Beep when a modifier is pressed.</description> + </key> + <key name="togglekeys-enable" type="b"> + <default>false</default> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.accessibility-startup.gschema.xml b/schemas/org.mate.accessibility-startup.gschema.xml new file mode 100644 index 0000000..53cf47d --- /dev/null +++ b/schemas/org.mate.accessibility-startup.gschema.xml @@ -0,0 +1,9 @@ +<schemalist> + <schema id="org.mate.accessibility-startup" path="/desktop/mate/accessibility/startup/"> + <key name="exec-ats" type="as"> + <default>[]</default> + <summary>Startup Assistive Technology Applications</summary> + <description>List of assistive technology applications to start when logging into the MATE desktop.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.applications-at-mobility.gschema.xml b/schemas/org.mate.applications-at-mobility.gschema.xml new file mode 100644 index 0000000..53c17b4 --- /dev/null +++ b/schemas/org.mate.applications-at-mobility.gschema.xml @@ -0,0 +1,14 @@ +<schemalist> + <schema id="org.mate.applications-at-mobility" path="/desktop/mate/applications/at/mobility/"> + <key name="exec" type="s"> + <default>'dasher'</default> + <summary>Preferred Mobility assistive technology application</summary> + <description>Preferred Mobility assistive technology application to be used for login, menu, or command line.</description> + </key> + <key name="startup" type="b"> + <default>false</default> + <summary>Start preferred Mobility assistive technology application</summary> + <description>MATE to start preferred Mobility assistive technology application during login.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.applications-at-visual.gschema.xml b/schemas/org.mate.applications-at-visual.gschema.xml new file mode 100644 index 0000000..11aa893 --- /dev/null +++ b/schemas/org.mate.applications-at-visual.gschema.xml @@ -0,0 +1,14 @@ +<schemalist> + <schema id="org.mate.applications-at-visual" path="/desktop/mate/applications/at/visual/"> + <key name="exec" type="s"> + <default>'orca'</default> + <summary>Preferred Visual assistive technology application</summary> + <description>Preferred Visual assistive technology application be used for login, menu, or command line.</description> + </key> + <key name="startup" type="b"> + <default>false</default> + <summary>Start preferred Visual assistive technology application</summary> + <description>MATE to start preferred Visual assistive technology application during login.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.applications-browser.gschema.xml b/schemas/org.mate.applications-browser.gschema.xml new file mode 100644 index 0000000..4f19929 --- /dev/null +++ b/schemas/org.mate.applications-browser.gschema.xml @@ -0,0 +1,19 @@ +<schemalist> + <schema id="org.mate.applications-browsser" path="/desktop/mate/applications/browser/"> + <key name="exec" type="s"> + <default>'mozilla'</default> + <summary>Default browser</summary> + <description>Default browser for all URLs.</description> + </key> + <key name="needs-term" type="b"> + <default>false</default> + <summary>Browser needs terminal</summary> + <description>Whether the default browser needs a terminal to run.</description> + </key> + <key name="nremote" type="b"> + <default>true</default> + <summary>Browser understands remote</summary> + <description>Whether the default browser understands netscape remote.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.applications-office.gschema.xml b/schemas/org.mate.applications-office.gschema.xml new file mode 100644 index 0000000..ba019c6 --- /dev/null +++ b/schemas/org.mate.applications-office.gschema.xml @@ -0,0 +1,30 @@ +<schemalist> + <schema id="org.mate.applications-office" path="/desktop/mate/applications/"> + <child name="calendar" schema="org.mate.applications-office.calendar"/> + <child name="tasks" schema="org.mate.applications-office.tasks"/> + </schema> + <schema id="org.mate.applications-office.calendar" path="/desktop/mate/applications/calendar/"> + <key name="exec" type="s"> + <default>'evolution'</default> + <summary>Default calendar</summary> + <description>Default calendar application</description> + </key> + <key name="needs-term" type="b"> + <default>false</default> + <summary>Calendar needs terminal</summary> + <description>Whether the default calendar application needs a terminal to run</description> + </key> + </schema> + <schema id="org.mate.applications-office.tasks" path="/desktop/mate/applications/tasks/"> + <key name="exec" type="s"> + <default>'evolution'</default> + <summary>Default tasks</summary> + <description>Default tasks application</description> + </key> + <key name="needs-term" type="b"> + <default>false</default> + <summary>Tasks needs terminal</summary> + <description>Whether the default tasks application needs a terminal to run</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.applications-terminal.gschema.xml b/schemas/org.mate.applications-terminal.gschema.xml new file mode 100644 index 0000000..290c720 --- /dev/null +++ b/schemas/org.mate.applications-terminal.gschema.xml @@ -0,0 +1,14 @@ +<schemalist> + <schema id="org.mate.applications-terminal" path="/desktop/mate/applications/terminal/"> + <key name="exec" type="s"> + <default>'mate-terminal'</default> + <summary>Terminal application</summary> + <description>Terminal program to use when starting applications that require one.</description> + </key> + <key name="exec-arg" type="s"> + <default>'-x'</default> + <summary>Exec Arguments</summary> + <description>Argument used to execute programs in the terminal defined by the 'exec' key.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.background.gschema.xml.in b/schemas/org.mate.background.gschema.xml.in new file mode 100644 index 0000000..b147e04 --- /dev/null +++ b/schemas/org.mate.background.gschema.xml.in @@ -0,0 +1,52 @@ +<schemalist> + <enum id="org.mate.background.picture-options-enum"> + <value nick="wallpaper" value="0"/> + <value nick="zoom" value="1"/> + <value nick="centered" value="2"/> + <value nick="scaled" value="3"/> + <value nick="stretched" value="4"/> + <value nick="spanned" value="5"/> + </enum> + <enum id="org.mate.background.color-shading-type-enum"> + <value nick="solid" value="0"/> + <value nick="horizontal-gradient" value="1"/> + <value nick="vertical-gradient" value="2"/> + </enum> + <schema id="org.mate.background" path="/desktop/mate/background/"> + <key name="draw-background" type="b"> + <default>true</default> + <summary>Draw Desktop Background</summary> + <description>Have MATE draw the desktop background.</description> + </key> + <key name="picture-options" enum="org.mate.background.picture-options-enum"> + <default>'zoom'</default> + <summary>Picture Options</summary> + <description>Determines how the image set by wallpaper_filename is rendered. Possible values are "wallpaper", "centered", "scaled", "stretched", "zoom", "spanned".</description> + </key> + <key name="picture-filename" type="s"> + <default>'@datadir@/pixmaps/backgrounds/mate/desktop/Stripes.png'</default> + <summary>Picture Filename</summary> + <description>File to use for the background image.</description> + </key> + <key name="picture-opacity" type="i"> + <default>100</default> + <summary>Picture Opacity</summary> + <description>Opacity with which to draw the background picture.</description> + </key> + <key name="primary-color" type="s"> + <default>'#5891BC'</default> + <summary>Primary Color</summary> + <description>Left or Top color when drawing gradients, or the solid color.</description> + </key> + <key name="secondary-color" type="s"> + <default>'#3C8F25'</default> + <summary>Secondary Color</summary> + <description>Right or Bottom color when drawing gradients, not used for solid color.</description> + </key> + <key name="color-shading-type" enum="org.mate.background.color-shading-type-enum"> + <default>'vertical-gradient'</default> + <summary>Color Shading Type</summary> + <description>How to shade the background color. Possible values are "horizontal-gradient", "vertical-gradient", and "solid".</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.file-views.gschema.xml b/schemas/org.mate.file-views.gschema.xml new file mode 100644 index 0000000..ad0989d --- /dev/null +++ b/schemas/org.mate.file-views.gschema.xml @@ -0,0 +1,9 @@ +<schemalist> + <schema id="org.mate.file-views" path="/desktop/mate/file-views/"> + <key name="icon-theme" type="s"> + <default>'crux_teal'</default> + <summary>File Icon Theme</summary> + <description>Theme used for displaying file icons.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.interface.gschema.xml.in b/schemas/org.mate.interface.gschema.xml.in new file mode 100644 index 0000000..e009984 --- /dev/null +++ b/schemas/org.mate.interface.gschema.xml.in @@ -0,0 +1,139 @@ +<schemalist> + <schema id="org.mate.interface" path="/desktop/mate/interface/"> + <key name="accessibility" type="b"> + <default>false</default> + <summary>Enable Accessibility</summary> + <description>Whether Applications should have accessibility support.</description> + </key> + <key name="enable-animations" type="b"> + <default>true</default> + <summary>Enable Animations</summary> + <description>Whether animations should be displayed. Note: This is a global key, it changes the behaviour of the window manager, the panel etc.</description> + </key> + <key name="menus-have-tearoff" type="b"> + <default>false</default> + <summary>Menus Have Tearoff</summary> + <description>Whether menus should have a tearoff.</description> + </key> + <key name="can-change-accels" type="b"> + <default>false</default> + <summary>Can Change Accels</summary> + <description>Whether the user can dynamically type a new accelerator when positioned over an active menuitem.</description> + </key> + <key name="toolbar-style" type="s"> + <default>'both-horiz'</default> + <summary>Toolbar Style</summary> + <description>Toolbar Style. Valid values are "both", "both-horiz", "icons", and "text".</description> + </key> + <key name="menus-have-icons" type="b"> + <default>true</default> + <summary>Menus Have Icons</summary> + <description>Whether menus may display an icon next to a menu entry.</description> + </key> + <key name="buttons-have-icons" type="b"> + <default>true</default> + <summary>Buttons Have Icons</summary> + <description>Whether buttons may display an icon in addition to the button text.</description> + </key> + <key name="menubar-detachable" type="b"> + <default>false</default> + <summary>Menubar Detachable</summary> + <description>Whether the user can detach menubars and move them around.</description> + </key> + <key name="toolbar-detachable" type="b"> + <default>false</default> + <summary>Toolbar Detachable</summary> + <description>Whether the user can detach toolbars and move them around.</description> + </key> + <key name="toolbar-icons-size" type="s"> + <default>'large-toolbar'</default> + <summary>Toolbar Icon Size</summary> + <description>Size of icons in toolbars, either "small-toolbar" or "large-toolbar".</description> + </key> + <key name="cursor-blink" type="b"> + <default>true</default> + <summary>Cursor Blink</summary> + <description>Whether the cursor should blink.</description> + </key> + <key name="cursor-blink-time" type="i"> + <default>1200</default> + <summary>Cursor Blink Time</summary> + <description>Length of the cursor blink cycle, in milliseconds.</description> + </key> + <key name="icon-theme" type="s"> + <default>'mate'</default> + <summary>Icon Theme</summary> + <description>Icon theme to use for the panel, caja etc.</description> + </key> + <key name="gtk-theme" type="s"> + <default>'Clearlooks'</default> + <summary>Gtk+ Theme</summary> + <description>Basename of the default theme used by gtk+.</description> + </key> + <key name="gtk-key-theme" type="s"> + <default>'Default'</default> + <summary>Gtk+ Theme</summary> + <description>Basename of the default theme used by gtk+.</description> + </key> + <key name="font-name" type="s"> + <default>'Sans 10'</default> + <summary>Default font</summary> + <description>Name of the default font used by gtk+.</description> + </key> + <key name="gtk-im-preedit-style" type="s"> + <default>'callback'</default> + <summary>GTK IM Preedit Style</summary> + <description>Name of the GTK+ input method Preedit Style used by gtk+.</description> + </key> + <key name="gtk-im-status-style" type="s"> + <default>'callback'</default> + <summary>GTK IM Status Style</summary> + <description>Name of the GTK+ input method Status Style used by gtk+.</description> + </key> + <key name="gtk-im-module" type="s"> + <default>''</default> + <summary>GTK IM Module</summary> + <description>Name of the input method module used by GTK+.</description> + </key> + <key name="document-font-name" type="s"> + <default>'Sans 10'</default> + <summary>Document font</summary> + <description>Name of the default font used for reading documents.</description> + </key> + <key name="monospace-font-name" type="s"> + <default>'Monospace 10'</default> + <summary>Monospace font</summary> + <description>Name of a monospaced (fixed-width) font for use in locations like terminals.</description> + </key> + <key name="use-custom-font" type="b"> + <default>false</default> + <summary>Use Custom Font</summary> + <description>Whether to use a custom font in gtk+ applications.</description> + </key> + <key name="status-bar-meter-on-right" type="b"> + <default>false</default> + <summary>Status Bar on Right</summary> + <description>Whether to display a status bar meter on the right.</description> + </key> + <key name="file-chooser-backend" type="s"> + <default>'gio'</default> + <summary>Module for GtkFileChooser</summary> + <description>Module to use as the filesystem model for the GtkFileChooser widget. Possible values are "gio", "mate-vfs" and "gtk+".</description> + </key> + <key name="menubar-accel" type="s"> + <default>'F10'</default> + <summary>Menubar accelerator</summary> + <description>Keyboard shortcut to open the menu bars.</description> + </key> + <key name="show-input-method-menu" type="b"> + <default>true</default> + <summary>Show the 'Input Methods' menu</summary> + <description>Whether the context menus of entries and text views should offer to change the input method.</description> + </key> + <key name="show-unicode-menu" type="b"> + <default>true</default> + <summary>Show the 'Unicode Control Character' menu</summary> + <description>Whether the context menus of entries and text views should offer to insert control characters.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.lockdown.gschema.xml b/schemas/org.mate.lockdown.gschema.xml new file mode 100644 index 0000000..0671ace --- /dev/null +++ b/schemas/org.mate.lockdown.gschema.xml @@ -0,0 +1,39 @@ +<schemalist> + <schema id="org.mate.lockdown" path="/desktop/mate/lockdown/"> + <key name="disable-command-line" type="b"> + <default>false</default> + <summary>Disable command line</summary> + <description>Prevent the user from accessing the terminal or specifying a command line to be executed. For example, this would disable access to the panel's "Run Application" dialog.</description> + </key> + <key name="disable-save-to-disk" type="b"> + <default>false</default> + <summary>Disable saving files to disk</summary> + <description>Prevent the user from saving files to disk. For example, this would disable access to all applications' "Save as" dialogs.</description> + </key> + <key name="disable-printing" type="b"> + <default>false</default> + <summary>Disable printing</summary> + <description>Prevent the user from printing. For example, this would disable access to all applications' "Print" dialogs.</description> + </key> + <key name="disable-print-setup" type="b"> + <default>false</default> + <summary>Disable print setup</summary> + <description>Prevent the user from modifying print settings. For example, this would disable access to all applications' "Print Setup" dialogs.</description> + </key> + <key name="disable-user-switching" type="b"> + <default>false</default> + <summary>Disable user switching</summary> + <description>Prevent the user from switching to another account while his session is active.</description> + </key> + <key name="disable-lock-screen" type="b"> + <default>false</default> + <summary>Disable lock screen</summary> + <description>Prevent the user to lock his screen.</description> + </key> + <key name="disable-application-handlers" type="b"> + <default>false</default> + <summary>Disable URL and MIME type handlers</summary> + <description>Prevent running any URL or MIME type handler applications.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.peripherals-keyboard.gschema.xml b/schemas/org.mate.peripherals-keyboard.gschema.xml new file mode 100644 index 0000000..4ab35e2 --- /dev/null +++ b/schemas/org.mate.peripherals-keyboard.gschema.xml @@ -0,0 +1,39 @@ +<schemalist> + <schema id="org.mate.peripherals-keyboard" path="/desktop/mate/peripherals/keyboard/"> + <key name="repeat" type="b"> + <default>true</default> + </key> + <key name="click" type="b"> + <default>true</default> + </key> + <key name="rate" type="i"> + <default>30</default> + </key> + <key name="delay" type="i"> + <default>500</default> + </key> + <key name="click-volume" type="i"> + <default>0</default> + </key> + <key name="bell-mode" type="s"> + <default>'on'</default> + <description>possible values are "on", "off", and "custom".</description> + </key> + <key name="bell-pitch" type="i"> + <default>400</default> + </key> + <key name="bell-duration" type="i"> + <default>100</default> + </key> + <key name="bell-custom-file" type="s"> + <default>''</default> + <summary>Keyboard Bell Custom Filename</summary> + <description>File name of the bell sound to be played.</description> + </key> + <key name="remember-numlock-state" type="b"> + <default>true</default> + <summary>Remember NumLock state</summary> + <description>When set to true, MATE will remember the state of the NumLock LED between sessions.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.peripherals-mouse.gschema.xml b/schemas/org.mate.peripherals-mouse.gschema.xml new file mode 100644 index 0000000..19af968 --- /dev/null +++ b/schemas/org.mate.peripherals-mouse.gschema.xml @@ -0,0 +1,54 @@ +<schemalist> + <schema id="org.mate.peripherals-mouse" path="/desktop/mate/peripherals/mouse/"> + <key name="left-handed" type="b"> + <default>false</default> + <summary>Mouse button orientation</summary> + <description>Swap left and right mouse buttons for left-handed mice.</description> + </key> + <key name="single-click" type="b"> + <default>true</default> + <summary>Single Click</summary> + <description>Single click to open icons.</description> + </key> + <key name="motion-acceleration" type="d"> + <default>-1</default> + <summary>Single Click</summary> + <description>Acceleration multiplier for mouse motion. A value of -1 is the system default.</description> + </key> + <key name="motion-threshold" type="i"> + <default>-1</default> + <summary>Motion Threshold</summary> + <description>Distance in pixels the pointer must move before accelerated mouse motion is activated. A value of -1 is the system default.</description> + </key> + <key name="drag-threshold" type="i"> + <default>8</default> + <summary>Drag Threshold</summary> + <description>Distance before a drag is started.</description> + </key> + <key name="double-click" type="i"> + <default>400</default> + <summary>Double Click Time</summary> + <description>Length of a double click.</description> + </key> + <key name="locate-pointer" type="b"> + <default>false</default> + <summary>Locate Pointer</summary> + <description>Highlights the current location of the pointer when the Control key is pressed and released.</description> + </key> + <key name="cursor-font" type="s"> + <default>''</default> + <summary>Cursor font</summary> + <description>Font name of the cursor. If unset, the default font is used. This value is only propagated to the X server start of each session, so changing it mid-session won't have an effect until the next time you log in.</description> + </key> + <key name="cursor-theme" type="s"> + <default>''</default> + <summary>Cursor theme</summary> + <description>Cursor theme name. Used only by Xservers that support Xcursor, such as XFree86 4.3 and later.</description> + </key> + <key name="cursor-size" type="i"> + <default>18</default> + <summary>Cursor size</summary> + <description>Size of the cursor referenced by cursor_theme.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.sound.gschema.xml b/schemas/org.mate.sound.gschema.xml new file mode 100644 index 0000000..fae13ed --- /dev/null +++ b/schemas/org.mate.sound.gschema.xml @@ -0,0 +1,34 @@ +<schemalist> + <schema id="org.mate.sound" path="/desktop/mate/sound/"> + <key name="default-mixer-device" type="s"> + <default>''</default> + <summary>Default mixer device</summary> + <description>The default mixer device used by the multimedia key bindings.</description> + </key> + <key name="default-mixer-tracks" type="as"> + <default>[]</default> + <summary>Default mixer tracks</summary> + <description>The default mixer tracks used by the multimedia key bindings.</description> + </key> + <key name="enable-esd" type="b"> + <default>false</default> + <summary>Enable ESD</summary> + <description>Enable sound server startup.</description> + </key> + <key name="event-sounds" type="b"> + <default>false</default> + <summary>Sounds for events</summary> + <description>Whether to play sounds on user events.</description> + </key> + <key name="theme-name" type="s"> + <default>'freedesktop'</default> + <summary>Sound theme name</summary> + <description>The XDG sound theme to use for event sounds.</description> + </key> + <key name="input-feedback-sounds" type="b"> + <default>false</default> + <summary>Input feedback sounds</summary> + <description>Whether to play sounds on input events.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.thumbnail-cache.gschema.xml b/schemas/org.mate.thumbnail-cache.gschema.xml new file mode 100644 index 0000000..0d36cf4 --- /dev/null +++ b/schemas/org.mate.thumbnail-cache.gschema.xml @@ -0,0 +1,12 @@ +<schemalist> + <schema id="org.mate.thumbnail-cache" path="/desktop/mate/thumbnail-cache/"> + <key name="maximum-age" type="i"> + <default>180</default> + <description>Maximum age for thumbnails in the cache, in days. Set to -1 to disable cleaning.</description> + </key> + <key name="maximum-size" type="i"> + <default>512</default> + <description>Maximum size of the thumbnail cache, in megabytes. Set to -1 to disable cleaning.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.thumbnailers.gschema.xml b/schemas/org.mate.thumbnailers.gschema.xml new file mode 100644 index 0000000..254bb86 --- /dev/null +++ b/schemas/org.mate.thumbnailers.gschema.xml @@ -0,0 +1,14 @@ +<schemalist> + <schema id="org.mate.thumbnailers" path="/desktop/mate/thumbnailers/"> + <key name="disable-all" type="b"> + <default>false</default> + <summary>Disable all external thumbnailers</summary> + <description>Set to true to disable all external thumbnailer programs, independent on whether they are independently disabled/enabled.</description> + </key> + <key name="disable" type="as"> + <default>[]</default> + <summary>List of mime-types for which external thumbnailer programs will be disabled</summary> + <description>Thumbnails will not be created for files whose mime-type is contained in the list.</description> + </key> + </schema> +</schemalist> diff --git a/schemas/org.mate.typing-break.gschema.xml b/schemas/org.mate.typing-break.gschema.xml new file mode 100644 index 0000000..e4237d3 --- /dev/null +++ b/schemas/org.mate.typing-break.gschema.xml @@ -0,0 +1,24 @@ +<schemalist> + <schema id="org.mate.typing-break" path="/desktop/mate/typing-break/"> + <key name="type-time" type="i"> + <default>60</default> + <summary>Type time</summary> + <description>Number of minutes of typing time before break mode starts.</description> + </key> + <key name="break-time" type="i"> + <default>3</default> + <summary>Break time</summary> + <description>Number of minutes that the typing break should last.</description> + </key> + <key name="allow-postpone" type="b"> + <default>false</default> + <summary>Allow postponing of breaks</summary> + <description>Whether or not the typing break screen can be postponed.</description> + </key> + <key name="enabled" type="b"> + <default>false</default> + <summary>Whether or not keyboard locking is enabled</summary> + <description>Whether or not keyboard locking is enabled.</description> + </key> + </schema> +</schemalist> |