summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--libmate-desktop/Makefile.am40
-rw-r--r--libmate-desktop/mate-bg.c18
-rw-r--r--libmate-desktop/mate-desktop-thumbnail.c2
-rw-r--r--libmate-desktop/mate-rr-config.c14
-rw-r--r--libmate-desktop/mate-rr-config.h5
-rw-r--r--libmate-desktop/mate-rr.c127
-rw-r--r--libmate-desktop/mate-rr.h3
-rw-r--r--libmate-desktop/mate-thumbnail-pixbuf-utils.c4
9 files changed, 184 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac
index 5a6264d..77c81dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,7 @@ fi
AC_SUBST(STARTUP_NOTIFICATION_PACKAGE)
+GOBJECT_INTROSPECTION_CHECK([0.9.7])
dnl we need x11 for MateBG
diff --git a/libmate-desktop/Makefile.am b/libmate-desktop/Makefile.am
index 3e35321..3f8a6e5 100644
--- a/libmate-desktop/Makefile.am
+++ b/libmate-desktop/Makefile.am
@@ -31,8 +31,9 @@ AM_CFLAGS = $(WARN_CFLAGS)
noinst_PROGRAMS = test-ditem test
-libmate_desktop_2_la_SOURCES = \
- mate-desktop-item.c \
+CLEANFILES =
+
+introspection_sources = \
mate-desktop-utils.c \
mate-desktop-thumbnail.c \
mate-thumbnail-pixbuf-utils.c \
@@ -45,12 +46,16 @@ libmate_desktop_2_la_SOURCES = \
mate-rr.c \
mate-rr-config.c \
mate-rr-labeler.c \
- mate-rr-private.h \
mate-colorbutton.c \
mate-colorsel.c \
mate-colorseldialog.c \
- edid-parse.c \
- edid.h \
+ edid-parse.c
+
+libmate_desktop_2_la_SOURCES = \
+ $(introspection_sources) \
+ mate-desktop-item.c \
+ mate-rr-private.h \
+ edid.h \
private.h
libmate_desktop_2_la_LIBADD = \
@@ -89,6 +94,31 @@ pnpdata_DATA_dist = pnp.ids
check:
test -s $(top_srcdir)/libmate-desktop/pnp.ids
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+
+MateDesktop-2.0.gir: libmate-desktop-2.la
+MateDesktop_2_0_gir_INCLUDES = GObject-2.0 Gtk-$(GTK_API_VERSION) GConf-2.0
+MateDesktop_2_0_gir_PACKAGES = gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 gtk+-$(GTK_API_VERSION) gconf-2.0
+MateDesktop_2_0_gir_CFLAGS = -DMATE_DESKTOP_USE_UNSTABLE_API -I$(top_srcdir)
+MateDesktop_2_0_gir_LIBS = libmate-desktop-2.la
+MateDesktop_2_0_gir_FILES = $(introspection_sources) $(libmate_desktop_HEADERS)
+MateDesktop_2_0_gir_SCANNERFLAGS = --identifier-prefix=Mate --symbol-prefix=mate_
+INTROSPECTION_GIRS += MateDesktop-2.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
+
EXTRA_DIST = \
mate-desktop-2.0.pc.in \
mate-desktop-2.0-uninstalled.pc.in \
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 692992e..85d4ceb 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -1394,6 +1394,11 @@ fit_factor (int from_width, int from_height,
return MIN (to_width / (double) from_width, to_height / (double) from_height);
}
+/**
+ * mate_bg_create_thumbnail:
+ *
+ * Returns: (transfer full): a #GdkPixbuf showing the background as a thumbnail
+ */
GdkPixbuf *
mate_bg_create_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
@@ -1677,14 +1682,13 @@ mate_bg_set_pixmap_as_root (GdkScreen *screen, GdkPixmap *surface)
* mate_bg_set_surface_as_root_with_crossfade:
* @screen: the #GdkScreen to change root background on
* @surface: the cairo xlib surface to set root background from
- * @context: a #GMainContext or %NULL
*
* Set the root pixmap, and properties pointing to it.
* This function differs from mate_bg_set_surface_as_root()
* in that it adds a subtle crossfade animation from the
* current root pixmap to the new one.
*
- * Return value: a #MateBGCrossfade object
+ * Return value: (transfer full): a #MateBGCrossfade object
**/
MateBGCrossfade *
#if GTK_CHECK_VERSION (3, 0, 0)
@@ -3206,9 +3210,15 @@ mate_bg_changes_with_time (MateBG *bg)
return FALSE;
}
-/* Creates a thumbnail for a certain frame, where 'frame' is somewhat
+/**
+ * mate_bg_create_frame_thumbnail:
+ *
+ * Creates a thumbnail for a certain frame, where 'frame' is somewhat
* vaguely defined as 'suitable point to show while single-stepping
- * through the slideshow'. Returns NULL if frame_num is out of bounds.
+ * through the slideshow'.
+ *
+ * Returns: (transfer full): the newly created thumbnail or
+ * or NULL if frame_num is out of bounds.
*/
GdkPixbuf *
mate_bg_create_frame_thumbnail (MateBG *bg,
diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c
index 4d287fb..4a4e5d6 100644
--- a/libmate-desktop/mate-desktop-thumbnail.c
+++ b/libmate-desktop/mate-desktop-thumbnail.c
@@ -850,7 +850,7 @@ mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size)
*
* Usage of this function is threadsafe.
*
- * Return value: The absolute path of the thumbnail, or %NULL if none exist.
+ * Return value: (transfer full): The absolute path of the thumbnail, or %NULL if none exist.
*
* Since: 2.2
**/
diff --git a/libmate-desktop/mate-rr-config.c b/libmate-desktop/mate-rr-config.c
index abdb1fc..27ecd1a 100644
--- a/libmate-desktop/mate-rr-config.c
+++ b/libmate-desktop/mate-rr-config.c
@@ -84,7 +84,11 @@ static CrtcAssignment *crtc_assignment_new (MateRRScreen *screen,
GError **error);
static void crtc_assignment_free (CrtcAssignment *assign);
static void output_free (MateOutputInfo *output);
-static MateOutputInfo *output_copy (MateOutputInfo *output);
+static MateOutputInfo *output_copy (const MateOutputInfo *output);
+static MateRRConfig * mate_rr_config_copy (const MateRRConfig *config);
+
+G_DEFINE_BOXED_TYPE (MateOutputInfo, mate_rr_output_info, output_copy, output_free)
+G_DEFINE_BOXED_TYPE (MateRRConfig, mate_rr_config, mate_rr_config_copy, mate_rr_config_free)
typedef struct Parser Parser;
@@ -627,7 +631,7 @@ output_free (MateOutputInfo *output)
}
static MateOutputInfo *
-output_copy (MateOutputInfo *output)
+output_copy (const MateOutputInfo *output)
{
MateOutputInfo *copy = g_new0 (MateOutputInfo, 1);
@@ -1118,7 +1122,7 @@ mate_rr_config_save (MateRRConfig *configuration, GError **error)
}
static MateRRConfig *
-mate_rr_config_copy (MateRRConfig *config)
+mate_rr_config_copy (const MateRRConfig *config)
{
MateRRConfig *copy = g_new0 (MateRRConfig, 1);
int i;
@@ -1238,8 +1242,8 @@ mate_rr_config_apply_with_time (MateRRConfig *config,
* See the documentation for mate_rr_config_apply_from_filename(). This
* function simply calls that other function with a filename of
* mate_rr_config_get_intended_filename().
-
- * @Deprecated: 2.26: Use mate_rr_config_apply_from_filename() instead and pass it
+ *
+ * Deprecated: 2.26: Use mate_rr_config_apply_from_filename() instead and pass it
* the filename from mate_rr_config_get_intended_filename().
*/
gboolean
diff --git a/libmate-desktop/mate-rr-config.h b/libmate-desktop/mate-rr-config.h
index 7a119bb..edceb49 100644
--- a/libmate-desktop/mate-rr-config.h
+++ b/libmate-desktop/mate-rr-config.h
@@ -66,6 +66,11 @@ struct MateOutputInfo
gpointer user_data;
};
+#define MATE_RR_TYPE_OUTPUT_INFO (mate_rr_output_info_get_type())
+#define MATE_RR_TYPE_CONFIG (mate_rr_config_get_type())
+GType mate_rr_output_info_get_type (void);
+GType mate_rr_config_get_type (void);
+
struct MateRRConfig
{
/* "clone" means that at least two outputs are at (0, 0) offset and they
diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c
index e4442f0..e5a242a 100644
--- a/libmate-desktop/mate-rr.c
+++ b/libmate-desktop/mate-rr.c
@@ -87,6 +87,7 @@ struct MateRROutput
MateRRMode ** modes;
int n_preferred;
guint8 * edid_data;
+ int edid_size;
char * connector_type;
};
@@ -124,6 +125,7 @@ struct MateRRMode
/* MateRRCrtc */
static MateRRCrtc * crtc_new (ScreenInfo *info,
RRCrtc id);
+static MateRRCrtc * crtc_copy (const MateRRCrtc *from);
static void crtc_free (MateRRCrtc *crtc);
#ifdef HAVE_RANDR
@@ -142,6 +144,7 @@ static gboolean output_initialize (MateRROutput *output,
GError **error);
#endif
+static MateRROutput *output_copy (const MateRROutput *from);
static void output_free (MateRROutput *output);
/* MateRRMode */
@@ -153,6 +156,7 @@ static void mode_initialize (MateRRMode *mode,
XRRModeInfo *info);
#endif
+static MateRRMode * mode_copy (const MateRRMode *from);
static void mode_free (MateRRMode *mode);
@@ -163,6 +167,10 @@ static void mate_rr_screen_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (MateRRScreen, mate_rr_screen, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, mate_rr_screen_initable_iface_init))
+G_DEFINE_BOXED_TYPE (MateRRCrtc, mate_rr_crtc, crtc_copy, crtc_free)
+G_DEFINE_BOXED_TYPE (MateRROutput, mate_rr_output, output_copy, output_free)
+G_DEFINE_BOXED_TYPE (MateRRMode, mate_rr_mode, mode_copy, mode_free)
+
/* Errors */
/**
@@ -773,7 +781,7 @@ mate_rr_screen_class_init (MateRRScreenClass *klass)
"GDK Screen",
"The GDK Screen represented by this MateRRScreen",
GDK_TYPE_SCREEN,
- G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
);
@@ -1114,7 +1122,7 @@ mate_rr_screen_get_output_by_id (MateRRScreen *screen,
static MateRROutput *
output_new (ScreenInfo *info, RROutput id)
{
- MateRROutput *output = g_new0 (MateRROutput, 1);
+ MateRROutput *output = g_slice_new0 (MateRROutput);
output->id = id;
output->info = info;
@@ -1161,26 +1169,25 @@ get_property (Display *dpy,
}
static guint8 *
-read_edid_data (MateRROutput *output)
+read_edid_data (MateRROutput *output, int *len)
{
Atom edid_atom;
guint8 *result;
- int len;
edid_atom = XInternAtom (DISPLAY (output), "EDID", FALSE);
result = get_property (DISPLAY (output),
- output->id, edid_atom, &len);
+ output->id, edid_atom, len);
if (!result)
{
edid_atom = XInternAtom (DISPLAY (output), "EDID_DATA", FALSE);
result = get_property (DISPLAY (output),
- output->id, edid_atom, &len);
+ output->id, edid_atom, len);
}
if (result)
{
- if (len % 128 == 0)
+ if (*len % 128 == 0)
return result;
else
g_free (result);
@@ -1301,7 +1308,7 @@ output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error
output->n_preferred = info->npreferred;
/* Edid data */
- output->edid_data = read_edid_data (output);
+ output->edid_data = read_edid_data (output, &output->edid_size);
XRRFreeOutputInfo (info);
@@ -1309,6 +1316,52 @@ output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error
}
#endif /* HAVE_RANDR */
+static MateRROutput*
+output_copy (const MateRROutput *from)
+{
+ GPtrArray *array;
+ MateRRCrtc **p_crtc;
+ MateRROutput **p_output;
+ MateRRMode **p_mode;
+ MateRROutput *output = g_slice_new0 (MateRROutput);
+
+ output->id = from->id;
+ output->info = from->info;
+ output->name = g_strdup (from->name);
+ output->current_crtc = from->current_crtc;
+ output->width_mm = from->width_mm;
+ output->height_mm = from->height_mm;
+ output->connected = from->connected;
+ output->n_preferred = from->n_preferred;
+ output->connector_type = g_strdup (from->connector_type);
+
+ array = g_ptr_array_new ();
+ for (p_crtc = from->possible_crtcs; *p_crtc != NULL; p_crtc++)
+ {
+ g_ptr_array_add (array, *p_crtc);
+ }
+ output->possible_crtcs = (MateRRCrtc**) g_ptr_array_free (array, FALSE);
+
+ array = g_ptr_array_new ();
+ for (p_output = from->clones; *p_output != NULL; p_output++)
+ {
+ g_ptr_array_add (array, *p_output);
+ }
+ output->clones = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+ array = g_ptr_array_new ();
+ for (p_mode = from->modes; *p_mode != NULL; p_mode++)
+ {
+ g_ptr_array_add (array, *p_mode);
+ }
+ output->modes = (MateRRMode**) g_ptr_array_free (array, FALSE);
+
+ output->edid_size = from->edid_size;
+ output->edid_data = g_memdup (from->edid_data, from->edid_size);
+
+ return output;
+}
+
static void
output_free (MateRROutput *output)
{
@@ -1318,7 +1371,7 @@ output_free (MateRROutput *output)
g_free (output->edid_data);
g_free (output->name);
g_free (output->connector_type);
- g_free (output);
+ g_slice_free (MateRROutput, output);
}
guint32
@@ -1762,7 +1815,7 @@ mate_rr_crtc_supports_rotation (MateRRCrtc * crtc,
static MateRRCrtc *
crtc_new (ScreenInfo *info, RROutput id)
{
- MateRRCrtc *crtc = g_new0 (MateRRCrtc, 1);
+ MateRRCrtc *crtc = g_slice_new0 (MateRRCrtc);
crtc->id = id;
crtc->info = info;
@@ -1770,6 +1823,39 @@ crtc_new (ScreenInfo *info, RROutput id)
return crtc;
}
+static MateRRCrtc *
+crtc_copy (const MateRRCrtc *from)
+{
+ MateRROutput **p_output;
+ GPtrArray *array;
+ MateRRCrtc *to = g_slice_new0 (MateRRCrtc);
+
+ to->info = from->info;
+ to->id = from->id;
+ to->current_mode = from->current_mode;
+ to->x = from->x;
+ to->y = from->y;
+ to->current_rotation = from->current_rotation;
+ to->rotations = from->rotations;
+ to->gamma_size = from->gamma_size;
+
+ array = g_ptr_array_new ();
+ for (p_output = from->current_outputs; *p_output != NULL; p_output++)
+ {
+ g_ptr_array_add (array, *p_output);
+ }
+ to->current_outputs = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+ array = g_ptr_array_new ();
+ for (p_output = from->possible_outputs; *p_output != NULL; p_output++)
+ {
+ g_ptr_array_add (array, *p_output);
+ }
+ to->possible_outputs = (MateRROutput**) g_ptr_array_free (array, FALSE);
+
+ return to;
+}
+
#ifdef HAVE_RANDR
static gboolean
crtc_initialize (MateRRCrtc *crtc,
@@ -1846,14 +1932,14 @@ crtc_free (MateRRCrtc *crtc)
{
g_free (crtc->current_outputs);
g_free (crtc->possible_outputs);
- g_free (crtc);
+ g_slice_free (MateRRCrtc, crtc);
}
/* MateRRMode */
static MateRRMode *
mode_new (ScreenInfo *info, RRMode id)
{
- MateRRMode *mode = g_new0 (MateRRMode, 1);
+ MateRRMode *mode = g_slice_new0 (MateRRMode);
mode->id = id;
mode->info = info;
@@ -1903,11 +1989,26 @@ mode_initialize (MateRRMode *mode, XRRModeInfo *info)
}
#endif /* HAVE_RANDR */
+static MateRRMode *
+mode_copy (const MateRRMode *from)
+{
+ MateRRMode *to = g_slice_new0 (MateRRMode);
+
+ to->id = from->id;
+ to->info = from->info;
+ to->name = g_strdup (from->name);
+ to->width = from->width;
+ to->height = from->height;
+ to->freq = from->freq;
+
+ return to;
+}
+
static void
mode_free (MateRRMode *mode)
{
g_free (mode->name);
- g_free (mode);
+ g_slice_free (MateRRMode, mode);
}
void
diff --git a/libmate-desktop/mate-rr.h b/libmate-desktop/mate-rr.h
index 08ca1b7..5b55224 100644
--- a/libmate-desktop/mate-rr.h
+++ b/libmate-desktop/mate-rr.h
@@ -88,6 +88,9 @@ typedef enum {
#define MATE_RR_TYPE_MODE (mate_rr_mode_get_type())
GType mate_rr_screen_get_type (void);
+GType mate_rr_output_get_type (void);
+GType mate_rr_crtc_get_type (void);
+GType mate_rr_mode_get_type (void);
/* MateRRScreen */
MateRRScreen * mate_rr_screen_new (GdkScreen *screen,
diff --git a/libmate-desktop/mate-thumbnail-pixbuf-utils.c b/libmate-desktop/mate-thumbnail-pixbuf-utils.c
index 32b6292..b568650 100644
--- a/libmate-desktop/mate-thumbnail-pixbuf-utils.c
+++ b/libmate-desktop/mate-thumbnail-pixbuf-utils.c
@@ -35,7 +35,7 @@
#define LOAD_BUFFER_SIZE 65536
/**
- * mate_thumbnail_scale_down_pixbuf:
+ * mate_desktop_thumbnail_scale_down_pixbuf:
* @pixbuf: a #GdkPixbuf
* @dest_width: the desired new width
* @dest_height: the desired new height
@@ -44,7 +44,7 @@
* is a lot faster than gdk-pixbuf when scaling down by
* large amounts.
*
- * Return value: a scaled pixbuf
+ * Return value: (transfer full): a scaled pixbuf
*
* Since: 2.2
**/