fixed bug #6497 livewp 5 and 6 and 7 processes allocating RAM while
authorvlad <vlad@vlanout.(none)>
Tue, 26 Oct 2010 18:35:40 +0000 (21:35 +0300)
committervlad <vlad@vlanout.(none)>
Tue, 26 Oct 2010 18:35:40 +0000 (21:35 +0300)
live-wallpapers are disabled

applet/debian/changelog
applet/src/livewp-home-widget.c
applet/src/livewp-main.c

index a0c855f..9548a18 100644 (file)
@@ -1,5 +1,13 @@
 live-wallpaper (1.0.2) unstable; urgency=low
 
+  * Updated Spain translation
+  * Fixed bug #6497 livewp 5 and 6 and 7 processes allocating RAM while
+    live-wallpapers are disabled
+
+ -- Vlad Vasiliev <vlad@gas.by>  Tue, 26 Oct 2010 23:29:10 +0200
+
+live-wallpaper (1.0.2) unstable; urgency=low
+
   * Updated Finish, Italian, Dutch translations
 
  -- Vlad Vasiliev <vlad@gas.by>  Sat, 16 Oct 2010 11:29:10 +0200
index 2418117..15c84f1 100644 (file)
@@ -48,6 +48,11 @@ lw_applet_realize (GtkWidget *widget)
     gint id; 
     AWallpaperPlugin *desktop_plugin = (AWallpaperPlugin *)widget;
     char* child_argv[] =  {"/usr/bin/livewp", "0", (char *) 0 };
+    GSList *stlist = NULL;
+    GSList *tmp = NULL;
+    GConfClient *gconf_client = NULL;
+    GConfValue *value = NULL;
+    gboolean result = TRUE;
 
 
     strid = g_strdup(hd_plugin_item_get_plugin_id (HD_PLUGIN_ITEM (widget)));
@@ -56,6 +61,25 @@ lw_applet_realize (GtkWidget *widget)
     desktop_plugin->priv->view = id;
     g_free(strid); 
 
+    /* Checking of running view */ 
+    gconf_client = gconf_client_get_default();
+    if (gconf_client){
+        stlist = gconf_client_get_list(gconf_client,
+                                           "/apps/osso/hildon-desktop/views/active",
+                                           GCONF_VALUE_INT, NULL);
+        if (stlist){
+            tmp = stlist;
+            result = FALSE;
+            while (tmp != NULL){
+                  if ((id + 1) == GPOINTER_TO_INT(tmp->data))
+                      result = TRUE;
+                  tmp = g_slist_next(tmp);
+            }
+            g_slist_free(stlist);
+        }
+        g_object_unref(gconf_client);
+    }
+
     switch (id){
            case 0: child_argv[1] = "1";
                break;
@@ -79,8 +103,9 @@ lw_applet_realize (GtkWidget *widget)
     }
     desktop_plugin->priv->one_in_all_view = get_one_in_all_views_from_config();
     /* Check one theme in all view mode */
-    if (!desktop_plugin->priv->one_in_all_view || 
-        (desktop_plugin->priv->one_in_all_view && id == 0)){
+    if (result && 
+       (!desktop_plugin->priv->one_in_all_view || 
+        (desktop_plugin->priv->one_in_all_view && id == 0))){
            /* Start a new process */
            desktop_plugin->priv->pid = fork();
            if (desktop_plugin->priv->pid == 0){
index 8482706..0863122 100644 (file)
@@ -333,23 +333,49 @@ main(int argc, char *argv[])
 {
     HildonProgram       *app;
     int view = 1;
+    GSList *stlist = NULL;
+    GSList *tmp = NULL;
+    GConfClient *gconf_client = NULL;
+    GConfValue *value = NULL;
+    gboolean result = TRUE;
 
+    /* Ininitializing */
+    hildon_gtk_init (&argc, &argv);
+    app = HILDON_PROGRAM (hildon_program_get_instance());
+    g_set_application_name (PACKAGE);
 
+    /* Set view from argument string */
     if (argc == 2)
         view = atoi(argv[1]);
     if (view < 1 || view > 9)
         view = 1;
 
+    /* Checking of running view */ 
+    gconf_client = gconf_client_get_default();
+    if (gconf_client){
+        stlist = gconf_client_get_list(gconf_client,
+                                           "/apps/osso/hildon-desktop/views/active",
+                                           GCONF_VALUE_INT, NULL);
+        if (stlist){
+            tmp = stlist;
+            result = FALSE;
+            while (tmp != NULL){
+                  if (view == GPOINTER_TO_INT(tmp->data))
+                      result = TRUE;
+                  tmp = g_slist_next(tmp);
+            }
+            g_slist_free(stlist);
+        }
+        g_object_unref(gconf_client);
+    }
+    if (!result)
+        exit (-3);
+
     AWallpaperPlugin *desktop_plugin = g_new0 (AWallpaperPlugin, 1);
     Animation_WallpaperPrivate *priv = g_new0 (Animation_WallpaperPrivate, 1);
     desktop_plugin->priv = priv;
 
 
-    /* Ininitializing */
-    hildon_gtk_init (&argc, &argv);
-    app = HILDON_PROGRAM (hildon_program_get_instance());
-    g_set_application_name (PACKAGE);
-
     priv->osso = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
     if(!priv->osso){
         fprintf(stderr,"osso_initialize failed\n");