[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch for xgnokii_sms.c, SMS is marked as read when you click on it
From: |
Ulrich Hopp |
Subject: |
patch for xgnokii_sms.c, SMS is marked as read when you click on it |
Date: |
Sun, 19 Jan 2003 20:55:43 +0100 |
User-agent: |
KMail/1.4.3 |
Hi,
gnokii : latest version from CVS 0.5.0pre (04.01.2003)
Phone : Nokia 6310 V 4.10 04-01-02 NPE-4
Cabel : DLR3-3P
System SuSE 8.1 ( ftp update )
regards
Uli
--- xgnokii_sms.c.orig 2003-01-19 20:22:35.000000000 +0100
+++ xgnokii_sms.c 2003-01-19 20:25:52.000000000 +0100
@@ -236,6 +236,46 @@
}
+/* This function works only if phoneMonitor.sms.messages.number
+ ( = data->number) is the number of the SMS in the current folder
+ ( = row + 1, row = 0 is the first row in the SMS list )
+*/
+static void MarkSMSasRead(gpointer d, gpointer userData)
+{
+ gn_sms *data = (gn_sms *) d;
+ gint row = *(gint *) userData;
+ gchar *dprint_status1;
+ gint valid;
+ row = row + 1 ;
+
+ if ((valid = IsValidSMSforFolder(d, userData))) {
+#ifdef XDEBUG
+ switch (data->status) {
+ case GN_SMS_Read:
+ dprint_status1 = g_strdup(_("read"));
+ break;
+ case GN_SMS_Unread:
+ dprint_status1 = g_strdup(_("unread"));
+ break;
+ case GN_SMS_Sent:
+ dprint_status1 = g_strdup(_("sent"));
+ break;
+ case GN_SMS_Unsent:
+ dprint_status1 = g_strdup(_("not sent"));
+ break;
+ default:
+ dprint_status1 = g_strdup(_("unknown"));
+ break;
+ }
+ dprintf("In MarkSMSasRead : data->status : %s \n", dprint_status1);
+ dprintf("In MarkSMSasRead : data->number : %i row : %i\n",
data->number,
row);
+
+#endif
+ if ( data->number == row ) data->status = GN_SMS_Read;
+ };
+}
+
+
static void InsertFolderElement(gpointer d, gpointer userData)
{
gn_sms *data = (gn_sms *) d;
@@ -393,8 +433,31 @@
gint row, gint column, GdkEventButton * event, gpointer
data)
{
gchar *buf;
+ gchar *text1, *text2, *text3;
+ text2 = g_strdup(_("unread"));
+
+ /* Mark SMS as read */
+
+ if (gtk_clist_get_text(GTK_CLIST(clist), row, 0, &(text1)) ) {
+ dprintf("*text1: %s *text2: %s \n", text1, text2);
+ if ( *text1 == *text2 ) {
+
+ /* Store the read status in phoneMonitor.sms.messages */
+
+ g_slist_foreach(phoneMonitor.sms.messages, (GFunc) MarkSMSasRead,
(gpointer) &(row));
+ text3 = g_strdup(_("read"));
+
+ /* Change the status now in the clist window and don't wait for */
+ /* the next refresh command */
+
+ gtk_clist_freeze(GTK_CLIST(clist));
+
+ gtk_clist_set_text(GTK_CLIST(clist), row, 0, text3);
- /* FIXME - We must mark SMS as read */
+ gtk_clist_thaw(GTK_CLIST(clist));
+ };
+ };
+
gtk_text_freeze(GTK_TEXT(SMS.smsText));
gtk_text_set_point(GTK_TEXT(SMS.smsText), 0);