From 8ccec63f649440dd2cb34594a97e952b58614260 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Thu, 29 Apr 2010 14:27:38 +0100 Subject: [PATCH] New control panel applet for Azimuth --- configure.ac | 21 +++++++++++++- debian/control | 5 +++- src/Makefile.am | 13 +++++++++ src/controlpanel-applet.c | 67 +++++++++++++++++++++++++++++++++++++++++++++ src/cpazimuth.desktop.in | 8 ++++++ 5 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 src/controlpanel-applet.c create mode 100644 src/cpazimuth.desktop.in diff --git a/configure.ac b/configure.ac index c62ec9c..d51c6c4 100644 --- a/configure.ac +++ b/configure.ac @@ -21,10 +21,22 @@ PKG_CHECK_MODULES(LOCATION, liblocation) AC_SUBST(LOCATION_LIBS) AC_SUBST(LOCATION_CFLAGS) -PKG_CHECK_MODULES(HILDON, hildon-1) +PKG_CHECK_MODULES(OSSO, libosso >= 1.0.0) +AC_SUBST(OSSO_LIBS) +AC_SUBST(OSSO_CFLAGS) + +PKG_CHECK_MODULES(HILDON, hildon-1 hildon-control-panel >= 0.10.0) AC_SUBST(HILDON_LIBS) AC_SUBST(HILDON_CFLAGS) +PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.6) +AC_SUBST(GCONF_LIBS) +AC_SUBST(GCONF_CFLAGS) + +PKG_CHECK_MODULES(DBUSGLIB, dbus-glib-1 >= 0.23.4) +AC_SUBST(DBUSGLIB_LIBS) +AC_SUBST(DBUSGLIB_CFLAGS) + dnl Localization GETTEXT_PACKAGE=publish-position AC_SUBST(GETTEXT_PACKAGE) @@ -59,6 +71,12 @@ AC_SUBST(HILDON_HOME_DESKTOP_DIR) HILDON_DESKTOP_LIB_DIR=`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir` AC_SUBST(HILDON_DESKTOP_LIB_DIR) +hildoncpdesktopentrydir=`$PKG_CONFIG --variable=plugindesktopentrydir hildon-control-panel` +AC_SUBST(hildoncpdesktopentrydir) + +cpazimuthdir=`$PKG_CONFIG --variable=pluginlibdir hildon-control-panel` +AC_SUBST(cpazimuthdir) + AC_ARG_ENABLE(cast-checks, [ --disable-cast-checks compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes) if test "x$cchecks" = "xno"; then CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS" @@ -82,4 +100,5 @@ fi AC_OUTPUT([ Makefile src/Makefile + src/cpazimuth.desktop ]) diff --git a/debian/control b/debian/control index 3004085..a7065ff 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,10 @@ Build-Depends: cdbs, libgtk2.0-dev, liblocation-dev, libhildon1-dev, - libdbus-1-dev + libdbus-1-dev, + libgconf2-dev, + libosso-dev, + hildon-control-panel-dev Standards-Version: 3.8.4 Homepage: https://garage.maemo.org/projects/azimuth/ diff --git a/src/Makefile.am b/src/Makefile.am index abe3c27..f00246d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,7 @@ AM_CFLAGS = \ -I$(top_srcdir) \ -DG_LOG_DOMAIN=\"azimuth\" \ $(TELEPATHY_GLIB_CFLAGS) \ + $(OSSO_CFLAGS) \ $(HILDON_CFLAGS) \ $(GTK_CFLAGS) \ $(GLIB_CFLAGS) \ @@ -10,6 +11,7 @@ AM_CFLAGS = \ LDADD = \ $(TELEPATHY_GLIB_LIBS) \ + $(OSSO_LIBS) \ $(HILDON_LIBS) \ $(GTK_LIBS) \ $(GLIB_LIBS) \ @@ -25,3 +27,14 @@ azimuth_SOURCES = \ main.c \ connection-watcher.c \ position-publisher.c + + +hildoncpdesktopentry_DATA = cpazimuth.desktop + +cpazimuth_LTLIBRARIES = libcpazimuth.la + +libcpazimuth_la_LIBADD = $(HILDON_LIBS) $(GCONF_LIBS) \ + $(DBUS_LIBS) $(OSSO_LIBS) + +libcpazimuth_la_SOURCES = \ + controlpanel-applet.c diff --git a/src/controlpanel-applet.c b/src/controlpanel-applet.c new file mode 100644 index 0000000..71496a8 --- /dev/null +++ b/src/controlpanel-applet.c @@ -0,0 +1,67 @@ +/* + * controlpanel-applet.c.c - Source for Azimuth's control panel applet + * Copyright (C) 2010 Collabora + * @author Alban Crequy + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include + +static GtkWidget* +create_main_dialog (gpointer window, osso_context_t *osso) +{ + GtkWidget *dialog; + GtkWidget *bSave; + + dialog = g_object_new (GTK_TYPE_DIALOG, + "transient-for", GTK_WINDOW (window), + "destroy-with-parent", TRUE, + "resizable", TRUE, + "has-separator", FALSE, + "modal", TRUE, + NULL); + gtk_window_set_title (GTK_WINDOW (dialog), + "Publish location"); + + bSave = gtk_dialog_add_button (GTK_DIALOG (dialog), + dgettext ("hildon-libs", "wdgt_bd_save"), + GTK_RESPONSE_OK); + + gtk_widget_show_all (dialog); + + return dialog; +} + +osso_return_t +execute (osso_context_t *osso, gpointer data, + gboolean user_activated) +{ + GtkWidget *dialog; + gint ret; + + dialog = create_main_dialog (data, osso); + + ret = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + + return OSSO_OK; +} + diff --git a/src/cpazimuth.desktop.in b/src/cpazimuth.desktop.in new file mode 100644 index 0000000..e9a4396 --- /dev/null +++ b/src/cpazimuth.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Azimuth +Comment=Publish my location +Type=HildonControlPanelPlugin +Icon=gps_location +Categories=connectivity +X-control-panel-plugin=libcpazimuth.so +X-Text-Domain=hildon-control-panel -- 1.7.9.5