Increased to 9 supported view
authorVlad <vlad@gas.by>
Tue, 28 Sep 2010 15:11:01 +0000 (18:11 +0300)
committerVlad <vlad@gas.by>
Tue, 28 Sep 2010 15:11:01 +0000 (18:11 +0300)
applet/debian/changelog
applet/src/livewp-common.h
applet/src/livewp-dbus.c
applet/src/livewp-settings.c

index ace2a07..de6a713 100644 (file)
@@ -1,6 +1,7 @@
 live-wallpaper (1.0) unstable; urgency=low
 
   * Added theme 'Flash' 
+  * Increased to 9 supported view  
 
  -- Vlad Vasiliev <vlad@gas.by>  Wed, 25 Sep 2010 20:59:10 +0200
 
index fb92315..da3a2f4 100644 (file)
@@ -138,20 +138,40 @@ struct _AWallpaperPluginClass
 #define LIVEWP_STOP_LIVEBG_ON_VIEW2 "stop_livebg_on_view2"
 #define LIVEWP_STOP_LIVEBG_ON_VIEW3 "stop_livebg_on_view3"
 #define LIVEWP_STOP_LIVEBG_ON_VIEW4 "stop_livebg_on_view4"
+#define LIVEWP_STOP_LIVEBG_ON_VIEW5 "stop_livebg_on_view5"
+#define LIVEWP_STOP_LIVEBG_ON_VIEW6 "stop_livebg_on_view6"
+#define LIVEWP_STOP_LIVEBG_ON_VIEW7 "stop_livebg_on_view7"
+#define LIVEWP_STOP_LIVEBG_ON_VIEW8 "stop_livebg_on_view8"
+#define LIVEWP_STOP_LIVEBG_ON_VIEW9 "stop_livebg_on_view9"
 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW1 "pause_livebg_on_view1"
 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW2 "pause_livebg_on_view2"
 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW3 "pause_livebg_on_view3"
 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW4 "pause_livebg_on_view4"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW5 "pause_livebg_on_view5"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW6 "pause_livebg_on_view6"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW7 "pause_livebg_on_view7"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW8 "pause_livebg_on_view8"
+#define LIVEWP_PAUSE_LIVEBG_ON_VIEW9 "pause_livebg_on_view9"
 #define LIVEWP_PAUSE_LIVEBG_ON_VIEW "pause_livebg_on_view"
 #define LIVEWP_PLAY_LIVEBG_ON_VIEW1 "play_livebg_on_view1"
 #define LIVEWP_PLAY_LIVEBG_ON_VIEW2 "play_livebg_on_view2"
 #define LIVEWP_PLAY_LIVEBG_ON_VIEW3 "play_livebg_on_view3"
 #define LIVEWP_PLAY_LIVEBG_ON_VIEW4 "play_livebg_on_view4"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW5 "play_livebg_on_view5"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW6 "play_livebg_on_view6"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW7 "play_livebg_on_view7"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW8 "play_livebg_on_view8"
+#define LIVEWP_PLAY_LIVEBG_ON_VIEW9 "play_livebg_on_view9"
 #define LIVEWP_PLAY_LIVEBG_ON_VIEW "play_livebg_on_view"
 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW1 "alive_livebg_on_view1"
 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW2 "alive_livebg_on_view2"
 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW3 "alive_livebg_on_view3"
 #define LIVEWP_ALIVE_LIVEBG_ON_VIEW4 "alive_livebg_on_view4"
+#define LIVEWP_ALIVE_LIVEBG_ON_VIEW5 "alive_livebg_on_view5"
+#define LIVEWP_ALIVE_LIVEBG_ON_VIEW6 "alive_livebg_on_view6"
+#define LIVEWP_ALIVE_LIVEBG_ON_VIEW7 "alive_livebg_on_view7"
+#define LIVEWP_ALIVE_LIVEBG_ON_VIEW8 "alive_livebg_on_view8"
+#define LIVEWP_ALIVE_LIVEBG_ON_VIEW9 "alive_livebg_on_view9"
 
 
 
index 9836476..f562488 100644 (file)
@@ -197,7 +197,12 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     if ((priv->view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW1))||
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW3))||   
-        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW4))){
+        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW4))||   
+        (priv->view == 5 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW5))||   
+        (priv->view == 6 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW6))||   
+        (priv->view == 7 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW7))||   
+        (priv->view == 8 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW8))||   
+        (priv->view == 9 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_STOP_LIVEBG_ON_VIEW9))){
 
         quit_from_program(priv);
     }
@@ -205,7 +210,12 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     if ((priv->view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW1))||
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW3))||   
-        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW4))){
+        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW4))||   
+        (priv->view == 5 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW5))||   
+        (priv->view == 6 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW6))||   
+        (priv->view == 7 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW7))||   
+        (priv->view == 8 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW8))||   
+        (priv->view == 9 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PLAY_LIVEBG_ON_VIEW9))){
         /* fprintf(stderr, "Play scene visible %i\n", priv->visible); */
         if (priv->visible != TRUE){
             priv->visible = TRUE;
@@ -216,7 +226,12 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     if ((priv->view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW1))||
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW3))||   
-        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW4))){
+        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW4))||   
+        (priv->view == 5 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW5))||   
+        (priv->view == 6 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW6))||   
+        (priv->view == 7 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW7))||   
+        (priv->view == 8 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW8))||   
+        (priv->view == 9 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_PAUSE_LIVEBG_ON_VIEW9))){
          /* fprintf(stderr, "Pause scene visible %i\n", priv->visible); */
          if (priv->visible != FALSE){
             priv->visible = FALSE;
@@ -227,7 +242,12 @@ get_livewp_signal_cb(DBusConnection *conn, DBusMessage *msg, Animation_Wallpaper
     if ((priv->view == 1 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW1))||
         (priv->view == 2 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW2))||   
         (priv->view == 3 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW3))||   
-        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW4))){
+        (priv->view == 4 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW4))||   
+        (priv->view == 5 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW5))||   
+        (priv->view == 6 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW6))||   
+        (priv->view == 7 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW7))||   
+        (priv->view == 8 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW8))||   
+        (priv->view == 9 && dbus_message_is_signal(msg, LIVEWP_SIGNAL_INTERFACE, LIVEWP_ALIVE_LIVEBG_ON_VIEW9))){
 
         priv->last_alive_event = time(NULL);
     }
index 3da182e..5ef785d 100644 (file)
@@ -179,7 +179,7 @@ create_image_button (gint view, DBusConnection *conn_sess){
     g_object_set_data(G_OBJECT(event_box), "view", GINT_TO_POINTER(view));
     g_object_set_data(G_OBJECT(event_box), "priv", priv);
     set_button_image(event_box, priv, check_applet_state(view));
-    g_signal_connect(G_OBJECT (event_box), "button_press_event", G_CALLBACK(theme_button_clicked), priv);
+    g_signal_connect(G_OBJECT (event_box), "button_release_event", G_CALLBACK(theme_button_clicked), priv);
     return event_box;
 #if 0
     button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
@@ -459,10 +459,12 @@ void
 create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){
     GtkWidget *hbox = NULL;
     GtkWidget *area_hbox = NULL;
-    GtkWidget *theme_button1;
-    GtkWidget *theme_button2;
-    GtkWidget *theme_button3;
-    GtkWidget *theme_button4;
+    GtkWidget *theme_button;
+    GSList *stlist = NULL;
+    GConfClient *gconf_client = NULL;
+    GConfValue *value = NULL;
+    guint count_of_view = 1; 
+    guint i;
 
 
     area_hbox = g_object_get_data(G_OBJECT(priv->window), "area_hbox");
@@ -472,31 +474,39 @@ create_themes_buttons_hbox(Animation_WallpaperPrivate *priv){
     if (hbox){
         gtk_widget_destroy(hbox);
     }
+   
     hbox = gtk_hbox_new(FALSE, 0);
     g_object_set_data(G_OBJECT(priv->window), "custom_hbox", hbox);
     gtk_box_pack_start(GTK_BOX(area_hbox),
                                    hbox, FALSE, FALSE, 5);
     /* Create Theme buttons */
-    theme_button1 = create_image_button(1, priv->dbus_conn_session);
+    theme_button = create_image_button(1, priv->dbus_conn_session);
     gtk_box_pack_start(GTK_BOX(hbox),
-                                   theme_button1, TRUE, TRUE, 0);
-    gtk_widget_show (theme_button1);
+                                   theme_button, TRUE, TRUE, 10);
+    gtk_widget_show (theme_button);
     gtk_widget_show (hbox);
     if (priv->one_in_all_view)
         return;
-    theme_button2 = create_image_button(2, priv->dbus_conn_session);
-    gtk_box_pack_start(GTK_BOX(hbox),
-                                   theme_button2, TRUE, TRUE, 0);
-    gtk_widget_show (theme_button2);
-    theme_button3 = create_image_button(3, priv->dbus_conn_session);
-    gtk_box_pack_start(GTK_BOX(hbox),
-                                   theme_button3, TRUE, TRUE, 0);
-    gtk_widget_show (theme_button3);
-    theme_button4 = create_image_button(4, priv->dbus_conn_session);
-    gtk_box_pack_start(GTK_BOX(hbox),
-                                   theme_button4, TRUE, TRUE, 0);
-    gtk_widget_show (theme_button4);
 
+    gconf_client = gconf_client_get_default();
+    if (!gconf_client)
+        return;
+
+    stlist = gconf_client_get_list(gconf_client,
+                                       "/apps/osso/hildon-desktop/views/active",
+                                       GCONF_VALUE_INT, NULL);
+    if (stlist){
+        count_of_view = g_slist_length(stlist);
+        g_slist_free(stlist);
+    }else
+        count_of_view = 4;
+    g_object_unref(gconf_client);
+    for (i = 2; i < count_of_view + 1; i++){
+        theme_button = create_image_button(i, priv->dbus_conn_session);
+        gtk_box_pack_start(GTK_BOX(hbox),
+                                   theme_button, TRUE, TRUE, 10);
+        gtk_widget_show (theme_button);
+    } 
 }
 /*******************************************************************************/
 void
@@ -505,8 +515,10 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
     GtkWidget *window = NULL;
     GtkWidget *banner = NULL;
     GtkWidget *area_hbox;
+    GtkWidget *scrolled_window;
     GtkWidget *one_in_all_view_button;
     gboolean one_in_all_view;
+    gint i;
 
     window = gtk_dialog_new();
     priv->window = window;
@@ -520,38 +532,26 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), one_in_all_view_button, TRUE, TRUE, 5);
     area_hbox = gtk_vbox_new(FALSE, 2);
     g_object_set_data(G_OBJECT(window), "area_hbox", area_hbox);
+
     create_themes_buttons_hbox(priv);
+    scrolled_window = hildon_pannable_area_new ();
+    g_object_set (G_OBJECT (scrolled_window), "mov-mode", HILDON_MOVEMENT_MODE_HORIZ, NULL);
+    g_object_set (G_OBJECT (scrolled_window), "hscrollbar-policy", GTK_POLICY_ALWAYS, NULL);
+    g_object_set (G_OBJECT (scrolled_window), "scrollbar-fade-delay", 27000, NULL);
+    g_object_set (G_OBJECT (scrolled_window), "indicator-width", 28, NULL);
+    gtk_widget_set_size_request(scrolled_window, -1, 100);
+    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA (scrolled_window), GTK_WIDGET (area_hbox));
+
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
-                                   area_hbox, TRUE, TRUE, 0);
+                                   scrolled_window, TRUE, TRUE, 0);
 
-    gtk_widget_show (one_in_all_view_button);
-    gtk_widget_show_all (area_hbox);
-    gtk_widget_show (window);
+    gtk_widget_show(scrolled_window);
+    gtk_widget_show(one_in_all_view_button);
+    gtk_widget_show_all(area_hbox);
+    gtk_widget_show(window);
     gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
 
     result = gtk_dialog_run(GTK_DIALOG(window));
-/*
-    priv_temp = g_object_get_data(G_OBJECT(theme_button1), "priv");
-    if (priv_temp){
-        g_free(priv_temp);
-        priv_temp =NULL;
-    }
-    priv_temp = g_object_get_data(G_OBJECT(theme_button2), "priv");
-    if (priv_temp){
-        g_free(priv_temp);
-        priv_temp =NULL;
-    }
-    priv_temp = g_object_get_data(G_OBJECT(theme_button3), "priv");
-    if (priv_temp){
-        g_free(priv_temp);
-        priv_temp =NULL;
-    }
-    priv_temp = g_object_get_data(G_OBJECT(theme_button4), "priv");
-    if (priv_temp){
-        g_free(priv_temp);
-        priv_temp =NULL;
-    }
-*/
 
     switch(result){
         case GTK_RESPONSE_NO:
@@ -566,10 +566,8 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
         //fprintf(stderr,"CHECK!!!!!!!!!!!!!!\n");
         banner = hildon_banner_show_information (window, NULL, _("Livewallpaper is reloading..."));
         hildon_banner_set_timeout(HILDON_BANNER(banner), 3000);
-        stop_applet(1);
-        stop_applet(2);
-        stop_applet(3);
-        stop_applet(4);
+        for (i=1;i<10;i++)
+            stop_applet(i);
         g_timeout_add(3000, (GSourceFunc)cb_timeout_settings, window);
     }else{
         if (window)
@@ -580,10 +578,9 @@ lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data){
 gboolean
 cb_timeout_settings(GtkWidget *window){
 
-    start_applet(1);
-    start_applet(2);
-    start_applet(3);
-    start_applet(4);
+    gint i;
+    for (i=1;i<10;i++)
+        start_applet(i);
 
     if (window)
         gtk_widget_destroy(window);
@@ -981,7 +978,7 @@ check_applet_state(gint number){
     GKeyFile *gkey_file = NULL;
     gchar *str = NULL;
     gboolean result = FALSE;
-    if (number > 4 || number < 1)
+    if (number > 9 || number < 1)
         return FALSE;
 
     str = g_strdup_printf("livewp-home-widget.desktop-%i", (number - 1));
@@ -1002,7 +999,7 @@ start_applet(gint number){
     GKeyFile *gkey_file = NULL;
     gchar *str = NULL;
 
-    if (number > 4 || number < 1)
+    if (number > 9 || number < 1)
         return;
     str = g_strdup_printf("livewp-home-widget.desktop-%i",(number - 1));
     config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");
@@ -1025,7 +1022,7 @@ stop_applet(gint number){
     GKeyFile *gkey_file = NULL;
     gchar *str = NULL;
 
-    if (number > 4 || number < 1)
+    if (number > 9 || number < 1)
         return;
     str = g_strdup_printf("livewp-home-widget.desktop-%i", (number - 1));
     config_file = hd_config_file_new(NULL, "/home/user/.config/hildon-desktop/", "home.plugins");