Commit 1d9b7b23 authored by Slava Monich's avatar Slava Monich

Merge branch 'tklock' into 'master'

Add tklock tracking object

And a bit of a housekeeping

See merge request !2
parents 37495221 708de564
......@@ -20,7 +20,7 @@ all: debug release pkgconfig
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_RELEASE = 1
VERSION_RELEASE = 2
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
......@@ -39,9 +39,11 @@ LIB = $(LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
SRC = \
mce_display.c \
mce_proxy.c
mce_proxy.c \
mce_tklock.c
GEN_SRC = \
com.nokia.mce.c
com.nokia.mce.request.c \
com.nokia.mce.signal.c
#
# Directories
......
libmce-glib (1.0.2) unstable; urgency=low
* Added mce_display_remove_handlers
* Added mce_tklock object
-- Slava Monich <slava.monich@jolla.com> Sat, 12 Nov 2016 13:26:09 +0300
libmce-glib (1.0.1) unstable; urgency=low
* Pull mce headers from mce-dev
......
......@@ -90,6 +90,12 @@ mce_display_remove_handler(
MceDisplay* display,
gulong id);
void
mce_display_remove_handlers(
MceDisplay* display,
gulong *ids,
guint count);
G_END_DECLS
#endif /* MCE_DISPLAY_H */
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation
* are those of the authors and should not be interpreted as representing
* any official policies, either expressed or implied.
*/
#ifndef MCE_TKLOCK_H
#define MCE_TKLOCK_H
#include "mce_types.h"
G_BEGIN_DECLS
typedef enum mce_tklock_mode {
MCE_TKLOCK_MODE_LOCKED,
MCE_TKLOCK_MODE_SILENT_LOCKED,
MCE_TKLOCK_MODE_LOCKED_DIM,
MCE_TKLOCK_MODE_LOCKED_DELAY,
MCE_TKLOCK_MODE_SILENT_LOCKED_DIM,
MCE_TKLOCK_MODE_UNLOCKED,
MCE_TKLOCK_MODE_SILENT_UNLOCKED
} MCE_TKLOCK_MODE;
typedef struct mce_tklock_priv MceTklockPriv;
typedef struct mce_tklock {
GObject object;
MceTklockPriv* priv;
gboolean valid;
MCE_TKLOCK_MODE mode;
gboolean locked;
} MceTklock;
typedef void
(*MceTklockFunc)(
MceTklock* tklock,
void* arg);
MceTklock*
mce_tklock_new(
void);
MceTklock*
mce_tklock_ref(
MceTklock* tklock);
void
mce_tklock_unref(
MceTklock* tklock);
gulong
mce_tklock_add_valid_changed_handler(
MceTklock* tklock,
MceTklockFunc fn,
void* arg);
gulong
mce_tklock_add_mode_changed_handler(
MceTklock* tklock,
MceTklockFunc fn,
void* arg);
gulong
mce_tklock_add_locked_changed_handler(
MceTklock* tklock,
MceTklockFunc fn,
void* arg);
void
mce_tklock_remove_handler(
MceTklock* tklock,
gulong id);
void
mce_tklock_remove_handlers(
MceTklock* tklock,
gulong *ids,
guint count);
G_END_DECLS
#endif /* MCE_TKLOCK_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
Name: libmce-glib
Version: 1.0.1
Version: 1.0.2
Release: 0
Summary: MCE client library
Group: Development/Libraries
......@@ -9,6 +9,7 @@ Source: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libglibutil)
BuildRequires: pkgconfig(mce)
Requires: libglibutil >= 1.0.5
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
<node name="/com/nokia/mce/request">
<interface name="com.nokia.mce.request">
<method name="get_display_status">
<arg direction="out" name="display_state" type="s"/>
</method>
<method name="get_tklock_mode">
<arg direction="out" name="mode_name" type="s"/>
</method>
</interface>
</node>
......@@ -3,16 +3,12 @@
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
<node name="/com/nokia/mce/signal">
<!-- com.nokia.mce.request -->
<interface name="com.nokia.mce.request">
<method name="get_display_status">
<arg direction="out" name="display_state" type="s"/>
</method>
</interface>
<!-- com.nokia.mce.signal -->
<interface name="com.nokia.mce.signal">
<signal name="display_status_ind">
<arg name="display_state" type="s"/>
</signal>
<signal name="tklock_mode_ind">
<arg name="tklock_mode" type="s"/>
</signal>
</interface>
</node>
......@@ -38,10 +38,14 @@
#include "mce_proxy.h"
#include "mce_log_p.h"
#include "mce/mode-names.h"
#include <mce/dbus-names.h>
#include <mce/mode-names.h>
#include <gutil_misc.h>
/* Generated headers */
#include "com.nokia.mce.h"
#include "com.nokia.mce.request.h"
#include "com.nokia.mce.signal.h"
struct mce_display_priv {
MceProxy* proxy;
......@@ -115,6 +119,12 @@ mce_display_status_query_done(
mce_display_status_update(self, status);
g_free(status);
} else {
/*
* We could retry but it's probably not worth the trouble
* because the next time display state changes we receive
* display_status_ind signal and sync our state with mce.
* Until then, this object stays invalid.
*/
GWARN("Failed to query display state %s", GERRMSG(error));
g_error_free(error);
}
......@@ -152,7 +162,6 @@ mce_display_valid_changed(
}
}
static
void
mce_display_status_ind(
......@@ -234,6 +243,15 @@ mce_display_remove_handler(
}
}
void
mce_display_remove_handlers(
MceDisplay* self,
gulong *ids,
guint count)
{
gutil_disconnect_handlers(self, ids, count);
}
/*==========================================================================*
* Internals
*==========================================================================*/
......@@ -251,7 +269,7 @@ mce_display_init(
priv->proxy_valid_id = mce_proxy_add_valid_changed_handler(priv->proxy,
mce_display_valid_changed, self);
priv->display_status_ind_id = g_signal_connect(priv->proxy->signal,
"display_status_ind", G_CALLBACK(mce_display_status_ind), self);
MCE_DISPLAY_SIG, G_CALLBACK(mce_display_status_ind), self);
}
static
......@@ -262,6 +280,8 @@ mce_display_finalize(
MceDisplay* self = MCE_DISPLAY(object);
MceDisplayPriv* priv = self->priv;
g_signal_handler_disconnect(priv->proxy->signal,
priv->display_status_ind_id);
mce_proxy_unref(priv->proxy);
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
}
......
......@@ -40,7 +40,8 @@
#include "mce/dbus-names.h"
/* Generated headers */
#include "com.nokia.mce.h"
#include "com.nokia.mce.request.h"
#include "com.nokia.mce.signal.h"
GLOG_MODULE_DEFINE("mce");
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment