added into billboard info about missed calls, sms, chat, mail from notifications...
authortanya <tanya@tanin.oblgaz>
Sat, 15 May 2010 12:09:48 +0000 (15:09 +0300)
committertanya <tanya@tanin.oblgaz>
Sat, 15 May 2010 12:09:48 +0000 (15:09 +0300)
applet/po/ru_RU.po
applet/src/livewp-actor.c
applet/src/livewp-scene.c

index ce19aa1..1b30c80 100644 (file)
@@ -70,6 +70,18 @@ msgstr "Сохранить"
 msgid "Theme"
 msgstr "Тема"
 
+msgid "Missed calls"
+msgstr "Пропущенные вызовы"
+
+msgid "Missed sms"
+msgstr "Пропущенные sms"
+
+msgid "Missed chat"
+msgstr "Пропущенные сообщения"
+
+msgid "Missed mail"
+msgstr "Пропущенная почта"
+
 #~ msgid "Settings"
 #~ msgstr "Настройки"
 
index cf028bc..25e89f2 100644 (file)
@@ -129,10 +129,67 @@ func_callback(void *user_data, int argc, char **argv, char **azColName)
     }
     return 0;
 }
+int get_notify_count(gchar *notify_type)
+{
+    sqlite3 *db = NULL;
+    sqlite3 *res = NULL;
+    gint rc = 0, result = 0;
+    gchar sql[1024];
+
+    rc = sqlite3_open("/home/user/.config/hildon-desktop/notifications.db", &db);
+    if (rc){
+        fprintf(stderr, "error open db %d %s\n", rc, sqlite3_errmsg(db));
+    }else {
+        snprintf(sql, sizeof(sql)-1, "select count(id) from notifications where icon_name='general_%s'", notify_type);
+        rc = sqlite3_prepare(db, sql, sizeof(sql)-1, &res, NULL);
+        if (rc != SQLITE_OK){
+            fprintf(stderr, "error prepare %d %s\n", rc, sql);
+        }
+        if (sqlite3_step(res) != SQLITE_ROW){
+            fprintf(stderr, "not sqlite_row\n");
+        }
+        result = sqlite3_column_int(res, 0);
+        //fprintf(stderr, "count missing calls = %d\n", call_count);
+        sqlite3_finalize(res);
+
+        sqlite3_close(db);
+    }
+    return result;
+}
+
 void 
 change_billboard(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
     GtkWidget *label;
+    gchar *message;
+    PangoFontDescription *pfd = NULL;
+    
+    //fprintf(stderr, "change billboard\n");
+    
+    label = actor->image;
+    message = g_markup_printf_escaped("<span bgcolor=\"%s\" foreground=\"%s\">%s: %d \n%s: %d \n%s: %d \n%s: %d</span>", "#FFFFFF", "#000000", 
+                                      _("Missed calls"),
+                                      get_notify_count("missed"), 
+                                      _("Missed sms"),
+                                      get_notify_count("sms"), 
+                                      _("Missed chat"),
+                                      get_notify_count("chat"), 
+                                      _("Missed mail"),
+                                      get_notify_count("mail"));
+    gtk_label_set_markup(GTK_LABEL(label), message);
+    g_free(message);
+    pfd = pango_font_description_from_string("Sans 14");
+    gtk_widget_modify_font(GTK_WIDGET(label), NULL);
+    gtk_widget_modify_font(GTK_WIDGET(label), pfd);
+    pango_font_description_free(pfd);
+    actor->time_start_animation = time(NULL) + 20;    
+}
+
+
+void 
+change_billboard1(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+    GtkWidget *label;
     sqlite3 *db = NULL;
     sqlite3_stmt *res = NULL;
     gchar *errMsg = NULL, *message;
index 7410060..d012083 100644 (file)
@@ -220,7 +220,7 @@ init_scene_Modern(AWallpaperPlugin *desktop_plugin)
   scene->actors = g_slist_append(scene->actors, actor);
 
   actor = init_object(desktop_plugin, "billboard_text", "",
-                      460, 180, 9, 300, 108,
+                      470, 174, 9, 300, 108,
                       TRUE, FALSE, 100, 255,
                       (gpointer)&change_billboard, NULL, NULL);
   create_hildon_actor_text(actor, desktop_plugin);