next step for MPLAYER
authorVlad <vlad@gas.by>
Tue, 27 Jul 2010 08:29:36 +0000 (11:29 +0300)
committerVlad <vlad@gas.by>
Tue, 27 Jul 2010 08:29:36 +0000 (11:29 +0300)
applet/configure.ac
applet/src/livewp-common.h
applet/src/livewp-config.c
applet/src/livewp-config.h
applet/src/livewp-dbus.c
applet/src/livewp-home-widget.c
applet/src/livewp-main.c
applet/src/livewp-scene.c
applet/src/livewp-scene.h
applet/src/livewp-settings.c

index d6a7628..f148c63 100644 (file)
@@ -2,7 +2,7 @@ AC_PREREQ(2.61)
 AC_INIT([livewp], [0.4])
 AC_CONFIG_SRCDIR([src/livewp-home-widget.c])
 AC_CONFIG_HEADER([src/config.h:src/config.h.in])
-AM_INIT_AUTOMAKE(livewp, 0.4)
+AM_INIT_AUTOMAKE(livewp, 0.7)
 AC_PROG_LIBTOOL
 AC_PROG_INTLTOOL([0.23])
 
index 7dfcdbf..fad4728 100644 (file)
 #include <libosso.h>
 #include <gconf/gconf-client.h>
 #include <time.h> 
+#include <X11/extensions/Xrender.h>
+#include <gdk/gdkx.h>
+
+#include <X11/Xatom.h>
 
 #define GETTEXT_PACKAGE "livewp"
 #include <glib/gi18n-lib.h>
@@ -92,9 +96,11 @@ struct _Animation_WallpaperPrivate
     GKeyFile *config_file;
     gint view;
     pid_t  pid;
+    pid_t  podpid;
     guint view_notify;
     guint alive_timer;
     time_t last_alive_event;
+    gchar *theme_string_parametr1;
 };
 
 struct _AWallpaperPlugin
index 83cc40b..6b5c0db 100644 (file)
@@ -78,7 +78,17 @@ read_config(Animation_WallpaperPrivate *priv) {
         gconf_value_free(value);
     } else
         priv->rich_animation = TRUE;
-    
+    /* get theme additional parameter 1  */
+    str = g_strdup_printf("%s%i", GCONF_KEY_ADDIONAL_STRING_1 , id);
+    value = gconf_client_get(gconf_client, str, NULL);
+    if (str){ 
+        g_free(str);
+        str = NULL;
+    } 
+    if (value) {
+        priv->theme_string_parametr1 = g_strdup(gconf_value_get_string(value));
+        gconf_value_free(value);
+    } 
 
     return 0;
 }
@@ -119,5 +129,16 @@ save_config(Animation_WallpaperPrivate *priv) {
         g_free(str);
         str = NULL;
     }
+    if (priv->theme){
+        str = g_strdup_printf("%s%i",GCONF_KEY_ADDIONAL_STRING_1, id);
+        gconf_client_set_string(gconf_client,
+                  str,
+                  priv->theme_string_parametr1, NULL);
+        if (str){
+            g_free(str);
+            str = NULL;
+        }
+    }
+
     
 }
index 7431eaf..944baf3 100644 (file)
@@ -30,6 +30,7 @@
 #define GCONF_KEY_PREFIX                            "/apps/maemo/livewp"
 #define GCONF_KEY_THEME                             GCONF_KEY_PREFIX"/theme"
 #define GCONF_KEY_RANIMATION                        GCONF_KEY_PREFIX"/rich_animation"
+#define GCONF_KEY_ADDIONAL_STRING_1                  GCONF_KEY_PREFIX"/additional_string_1"
 gint read_config(Animation_WallpaperPrivate *priv); 
 void save_config(Animation_WallpaperPrivate *priv); 
 gint current_active_view(void);
index 9760d2c..a67230a 100644 (file)
@@ -143,7 +143,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     START_FUNCTION;
 #endif
 
-//#if 0
+#if 0
 #if  defined APPLICATION 
     fprintf (stderr, "APPLICATION PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg)); 
 #endif
@@ -155,7 +155,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
 #if !(defined CONTROLPANEL || defined APPLICATION) 
     fprintf (stderr, "APPLET PATH11111111111111111111 %s %s %s\n",   dbus_message_get_path(msg),   dbus_message_get_interface (msg), dbus_message_get_member (msg)); 
 #endif
-//#endif
+#endif
 
     if (!priv)
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -208,6 +208,7 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
         priv->last_alive_event = time(NULL);
     }
 
+    /* Check notification of mail, sms, call */
   //fprintf(stderr, "Type %i\n", dbus_message_get_type (msg));
     if (dbus_message_is_method_call(msg, NOTIFY_SIGNAL_INTERFACE, NOTIFY_MEMBER)){
         //fprintf(stderr,"read notifications.db notify\n");    
index 7c76039..8080134 100644 (file)
@@ -531,6 +531,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Berlin"), (gpointer)&init_scene_Berlin);
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Modern"), (gpointer)&init_scene_Modern);
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Matrix"), (gpointer)&init_scene_Matrix);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Mplayer"), (gpointer)&init_scene_Mplayer);
 //#endif
     //priv->theme = g_strdup("Modern");
     desktop_plugin->priv->main_widget = gtk_fixed_new();
@@ -541,23 +542,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
     init_applet_position(&(priv->xapplet), &(priv->yapplet));
 
     
-    //fprintf(stderr, "!!!theme = %s\n", priv->theme);
-    //snprintf(str, sizeof(str) - 1, "%s", "init_scene2");
-    //fprintf(stderr, " str = %s\n", str);
     priv->scene = NULL;
-#if 0
-    if (!strcmp(priv->theme,"Modern"))
-        init_scene_Modern(desktop_plugin);
-    else if (!strcmp(priv->theme,"Berlin")) 
-        init_scene_Berlin(desktop_plugin);
-    else if (!strcmp(priv->theme, "Matrix"))
-        init_scene_Matrix(desktop_plugin);
-#endif
-//    init_scene_theme(desktop_plugin);
-        
-//    priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
-    /* TODO Move scene to priv */
-    //scene.timer_type = LONG_TIMER_TYPE;
     g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
                    G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
 
index 1df8796..7508369 100644 (file)
 #include "livewp-settings.h"
 #include "livewp-home-widget.h"
 /*******************************************************************************/
-#include <X11/extensions/Xrender.h>
-#include <gdk/gdkx.h>
-
-#include <X11/Xatom.h>
 
 void 
 btn_setting_clicked(HildonButton *btn, gpointer data)
@@ -181,6 +177,7 @@ main(int argc, char *argv[])
 /* Create Main GUI */
     main_widget = hildon_window_new ();
     gtk_window_set_title(GTK_WINDOW(main_widget), PACKAGE);
+    gtk_window_fullscreen(GTK_WINDOW(main_widget));
     
     gtk_widget_show_all(GTK_WIDGET(main_widget));
 
@@ -188,9 +185,11 @@ main(int argc, char *argv[])
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Berlin"), (gpointer)&init_scene_Berlin);
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Modern"), (gpointer)&init_scene_Modern);
     g_hash_table_insert(priv->hash_scene_func, g_strdup("Matrix"), (gpointer)&init_scene_Matrix);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Mplayer"), (gpointer)&init_scene_Mplayer);
 
     priv->scene = NULL;
     priv->window = main_widget;
+    fprintf(stderr,"XWINDOW %i\n",GDK_WINDOW_XID (main_widget->window));
     priv->desktop_plugin = desktop_plugin;
 
     priv->view = view;
index 7cf01f6..b913aae 100644 (file)
@@ -48,17 +48,44 @@ reload_scene(AWallpaperPlugin *desktop_plugin)
 {
     fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);  
     destroy_scene(desktop_plugin);
-#if 0
-    if (!strcmp(desktop_plugin->priv->theme,"Modern"))
-        init_scene_Modern(desktop_plugin);
-    else if (!strcmp(desktop_plugin->priv->theme,"Berlin")) 
-        init_scene_Berlin(desktop_plugin);
-    else if (!strcmp(desktop_plugin->priv->theme,"Matrix")) 
-        init_scene_Matrix(desktop_plugin);
-#endif
     init_scene_theme(desktop_plugin);
 }
 
+void  
+parsestring(char *line, char **argv)
+{
+   while (*line != '\0') {  
+          while (*line == ' ' || *line == '\n')
+                *line++ = '\0';     /* replace white spaces with 0    */
+                 *argv++ = line;          /* save the argument position     */
+                 while (*line != '\0' && *line != ' ' && 
+                        *line != '\n') 
+                     line++;             /* skip the argument until ...    */
+   }
+                 *argv = '\0';                 /* mark the end of argument list  */
+}
+
+void
+init_scene_Mplayer(AWallpaperPlugin *desktop_plugin)
+{
+    fprintf(stderr,"init_scene_Mplayer\n");
+    char* child_argv[128];
+    char *run_string = NULL;
+
+    fprintf(stderr, "PARAMETR %s\n",  desktop_plugin->priv->theme_string_parametr1);
+    run_string = g_strdup_printf("/usr/bin/mplayer -vo x11 -wid %d %s\n", \
+                                GDK_WINDOW_XID(desktop_plugin->priv->window->window), desktop_plugin->priv->theme_string_parametr1);
+    parsestring(run_string, child_argv);
+
+    desktop_plugin->priv->podpid = fork();
+    if (desktop_plugin->priv->podpid == 0){
+       execvp("/usr/bin/mplayer", child_argv);
+       fprintf(stderr,"Problem with new podprocess");
+    }
+    g_free(run_string);
+
+}
+
 void
 init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
 {
index 303233e..2054400 100644 (file)
@@ -41,6 +41,7 @@ void reload_scene(AWallpaperPlugin *desktop_plugin);
 void init_scene_Modern(AWallpaperPlugin *desktop_plugin);
 void init_scene_Berlin(AWallpaperPlugin *desktop_plugin);
 void init_scene_Matrix(AWallpaperPlugin *desktop_plugin);
+void init_scene_Mplayer(AWallpaperPlugin *desktop_plugin);
 void init_scene_theme(AWallpaperPlugin *desktop_plugin);
 
 #endif
index f74e137..3fca25f 100644 (file)
@@ -34,7 +34,7 @@ void lw_about(void){
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
     gtk_window_set_modal(GTK_WINDOW(window), TRUE);
     vbox = gtk_vbox_new (FALSE, 5);
-    label_about = gtk_label_new (_("Live Wallpaper Version 0.6.2 \n Copyright(c) 2010\n \
+    label_about = gtk_label_new (_("Live Wallpaper Version 0.7 \n Copyright(c) 2010\n \
 Tanya Makova\n Vlad Vasiliev\n \
 Copyright(c) 2010 for design themes Berlin and Modern Vasya Bobrikov\n \
 Copyright(c) 2010 for design theme Matrix Andrew Zhilin\n \
@@ -62,6 +62,7 @@ create_theme_selector (void){
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
       hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Matrix"));
+      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Mplayer"));
       return selector;
 }
 /*******************************************************************************/
@@ -141,6 +142,10 @@ create_themes_button (gchar *theme){
             hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 2);
             hildon_button_set_value(HILDON_BUTTON(button), _("Matrix"));
         }
+        if (!strcmp(theme, "Mplayer")){
+            hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 3);
+            hildon_button_set_value(HILDON_BUTTON(button), _("Mplayer"));
+        }
 
     }
     return button;
@@ -266,21 +271,32 @@ lw_theme_settings(Animation_WallpaperPrivate *priv, GtkWidget *button){
         case GTK_RESPONSE_YES:
             /* Check theme */
             if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
+
                 if (priv->theme)
                     g_free(priv->theme);
+                if (priv->theme_string_parametr1)
+                    g_free(priv->theme_string_parametr1);
+                priv->theme_string_parametr1 = NULL;
+
                 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 (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Mplayer"))){
+                    priv->theme = g_strdup("Mplayer");
+                    priv->theme_string_parametr1 = g_strdup("/home/user/MyDocs/.videos/9.mp4");
+                }
+
             }
             /* Check rich animation */
             if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(rich_animation_button)))
                 priv->rich_animation = TRUE;
             else
                 priv->rich_animation = FALSE;
-                        /* Save config */
+
+            /* Save config */
             save_config(priv);
             /* action with applet */
             if (hildon_check_button_get_active (HILDON_CHECK_BUTTON(enable_button))){