added possibilty to configure in Control Panel
authorVlad Vasiliev <vlad@toshiba2.oblgaz>
Sat, 24 Apr 2010 14:23:52 +0000 (17:23 +0300)
committerVlad Vasiliev <vlad@toshiba2.oblgaz>
Sat, 24 Apr 2010 14:23:52 +0000 (17:23 +0300)
14 files changed:
applet/configure.ac
applet/data/Makefile.am
applet/data/Makefile.in
applet/data/livewpp.desktop.in [new file with mode: 0644]
applet/debian/changelog
applet/src/Makefile.am
applet/src/livewp-control-widget.c [new file with mode: 0644]
applet/src/livewp-control-widget.h [new file with mode: 0644]
applet/src/livewp-dbus.c
applet/src/livewp-home-widget.c
applet/src/livewp-home-widget.h
applet/src/livewp-main.c
applet/src/livewp-settings.c
applet/src/livewp-settings.h

index 219aeb3..b4e9057 100644 (file)
@@ -20,6 +20,10 @@ PKG_CHECK_MODULES(OSSO, [libosso >= 1])
 AC_SUBST(OSSO_LIBS)
 AC_SUBST(OSSO_CFLAGS)
 
+PKG_CHECK_MODULES(CONTROLPANEL, hildon-control-panel)
+AC_SUBST(CONTROLPANEL_CFLAGS)
+AC_SUBST(CONTROLPANEL_LIBS)
+
 # Discover where to install the .desktop file:
 HILDON_HOME_DESKTOP_DIR=`pkg-config libhildondesktop-1 --variable=hildonhomedesktopentrydir`
 AC_SUBST(HILDON_HOME_DESKTOP_DIR)
@@ -28,6 +32,10 @@ AC_SUBST(HILDON_HOME_DESKTOP_DIR)
 HILDON_DESKTOP_LIB_DIR=`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir`
 AC_SUBST(HILDON_DESKTOP_LIB_DIR) 
 
+# Discover where to install the panel's lib file:
+HILDON_PANEL_LIB_DIR=`pkg-config hildon-control-panel --variable=pluginlibdir`
+AC_SUBST(HILDON_PANEL_LIB_DIR) 
+
 dnl Localisation
 localedir=`pkg-config osso-af-settings --variable=localedir`
 if test "$localedir" == ""; then
index fd858a1..c0198dc 100644 (file)
@@ -35,6 +35,11 @@ desktopdir    = $(datadir)/applications/hildon
 desktop_files = livewp.desktop
 desktop_DATA  = $(desktop_files)
 
+desktoppaneldir    = $(datadir)/applications/hildon-control-panel
+desktoppanel_files = livewpp.desktop
+desktoppanel_DATA  = $(desktoppanel_files)
+
+
 
 EXTRA_DIST = $(berlintheme_DATA) \
             $(moderntheme_DATA) \
@@ -47,3 +52,8 @@ livewp.desktop: livewp.desktop.in
        sed "s/__PACKAGE__/$(PACKAGE)/g" $@.tmp >$@ && \
        $(RM) *.tmp
 
+livewpp.desktop: livewpp.desktop.in
+       sed "s/__VERSION__/$(VERSION)/g" $< >$@.tmp && \
+       sed "s/__PACKAGE__/$(PACKAGE)/g" $@.tmp >$@ && \
+       $(RM) *.tmp
+
index 11bc34a..5fd92ab 100644 (file)
@@ -67,14 +67,15 @@ CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
-am__installdirs = "$(DESTDIR)$(berlinthemedir)" "$(DESTDIR)$(dbus_servicedir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(matrixthemedir)" "$(DESTDIR)$(modernthemedir)"
+am__installdirs = "$(DESTDIR)$(berlinthemedir)" "$(DESTDIR)$(dbus_servicedir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(desktoppaneldir)" "$(DESTDIR)$(matrixthemedir)" "$(DESTDIR)$(modernthemedir)"
 berlinthemeDATA_INSTALL = $(INSTALL_DATA)
 dbus_serviceDATA_INSTALL = $(INSTALL_DATA)
 desktopDATA_INSTALL = $(INSTALL_DATA)
+desktoppanelDATA_INSTALL = $(INSTALL_DATA)
 matrixthemeDATA_INSTALL = $(INSTALL_DATA)
 modernthemeDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(berlintheme_DATA) $(dbus_service_DATA) $(desktop_DATA) \
-       $(matrixtheme_DATA) $(moderntheme_DATA)
+       $(desktoppanel_DATA) $(matrixtheme_DATA) $(moderntheme_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALL_LINGUAS = @ALL_LINGUAS@
@@ -91,6 +92,8 @@ CATOBJEXT = @CATOBJEXT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
+CONTROLPANEL_CFLAGS = @CONTROLPANEL_CFLAGS@
+CONTROLPANEL_LIBS = @CONTROLPANEL_LIBS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
@@ -118,6 +121,7 @@ GMSGFMT = @GMSGFMT@
 GREP = @GREP@
 HILDON_DESKTOP_LIB_DIR = @HILDON_DESKTOP_LIB_DIR@
 HILDON_HOME_DESKTOP_DIR = @HILDON_HOME_DESKTOP_DIR@
+HILDON_PANEL_LIB_DIR = @HILDON_PANEL_LIB_DIR@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -238,6 +242,9 @@ dbus_service_DATA = org.maemo.livewp.service
 desktopdir = $(datadir)/applications/hildon
 desktop_files = livewp.desktop
 desktop_DATA = $(desktop_files)
+desktoppaneldir = $(datadir)/applications/hildon-control-panel
+desktoppanel_files = livewpp.desktop
+desktoppanel_DATA = $(desktoppanel_files)
 EXTRA_DIST = $(berlintheme_DATA) \
             $(moderntheme_DATA) \
             $(matrixtheme_DATA) \
@@ -336,6 +343,23 @@ uninstall-desktopDATA:
          echo " rm -f '$(DESTDIR)$(desktopdir)/$$f'"; \
          rm -f "$(DESTDIR)$(desktopdir)/$$f"; \
        done
+install-desktoppanelDATA: $(desktoppanel_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(desktoppaneldir)" || $(mkdir_p) "$(DESTDIR)$(desktoppaneldir)"
+       @list='$(desktoppanel_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " $(desktoppanelDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(desktoppaneldir)/$$f'"; \
+         $(desktoppanelDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(desktoppaneldir)/$$f"; \
+       done
+
+uninstall-desktoppanelDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(desktoppanel_DATA)'; for p in $$list; do \
+         f="`echo $$p | sed -e 's|^.*/||'`"; \
+         echo " rm -f '$(DESTDIR)$(desktoppaneldir)/$$f'"; \
+         rm -f "$(DESTDIR)$(desktoppaneldir)/$$f"; \
+       done
 install-matrixthemeDATA: $(matrixtheme_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(matrixthemedir)" || $(mkdir_p) "$(DESTDIR)$(matrixthemedir)"
@@ -409,7 +433,7 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(berlinthemedir)" "$(DESTDIR)$(dbus_servicedir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(matrixthemedir)" "$(DESTDIR)$(modernthemedir)"; do \
+       for dir in "$(DESTDIR)$(berlinthemedir)" "$(DESTDIR)$(dbus_servicedir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(desktoppaneldir)" "$(DESTDIR)$(matrixthemedir)" "$(DESTDIR)$(modernthemedir)"; do \
          test -z "$$dir" || $(mkdir_p) "$$dir"; \
        done
 install: install-am
@@ -455,8 +479,8 @@ info: info-am
 info-am:
 
 install-data-am: install-berlinthemeDATA install-dbus_serviceDATA \
-       install-desktopDATA install-matrixthemeDATA \
-       install-modernthemeDATA
+       install-desktopDATA install-desktoppanelDATA \
+       install-matrixthemeDATA install-modernthemeDATA
 
 install-exec-am:
 
@@ -483,28 +507,36 @@ ps: ps-am
 ps-am:
 
 uninstall-am: uninstall-berlinthemeDATA uninstall-dbus_serviceDATA \
-       uninstall-desktopDATA uninstall-info-am \
-       uninstall-matrixthemeDATA uninstall-modernthemeDATA
+       uninstall-desktopDATA uninstall-desktoppanelDATA \
+       uninstall-info-am uninstall-matrixthemeDATA \
+       uninstall-modernthemeDATA
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
        distclean distclean-generic distclean-libtool distdir dvi \
        dvi-am html html-am info info-am install install-am \
        install-berlinthemeDATA install-data install-data-am \
-       install-dbus_serviceDATA install-desktopDATA install-exec \
-       install-exec-am install-info install-info-am install-man \
+       install-dbus_serviceDATA install-desktopDATA \
+       install-desktoppanelDATA install-exec install-exec-am \
+       install-info install-info-am install-man \
        install-matrixthemeDATA install-modernthemeDATA install-strip \
        installcheck installcheck-am installdirs maintainer-clean \
        maintainer-clean-generic mostlyclean mostlyclean-generic \
        mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
        uninstall-berlinthemeDATA uninstall-dbus_serviceDATA \
-       uninstall-desktopDATA uninstall-info-am \
-       uninstall-matrixthemeDATA uninstall-modernthemeDATA
+       uninstall-desktopDATA uninstall-desktoppanelDATA \
+       uninstall-info-am uninstall-matrixthemeDATA \
+       uninstall-modernthemeDATA
 
 
 livewp.desktop: livewp.desktop.in
        sed "s/__VERSION__/$(VERSION)/g" $< >$@.tmp && \
        sed "s/__PACKAGE__/$(PACKAGE)/g" $@.tmp >$@ && \
        $(RM) *.tmp
+
+livewpp.desktop: livewpp.desktop.in
+       sed "s/__VERSION__/$(VERSION)/g" $< >$@.tmp && \
+       sed "s/__PACKAGE__/$(PACKAGE)/g" $@.tmp >$@ && \
+       $(RM) *.tmp
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/applet/data/livewpp.desktop.in b/applet/data/livewpp.desktop.in
new file mode 100644 (file)
index 0000000..7587add
--- /dev/null
@@ -0,0 +1,10 @@
+[Desktop Entry] 
+Encoding=UTF-8
+Version=__VERSION__
+Name=Live Wallpaper
+Comment=Configuring Live Wallpaper
+Type=HildonControlPanelPlugin
+Icon=qgn_list_cp_isetup
+X-control-panel-plugin=liblivewp-panel-widget.so
+Categories=personalisation
+
index 11f86b8..6fd7bd0 100644 (file)
@@ -1,8 +1,9 @@
 live-wallpaper (0.4) unstable; urgency=low
 
-  * Nothing yet
+  * Fixed problem ith traffic light
+  * Added possibility to configure Live Wallpaper using Control Panel
 
- -- Vlad Vasiliev <vlad@gas.by>  Sun, 14 Apr 2010 16:21:10 +0200
+ -- Vlad Vasiliev <vlad@gas.by>  Sat, 24 Apr 2010 17:23:10 +0200
 
 live-wallpaper (0.3) unstable; urgency=low
 
index 47c3ea6..4196d40 100644 (file)
@@ -28,4 +28,15 @@ liblivewp_home_widget_la_LIBADD = $(EXAMPLE_LIBS) $(OSSO_LIBS)
 
 AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS) $(OSSO_CFLAGS) 
 
+panellib_LTLIBRARIES =  liblivewp-panel-widget.la
+panellibdir = $(HILDON_PANEL_LIB_DIR)
+
+liblivewp_panel_widget_la_SOURCES = livewp-settings.c livewp-settings.h livewp-common.h \
+                                  livewp-config.c livewp-config.h \
+                                  livewp-control-widget.c livewp-control-widget.h \
+                                  livewp-dbus.c livewp-dbus.h
+liblivewp_panel_widget_la_LIBADD = $(EXAMPLE_LIBS) $(OSSO_LIBS) $(CONTROLPANEL_LIBS) 
+
+liblivewp_panel_widget_la_CFLAGS = -Wall $(EXAMPLE_CFLAGS) $(OSSO_CFLAGS)  $(CONTROLPANEL_CFLAGS) -DCONTROLPANEL 
+
 
diff --git a/applet/src/livewp-control-widget.c b/applet/src/livewp-control-widget.c
new file mode 100644 (file)
index 0000000..dfe3be8
--- /dev/null
@@ -0,0 +1,51 @@
+/*vim: set sw=4 ts=4 et: */
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software 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 software 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 software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#include "livewp-common.h" 
+#include "livewp-control-widget.h"
+
+osso_return_t 
+execute(osso_context_t *osso, gpointer data, gboolean user_activated){
+
+    Animation_WallpaperPrivate *priv = g_new0 (Animation_WallpaperPrivate, 1);
+    priv->osso = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
+    /* Load config */
+    read_config(priv);
+    /* Initialize DBUS */
+    livewp_initialize_dbus(priv);
+
+
+    lw_settings(priv, data);
+    return OSSO_OK;
+
+}
+
+osso_return_t 
+save_state(osso_context_t *osso, gpointer data)
+{
+               /* ... save state ... */
+               fprintf(stderr,"SAVE state\n");
+               return OSSO_OK;
+}
+
diff --git a/applet/src/livewp-control-widget.h b/applet/src/livewp-control-widget.h
new file mode 100644 (file)
index 0000000..7b75f67
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software 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 software 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 software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
+#include <gtk/gtk.h>
+
index 89e746a..6884d82 100644 (file)
@@ -137,7 +137,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
                 fprintf(stderr, "\nCan not read config file.\n");
         }else{
             read_config(priv);
-#ifndef APPLICATION
+#if  !(defined APPLICATION || defined CONTROLPANEL)
             reload_scene(priv->desktop_plugin);
 #endif
         }
index 8ab9f6f..f7f0706 100644 (file)
@@ -1636,7 +1636,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
 */
     hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
     g_signal_connect (desktop_plugin, "show-settings",
-                            G_CALLBACK (lw_settings), priv);
+                            G_CALLBACK (show_settings), priv);
     gtk_widget_show (desktop_plugin->priv->main_widget);
     gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
     init_applet_position();
index cbe14a5..e33750e 100644 (file)
@@ -70,7 +70,7 @@ GType animation_wallpaper_plugin_get_type(void);
 
 G_END_DECLS
 
-void lw_settings(GtkWidget *widget, gpointer user_data);
+void lw_settings(gpointer user_data, gpointer data);
 void actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z);
 gint read_config(Animation_WallpaperPrivate *priv);
 void save_config(Animation_WallpaperPrivate *priv);
@@ -79,5 +79,5 @@ static void init_scene1(AWallpaperPlugin *desktop_plugin);
 static void init_scene2(AWallpaperPlugin *desktop_plugin);
 void create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin);
 void get_sun_screen_pos(double alt, double azm, gint * x, gint * y);
-
+void show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);
 #endif
index 0e29dc6..f878924 100644 (file)
@@ -32,7 +32,7 @@ btn_setting_clicked(HildonButton *btn, gpointer data)
     Animation_WallpaperPrivate *priv = data;
     // open settings dialog
     fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
-    lw_settings(priv->desktop_plugin, priv);
+    lw_settings(priv, NULL);
     fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
 }
 void
index 388aa2b..6304682 100644 (file)
@@ -102,8 +102,13 @@ create_rich_animation_button (gboolean active)
 }
 
 /*******************************************************************************/
+void
+show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
+    lw_settings(priv, NULL);
+}
+/*******************************************************************************/
 void 
-lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
+lw_settings(Animation_WallpaperPrivate *priv, gpointer data){
     gint result;
     GtkWidget *window = NULL;
     GtkWidget *save_button;
@@ -111,6 +116,7 @@ lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
     GtkWidget *rich_animation_button;
 
     window = gtk_dialog_new();
+
     gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
     gtk_window_set_modal(GTK_WINDOW(window), TRUE);
@@ -164,64 +170,3 @@ lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
         gtk_widget_destroy(window);
 }
 
-GtkWidget* 
-create_settings(void){
-    gint result;
-    GtkWidget *window = NULL;
-    GtkWidget *save_button;
-    GtkWidget *theme_button;
-    GtkWidget *rich_animation_button;
-
-    window = gtk_dialog_new();
-    gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
-    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
-    /* Create Theme button */
-    theme_button = create_themes_button("Modern");
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
-                                   theme_button, TRUE, TRUE, 5);
-    /* Create rich animation button */  
-    rich_animation_button = create_rich_animation_button(TRUE);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
-                                   rich_animation_button, TRUE, TRUE, 5);
-    gtk_widget_show (theme_button);
-    gtk_widget_show (rich_animation_button);
-    gtk_widget_show (window);
-    gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
-    save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
-#if 0
-    result = gtk_dialog_run(GTK_DIALOG(window));
-
-    switch(result){
-        case GTK_RESPONSE_YES:
-            if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
-                if (priv->theme)
-                    g_free(priv->theme);
-                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
-                    priv->theme = g_strdup("Berlin");
-                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
-                    priv->theme = g_strdup("Modern");
-                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
-                    priv->theme = g_strdup("Matrix");
-                if (hildon_check_button_get_active (rich_animation_button))
-                    priv->rich_animation = TRUE;
-                else
-                    priv->rich_animation = FALSE;
-            }
-            save_config(priv);
-            reload_scene(priv->desktop_plugin);
-        break;
-        default:
-        case GTK_RESPONSE_OK:
-        break;
-        case GTK_RESPONSE_NO:
-            gtk_widget_destroy(window);
-            window = NULL;
-            lw_about();
-        break;
-    }
-    if (window)
-        gtk_widget_destroy(window);
-#endif
-    return window;
-}
index 19ec23a..8c97a63 100644 (file)
@@ -23,8 +23,9 @@
 */
 /*******************************************************************************/
 #include "livewp-common.h"
-void lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);
+void lw_settings(Animation_WallpaperPrivate *priv, gpointer data);
 void save_config(Animation_WallpaperPrivate *priv);
 void reload_scene(AWallpaperPlugin *desktop_plugin);
 GtkWidget* create_settings(void);
+void show_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);