New control panel applet for Azimuth
authorAlban Crequy <alban.crequy@collabora.co.uk>
Thu, 29 Apr 2010 13:27:38 +0000 (14:27 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 29 Apr 2010 16:54:16 +0000 (18:54 +0200)
configure.ac
debian/control
src/Makefile.am
src/controlpanel-applet.c [new file with mode: 0644]
src/cpazimuth.desktop.in [new file with mode: 0644]

index c62ec9c..d51c6c4 100644 (file)
@@ -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
 ])
index 3004085..a7065ff 100644 (file)
@@ -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/
 
index abe3c27..f00246d 100644 (file)
@@ -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 (file)
index 0000000..71496a8
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * controlpanel-applet.c.c - Source for Azimuth's control panel applet
+ * Copyright (C) 2010 Collabora
+ * @author Alban Crequy <alban.crequy@collabora.co.uk>
+ *
+ * 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 <libintl.h>
+#include <libosso.h>
+#include <hildon/hildon.h>
+#include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
+
+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 (file)
index 0000000..e9a4396
--- /dev/null
@@ -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