Commit 36aed124 authored by phdeswer's avatar phdeswer

gconf made optional for the configuration

parent 2f68a5dc
AC_INIT([usb_moded], [0.46])
AC_INIT([usb_moded], [0.47])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_CONFIG_HEADER([config.h])
......@@ -68,6 +68,14 @@ AC_ARG_ENABLE([bme], AS_HELP_STRING([--enable-bme], [Enable Nokia bme cable conn
esac],[bme=false])
AM_CONDITIONAL([BME], [test x$bme = xtrue])
AC_ARG_ENABLE([gconf], AS_HELP_STRING([--enable-gconf], [Use GConf for configuration storage @<:@default=false@:>@]),
[case "${enableval}" in
yes) gconf=true ; CFLAGS="-DGCONF -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -lgconf-2 $CFLAGS" ;;
no) conf=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gconf]) ;;
esac],[gconf=false])
AM_CONDITIONAL([GCONF], [test x$gconf = xtrue])
AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable application syncing @<:@default=false@:>@]),
[case "${enableval}" in
yes) app_sync=true ; CFLAGS="-DAPP_SYNC $CFLAGS" ;;
......@@ -93,13 +101,13 @@ AC_ARG_ENABLE([udev], AS_HELP_STRING([--enable-udev], [Enable udev interface @<:
AM_CONDITIONAL([UDEV], [test x$udev = xtrue])
#TODO: Figure out how to check for this depending on the gconf flag
# gconf-2.0 >= 2.16.0
PKG_CHECK_MODULES([USB_MODED], [
glib-2.0 >= 2.24.0
dbus-1 >= 1.2.1
dbus-glib-1 >= 0.78
gobject-2.0 >= 2.16.6
gconf-2.0 >= 2.16.0
gio-2.0
])
......
usb-moded (0.47) unstable; urgency=low
* Make it possible to use the ini file for the mode setting also. This removes
the gconf dependency.
-- Philippe De Swert <philippe.de-swert@nokia.com> Sat, 10 Sep 2011 23:54:22 +0300
usb-moded (0.46) unstable; urgency=low
* Restart usb trigger if the socket gets destroyed. Fixes: NB#277395
......
......@@ -23,7 +23,7 @@ configure-stamp:
dh_testdir
# Add here commands to configure the package.
if [ ! -x configure ]; then ./autogen.sh; fi
./configure --prefix=/usr --enable-nokia --enable-app-sync --enable-udev
./configure --prefix=/usr --enable-nokia --enable-app-sync --enable-udev --enable-gconf
touch configure-stamp
......
......@@ -16,10 +16,8 @@ usb_moded_SOURCES = \
usb_moded-dbus.c \
usb_moded-dbus.h \
usb_moded-dbus-private.h \
usb_moded-gconf.c \
usb_moded-gconf.h \
usb_moded-gconf-private.h \
usb_moded-hw-ab.h \
usb_moded-config-private.h \
usb_moded-modules.c \
usb_moded-modules.h \
usb_moded-log.h \
......@@ -28,6 +26,13 @@ usb_moded_SOURCES = \
usb_moded-config.h \
usb_moded-modesetting.c \
usb_moded-modesetting.h
if GCONF
usb_moded_SOURCES += \
usb_moded-gconf.c \
usb_moded-gconf.h
endif
if HAL
usb_moded_SOURCES += \
usb_moded-hal.c
......
......@@ -32,7 +32,7 @@
#include "usb_moded.h"
#include "usb_moded-log.h"
#include "usb_moded-modes.h"
#include "usb_moded-gconf-private.h"
#include "usb_moded-config-private.h"
#include "usb_moded-appsync.h"
#include "usb_moded-appsync-dbus.h"
#include "usb_moded-appsync-dbus-private.h"
......
......@@ -18,7 +18,7 @@
02110-1301 USA
*/
/*
* Gets information from Gconf for the usb modes
* Gets information from Gconf/ini file for the usb modes
*/
/*============================================================================= */
......
......@@ -27,8 +27,10 @@
#include <glib.h>
#include <glib/gkeyfile.h>
#include <glib/gstdio.h>
#include "usb_moded-config.h"
#include "usb_moded-config-private.h"
#include "usb_moded-log.h"
static int get_conf_int(const gchar *entry, const gchar *key);
......@@ -173,3 +175,37 @@ static const char * get_conf_string(const gchar *entry, const gchar *key)
}
#ifndef GCONF
const char * get_mode_setting(void)
{
return(get_conf_string(MODE_SETTING_ENTRY, MODE_SETTING_KEY));
}
int set_mode_setting(const char *mode)
{
GKeyFile *settingsfile;
gboolean test = FALSE;
int ret = 0;
gchar *keyfile;
settingsfile = g_key_file_new();
test = g_key_file_load_from_file(settingsfile, FS_MOUNT_CONFIG_FILE, G_KEY_FILE_NONE, NULL);
if(!test)
{
log_debug("No conffile.\n");
g_key_file_free(settingsfile);
return(ret);
}
g_key_file_set_string(settingsfile, MODE_SETTING_ENTRY, MODE_SETTING_KEY, mode);
keyfile = g_key_file_to_data (settingsfile, NULL, NULL);
/* free the settingsfile before writing things out to be sure
the contents will be correctly written to file afterwards.
Just a precaution. */
g_key_file_free(settingsfile);
ret = g_file_set_contents(FS_MOUNT_CONFIG_FILE, keyfile, -1, NULL);
return(ret);
}
#endif
......@@ -22,6 +22,8 @@
#define FS_MOUNT_CONFIG_FILE "/etc/usb-moded/usb-moded.ini"
#define MODE_SETTING_ENTRY "usbmode"
#define MODE_SETTING_KEY "mode"
#define FS_MOUNT_DEFAULT "/dev/mmcblk0p1"
#define FS_MOUNT_ENTRY "mountpoints"
#define FS_MOUNT_KEY "mount"
......
......@@ -31,7 +31,7 @@
#include "usb_moded-dbus-private.h"
#include "usb_moded.h"
#include "usb_moded-modes.h"
#include "usb_moded-gconf-private.h"
#include "usb_moded-config-private.h"
#include "usb_moded-log.h"
#ifdef NOKIA
......
......@@ -34,7 +34,7 @@
#include <gconf/gconf-client.h>
#include "usb_moded-gconf.h"
#include "usb_moded-gconf-private.h"
#include "usb_moded-config-private.h"
#include "usb_moded-modes.h"
#include "usb_moded-log.h"
#include "usb_moded.h"
......
......@@ -35,7 +35,6 @@
#include "usb_moded-dbus-private.h"
#include "usb_moded-hw-ab.h"
#include "usb_moded-gconf.h"
#include "usb_moded-gconf-private.h"
#include "usb_moded-modules.h"
#include "usb_moded-log.h"
#include "usb_moded-devicelock.h"
......@@ -44,6 +43,7 @@
#include "usb_moded-appsync.h"
#include "usb_moded-trigger.h"
#include "usb_moded-config.h"
#include "usb_moded-config-private.h"
/* global definitions */
......
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