|
From: CORE C. L. <cor...@li...> - 2000-11-20 22:32:00
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.h callbacks.c panes.c
Log Message:
Added some comments, changed the display order of the mail list columns, and fixed an indentation problem with the "From" ctree column.
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- account.h 2000/11/20 21:02:13 1.3
+++ account.h 2000/11/20 22:32:00 1.4
@@ -1,30 +1,60 @@
-typedef struct {
- char *full_name;
- char *name;
- char *address;
- char *server;
- char *path;
+/* The types of mailboxes available */
+typedef enum {
+ Local,
+ POP3,
+ IMAP
+} AccountType;
- FILE *fp;
+/* Structure to track account information. */
+typedef struct {
+ /* Folder specific info */
+ char *name; /* Name of the mailbox. */
+ AccountType type; /* Mailbox type. */
+ char *path; /* Path to the local mailbox. */
+ FILE *fp; /* Pointer to the local mbox file */
+
+ /* User specific info */
+ char *full_name; /* The full name of the user. */
+ char *address; /* E-mail address for this mailbox. */
+
+ /* Server specific info */
+ char *server; /* Address of the server for POP3 or IMAP. */
+ char *username; /* Username for POP3 or IMAP */
+ char *password; /* Password for POP3 or IMAP */
} Account;
+
+/* Allocate the memory for and initialize a new account structure. */
Account *new_account(void);
+/* Free an account created with new_account() */
int destroy_account(Account * ac);
+/* Set the address of account ac to the string address */
int account_set_address(Account * ac, char *address);
+/* Return a malloc()'d copy of the address in account ac. */
char *account_get_address(Account * ac);
+/* Set the server name of account ac to the string server */
int account_set_server(Account * ac, char *server);
+/* Return a malloc()'d copy of the server name in account ac. */
char *account_get_server(Account * ac);
+/* Set the path of account ac to the string path */
int account_set_path(Account * ac, char *path);
+/* Return a malloc()'d copy of the path in account ac. */
char *account_get_path(Account * ac);
+/* Set the mailbox name of account ac to the string name */
+int account_set_name(Account * ac, char *name);
+/* Return a malloc()'d copy of the mailbox name in account ac. */
char *account_get_name(Account * ac);
-int account_set_name(Account * ac, char *path);
-char *account_get_name(Account * ac);
-int account_set_name(Account * ac, char *path);
+/* Set the full name of account ac to the string path */
+int account_set_full_name(Account * ac, char *fullname);
+/* Return a malloc()'d copy of the full name in account ac. */
+char *account_get_full_name(Account * ac);
+/* Read in the settings found in the file path, return an account structure */
Account *account_read(gchar * path);
+/* Move through the various folders returning them one at a time */
Account *get_next_folder(void);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- callbacks.c 2000/11/20 21:02:13 1.15
+++ callbacks.c 2000/11/20 22:32:00 1.16
@@ -389,8 +389,9 @@
break;
col = 0;
- if (config.ml_priority == 1) {
- found = find_header(head, "Priority:");
+
+ if (config.ml_from == 1) {
+ found = find_header(head, "From:");
if (found)
text[col] = header_get_value(found);
else
@@ -398,13 +399,8 @@
col++;
}
- if (config.ml_read == 1) {
- text[col] = g_strdup("");
- col++;
- }
-
- if (config.ml_attachment == 1) {
- found = find_header(head, "Attachment:");
+ if (config.ml_subject == 1) {
+ found = find_header(head, "Subject:");
if (found)
text[col] = header_get_value(found);
else
@@ -412,8 +408,8 @@
col++;
}
- if (config.ml_score == 1) {
- found = find_header(head, "Score:");
+ if (config.ml_date == 1) {
+ found = find_header(head, "Date:");
if (found)
text[col] = header_get_value(found);
else
@@ -421,8 +417,8 @@
col++;
}
- if (config.ml_from == 1) {
- found = find_header(head, "From:");
+ if (config.ml_server == 1) {
+ found = find_header(head, "Server:");
if (found)
text[col] = header_get_value(found);
else
@@ -430,8 +426,8 @@
col++;
}
- if (config.ml_subject == 1) {
- found = find_header(head, "Subject:");
+ if (config.ml_priority == 1) {
+ found = find_header(head, "Priority:");
if (found)
text[col] = header_get_value(found);
else
@@ -439,8 +435,8 @@
col++;
}
- if (config.ml_date == 1) {
- found = find_header(head, "Date:");
+ if (config.ml_attachment == 1) {
+ found = find_header(head, "Attachment:");
if (found)
text[col] = header_get_value(found);
else
@@ -448,8 +444,8 @@
col++;
}
- if (config.ml_server == 1) {
- found = find_header(head, "Server:");
+ if (config.ml_score == 1) {
+ found = find_header(head, "Score:");
if (found)
text[col] = header_get_value(found);
else
@@ -457,6 +453,11 @@
col++;
}
+ if (config.ml_read == 1) {
+ text[col] = g_strdup("");
+ col++;
+ }
+
temp = header_get_value(find_header(head, "References:"));
if (temp)
@@ -471,7 +472,7 @@
free(temp);
item =
- gtk_ctree_insert_node(GTK_CTREE(mail_ctree), NULL,
+ gtk_ctree_insert_node(GTK_CTREE(mail_ctree), top,
NULL, text, 0, NULL, NULL, NULL,
NULL, FALSE, TRUE);
@@ -493,11 +494,11 @@
int folder_unselected(GtkWidget * list, GList * node, gint col,
gpointer data)
{
+ return TRUE;
list = NULL;
node = NULL;
col = 0;
data = NULL;
- return TRUE;
}
int mail_selected(GtkWidget * list, GList * node, gint col, gpointer data)
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- panes.c 2000/11/20 21:02:13 1.4
+++ panes.c 2000/11/20 22:32:00 1.5
@@ -123,54 +123,90 @@
g_strconcat(getenv("HOME"), "/.core/themes/", config.theme,
"/", NULL);
- if (config.ml_priority == 1) {
- field_titles[col] = "Priority";
- ipriority = col;
- col++;
- }
- if (config.ml_read == 1) {
- field_titles[col] = "";
- iread = col;
- col++;
- }
- if (config.ml_attachment == 1) {
- field_titles[col] = "";
- iattachment = col;
- col++;
- }
- if (config.ml_score == 1) {
- field_titles[col] = "Score";
- iscore = col;
- col++;
- }
if (config.ml_from == 1) {
field_titles[col] = "From";
ifrom = col;
col++;
}
+
if (config.ml_subject == 1) {
field_titles[col] = "Subject";
isubject = col;
col++;
}
+
if (config.ml_date == 1) {
field_titles[col] = "Date";
idate = col;
col++;
}
+
if (config.ml_server == 1) {
field_titles[col] = "Server";
iserver = col;
col++;
}
+ if (config.ml_priority == 1) {
+ field_titles[col] = "Priority";
+ ipriority = col;
+ col++;
+ }
+
+ if (config.ml_attachment == 1) {
+ field_titles[col] = "";
+ iattachment = col;
+ col++;
+ }
+
+ if (config.ml_score == 1) {
+ field_titles[col] = "Score";
+ iscore = col;
+ col++;
+ }
+
+ if (config.ml_read == 1) {
+ field_titles[col] = "";
+ iread = col;
+ col++;
+ }
+
+
mail_ctree = gtk_ctree_new_with_titles(col, 0, field_titles);
gtk_signal_connect(GTK_OBJECT(mail_ctree), "tree_select_row",
GTK_SIGNAL_FUNC(mail_selected), NULL);
+ if (config.ml_from == 1) {
+ gtk_clist_set_column_width(GTK_CLIST(mail_ctree), ifrom,
+ 250);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ ifrom, FALSE);
+ }
+
+ if (config.ml_subject == 1) {
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ isubject, TRUE);
+ }
+
+ if (config.ml_date == 1) {
+ gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate,
+ 100);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ idate, FALSE);
+ }
+
+ if (config.ml_server == 1) {
+ gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iserver,
+ 40);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ iserver, FALSE);
+ }
+
if (config.ml_priority) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree),
ipriority, 40);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ ipriority, FALSE);
}
if (config.ml_read == 1) {
@@ -186,6 +222,8 @@
read);
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iread,
8);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ iread, FALSE);
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
@@ -203,6 +241,8 @@
iattachment, attachment);
gtk_clist_set_column_width(GTK_CLIST(mail_ctree),
iattachment, 8);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ iattachment, FALSE);
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
}
@@ -211,26 +251,8 @@
if (config.ml_score == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iscore,
30);
- }
-
- if (config.ml_from == 1) {
- gtk_clist_set_column_width(GTK_CLIST(mail_ctree), ifrom,
- 250);
- }
-
- if (config.ml_subject == 1) {
- gtk_clist_set_column_width(GTK_CLIST(mail_ctree), isubject,
- 125);
- }
-
- if (config.ml_date == 1) {
- gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate,
- 100);
- }
-
- if (config.ml_server == 1) {
- gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iserver,
- 40);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
+ iscore, FALSE);
}
text = (char **) g_malloc(5 * sizeof(char *));
|
|
From: CORE C. L. <cor...@li...> - 2000-11-20 22:59:02
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c account.h callbacks.c
Log Message:
Fixed some folder selection bugs. Still one more lurking, I'll have to look at it again later.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- account.c 2000/11/20 21:02:13 1.5
+++ account.c 2000/11/20 22:59:01 1.6
@@ -234,3 +234,12 @@
return mbox;
}
+
+int account_reset_file(Account *ac)
+{
+ if (!ac || !ac->fp)
+ return FALSE;
+
+ rewind(ac->fp);
+ return TRUE;
+}
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- account.h 2000/11/20 22:32:00 1.4
+++ account.h 2000/11/20 22:59:01 1.5
@@ -23,7 +23,6 @@
char *password; /* Password for POP3 or IMAP */
} Account;
-
/* Allocate the memory for and initialize a new account structure. */
Account *new_account(void);
/* Free an account created with new_account() */
@@ -58,3 +57,6 @@
Account *account_read(gchar * path);
/* Move through the various folders returning them one at a time */
Account *get_next_folder(void);
+
+/* Reset the file pointer for the local mailbox */
+int account_reset(Account *ac);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- callbacks.c 2000/11/20 22:32:00 1.16
+++ callbacks.c 2000/11/20 22:59:01 1.17
@@ -485,7 +485,8 @@
free);
destroy_message(message);
}
- current_mbox = mbox;
+ current_mbox = mbox;
+ account_reset_file(mbox);
return TRUE;
data = NULL;
@@ -494,6 +495,8 @@
int folder_unselected(GtkWidget * list, GList * node, gint col,
gpointer data)
{
+ gtk_ctree_remove_node(GTK_CTREE(mail_ctree), NULL);
+
return TRUE;
list = NULL;
node = NULL;
|
|
From: CORE C. L. <cor...@li...> - 2000-11-21 17:59:02
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c account.h callbacks.c callbacks.h
Log Message:
Fixed new_account to initialize all members of account struct. Made callbacks.c
use the account API.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- account.c 2000/11/21 05:10:40 1.7
+++ account.c 2000/11/21 17:59:01 1.8
@@ -17,6 +17,8 @@
ret->name = NULL;
ret->full_name = NULL;
+ ret->username = NULL;
+ ret->password = NULL;
ret->address = NULL;
ret->server = NULL;
ret->path = NULL;
@@ -62,6 +64,30 @@
return TRUE;
}
+int account_set_username(Account * ac, char *username)
+{
+ if (!username || !ac)
+ return FALSE;
+
+ if (ac->username)
+ free(ac->username);
+
+ ac->username = g_strdup(username);
+ return TRUE;
+}
+
+int account_set_password(Account * ac, char *password)
+{
+ if (!password || !ac)
+ return FALSE;
+
+ if (ac->password)
+ free(ac->password);
+
+ ac->password = g_strdup(password);
+ return TRUE;
+}
+
char *account_get_name(Account * ac)
{
if (!ac)
@@ -182,35 +208,55 @@
account_set_server(acct, line + 12);
else if (g_strncasecmp(line, "full_name=", 10) == 0)
account_set_fullname(acct, line + 10);
- else if (g_strncasecmp(line, "email_address=", 14) == 0)
- account_set_address(acct, line + 14);
- else if (g_strncasecmp(line, "path=", 5) == 0)
- account_set_path(acct, line + 5);
+ else if (g_strncasecmp(line, "email_address=", 14) == 0)
+ account_set_address(acct, line + 14);
+ else if (g_strncasecmp(line, "path=", 5) == 0)
+ account_set_path(acct, line + 5);
}
return acct;
}
-Account *account_write(Account * acct)
+int account_write(Account * acct)
{
FILE *fp;
- gchar *file = g_strconcat(getenv("HOME"), "/.core/accounts/", acct->name, NULL);
+ gchar *file;
+
+ if (!acct)
+ return FALSE;
+
+ file =
+ g_strconcat(getenv("HOME"), "/.core/accounts/", acct->name,
+ NULL);
fp = fopen(file, "w");
if (fp == NULL) {
perror("fopen");
- return NULL;
+ return FALSE;
}
+
+ if (acct->name && *acct->name)
+ fprintf(fp, "account_name=%s\n", acct->name);
- fprintf(fp, "account_name=%s\n", acct->name);
- fprintf(fp, "full_name=%s\n", acct->full_name);
- fprintf(fp, "email_address=%s\n", acct->address);
- fprintf(fp, "username=%s\n", acct->username);
- fprintf(fp, "password=%s\n", acct->password);
- fprintf(fp, "smtp_server=%s\n", acct->server);
- fprintf(fp, "path=%s\n", acct->path);
+ if (acct->full_name && *acct->full_name)
+ fprintf(fp, "full_name=%s\n", acct->full_name);
- return NULL;
+ if (acct->address && *acct->address)
+ fprintf(fp, "email_address=%s\n", acct->address);
+
+ if (acct->username && *acct->username)
+ fprintf(fp, "username=%s\n", acct->username);
+
+ if (acct->username && *acct->username)
+ fprintf(fp, "password=%s\n", acct->password);
+
+ if (acct->server && *acct->server)
+ fprintf(fp, "smtp_server=%s\n", acct->server);
+
+ if (acct->path && *acct->path)
+ fprintf(fp, "path=%s\n", acct->path);
+
+ return TRUE;
}
Account *get_next_folder()
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- account.h 2000/11/21 05:10:40 1.6
+++ account.h 2000/11/21 17:59:01 1.7
@@ -55,7 +55,7 @@
/* Read in the settings found in the file path, return an account structure */
Account *account_read(gchar * path);
-Account *account_write(Account * acct);
+int account_write(Account * acct);
/* Move through the various folders returning them one at a time */
Account *get_next_folder(void);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- callbacks.c 2000/11/21 05:10:40 1.18
+++ callbacks.c 2000/11/21 17:59:01 1.19
@@ -5,10 +5,11 @@
#include "panes.h"
extern Account *current_mbox;
-extern Account *mail_ctree;
-extern ConfigData config;
+extern GtkWidget *mail_ctree;
extern GtkWidget *main_win;
+extern ConfigData config;
extern gchar *title;
+
GtkWidget *clist;
GtkWidget *folder_name, *full_name, *email_address, *type, *username,
*password, *server, *path;
@@ -20,11 +21,10 @@
{
GtkWidget *accounts_win;
GtkWidget *main_vbox, *hbox;
- GtkWidget *hbutton_box;
+ GtkWidget *hbutton_box;
GtkWidget *button_new, *button_edit, *button_remove, *button_close;
gchar *titles[] = { "Folder Name", "Full Name", "E-mail Address",
- "Mailbox Path"
- };
+ "Mailbox Path" };
/* Window title */
title = g_strdup_printf("Accounts");
@@ -49,8 +49,7 @@
/* The buttons at the bottom of the window */
hbutton_box = gtk_hbutton_box_new();
- gtk_box_pack_start(GTK_BOX(hbox), hbutton_box, FALSE, FALSE,
- 0);
+ gtk_box_pack_start(GTK_BOX(hbox), hbutton_box, FALSE, FALSE, 0);
/* New account button */
button_new = gtk_button_new_with_label("New");
@@ -58,7 +57,7 @@
gtk_signal_connect_object(GTK_OBJECT(button_new), "clicked",
GTK_SIGNAL_FUNC
(create_accounts_win_new_edit),
- GINT_TO_POINTER(0));
+ NULL);
gtk_container_add(GTK_CONTAINER(hbutton_box), button_new);
/* Edit account button */
@@ -67,7 +66,7 @@
gtk_signal_connect_object(GTK_OBJECT(button_edit), "clicked",
GTK_SIGNAL_FUNC
(create_accounts_win_new_edit),
- GINT_TO_POINTER(1));
+ NULL);
gtk_container_add(GTK_CONTAINER(hbutton_box), button_edit);
/* Remove account button */
@@ -87,9 +86,9 @@
}
/* The new/edit account window */
-void create_accounts_win_new_edit(gint type) /* type 0 for new account and
- type 1 for edit a account */
+void create_accounts_win_new_edit()
{
+
GtkWidget *main_vbox;
GtkWidget *table;
GtkWidget *label;
@@ -97,11 +96,10 @@
GtkWidget *hbutton_box;
GtkWidget *button_save, *button_cancel;
- /* Set the right title for the window */
- if (type == 0)
- title = g_strdup_printf("New Account");
- if (type == 1)
- title = g_strdup_printf("Edit Account");
+ /* Set the right title for the window */
+ /* This still needs to be done. It can be figured out by looking for a
+ * selected row in the account clist. */
+ title = g_strdup("New");
/* Create the new/edit account window */
accounts_win_new = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -123,7 +121,8 @@
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
/* Folder name entry */
- folder_name = gtk_entry_new();
+ folder_name = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(folder_name), "");
gtk_widget_set_usize(GTK_WIDGET(folder_name), 200, 20);
gtk_table_attach(GTK_TABLE(table), folder_name, 1, 2, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -135,6 +134,7 @@
/* Full name entry */
full_name = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(full_name), "");
gtk_widget_set_usize(GTK_WIDGET(full_name), 200, 20);
gtk_table_attach(GTK_TABLE(table), full_name, 1, 2, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -146,6 +146,7 @@
/* E-mail address entry */
email_address = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(email_address), "");
gtk_widget_set_usize(GTK_WIDGET(email_address), 200, 20);
gtk_table_attach(GTK_TABLE(table), email_address, 1, 2, 2,
3, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -162,6 +163,7 @@
/* Username entry */
username = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(username), "");
gtk_widget_set_usize(GTK_WIDGET(username), 100, 20);
gtk_table_attach(GTK_TABLE(table), username, 1, 2, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -173,6 +175,7 @@
/* Password entry */
password = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(password), "");
gtk_widget_set_usize(GTK_WIDGET(password), 100, 20);
gtk_table_attach(GTK_TABLE(table), password, 3, 4, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -184,6 +187,7 @@
/* Server entry */
server = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(server), "");
gtk_widget_set_usize(GTK_WIDGET(server), 100, 20);
gtk_table_attach(GTK_TABLE(table), server, 1, 2, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -195,6 +199,7 @@
/* Path entry */
path = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(path), "");
gtk_widget_set_usize(GTK_WIDGET(path), 100, 20);
gtk_table_attach(GTK_TABLE(table), path, 3, 4, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -212,8 +217,7 @@
button_save = gtk_button_new_with_label("Save");
gtk_widget_set_usize(GTK_WIDGET(button_save), 55, 22);
gtk_signal_connect(GTK_OBJECT(button_save), "clicked",
- GTK_SIGNAL_FUNC(save_account),
- GINT_TO_POINTER(type));
+ GTK_SIGNAL_FUNC(save_account), NULL);
gtk_container_add(GTK_CONTAINER(hbutton_box), button_save);
/* Cancel button */
@@ -229,20 +233,24 @@
}
-void save_account(gint type)
+void save_account()
{
Account *acct;
acct = new_account();
- acct->name = gtk_entry_get_text(GTK_ENTRY(folder_name));
- acct->full_name = gtk_entry_get_text(GTK_ENTRY(full_name));
- acct->address = gtk_entry_get_text(GTK_ENTRY(email_address));
- /*acct->type = gtk_entry_get_text(GTK_ENTRY(type));*/
- acct->username = gtk_entry_get_text(GTK_ENTRY(username));
- acct->password = gtk_entry_get_text(GTK_ENTRY(password));
- acct->server = gtk_entry_get_text(GTK_ENTRY(server));
- acct->path = gtk_entry_get_text(GTK_ENTRY(path));
+ account_set_name(acct, gtk_entry_get_text(GTK_ENTRY(folder_name)));
+ account_set_fullname(acct,
+ gtk_entry_get_text(GTK_ENTRY(full_name)));
+ account_set_address(acct,
+ gtk_entry_get_text(GTK_ENTRY(email_address)));
+ /*acct->type = gtk_entry_get_text(GTK_ENTRY(type)); */
+ account_set_username(acct,
+ gtk_entry_get_text(GTK_ENTRY(username)));
+ account_set_password(acct,
+ gtk_entry_get_text(GTK_ENTRY(password)));
+ account_set_server(acct, gtk_entry_get_text(GTK_ENTRY(server)));
+ account_set_path(acct, gtk_entry_get_text(GTK_ENTRY(path)));
account_write(acct);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- callbacks.h 2000/11/21 05:10:40 1.6
+++ callbacks.h 2000/11/21 17:59:01 1.7
@@ -60,7 +60,7 @@
void create_account_window();
/* The new/edit account window */
-void create_accounts_win_new_edit(gint type);
+void create_accounts_win_new_edit(void);
/* Save account */
-void save_account(gint type);
+void save_account(void);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-21 23:25:47
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
Makefile.am callbacks.c main.c
Log Message:
Fixed a theme directory issue, and an autoconf/automake issue.
===================================================================
RCS file: /cvsroot/corem/core/src/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 2000/11/21 22:45:01 1.3
+++ Makefile.am 2000/11/21 23:25:47 1.4
@@ -6,7 +6,7 @@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
DEFS = -DCORE_SHARE=\"$(prefix)/share/core\" -DCORE_VERSION=\"@VERSION@\"
-INCLUDES = -I$(top_srcdir) $(GTK_CFLAGS) $(GLIB_CFLAGS)-I ..
+INCLUDES = -I$(top_srcdir) $(GTK_CFLAGS) $(GLIB_CFLAGS) -I..
bin_PROGRAMS = core
core_SOURCES = main.c \
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- callbacks.c 2000/11/21 22:33:40 1.20
+++ callbacks.c 2000/11/21 23:25:47 1.21
@@ -24,7 +24,8 @@
GtkWidget *hbutton_box;
GtkWidget *button_new, *button_edit, *button_remove, *button_close;
gchar *titles[] = { "Folder Name", "Full Name", "E-mail Address",
- "Mailbox Path" };
+ "Mailbox Path"
+ };
/* Window title */
title = g_strdup_printf("Accounts");
@@ -56,8 +57,7 @@
gtk_widget_set_usize(GTK_WIDGET(button_new), 55, 22);
gtk_signal_connect_object(GTK_OBJECT(button_new), "clicked",
GTK_SIGNAL_FUNC
- (create_accounts_win_new_edit),
- NULL);
+ (create_accounts_win_new_edit), NULL);
gtk_container_add(GTK_CONTAINER(hbutton_box), button_new);
/* Edit account button */
@@ -65,8 +65,7 @@
gtk_widget_set_usize(GTK_WIDGET(button_edit), 55, 22);
gtk_signal_connect_object(GTK_OBJECT(button_edit), "clicked",
GTK_SIGNAL_FUNC
- (create_accounts_win_new_edit),
- NULL);
+ (create_accounts_win_new_edit), NULL);
gtk_container_add(GTK_CONTAINER(hbutton_box), button_edit);
/* Remove account button */
@@ -95,10 +94,10 @@
GtkWidget *hbutton_box;
GtkWidget *button_save, *button_cancel;
- /* Set the right title for the window */
- /* This still needs to be done. It can be figured out by looking for a
- * selected row in the account clist. */
- title = g_strdup("New");
+ /* Set the right title for the window */
+ /* This still needs to be done. It can be figured out by looking for a
+ * selected row in the account clist. */
+ title = g_strdup("New");
/* Create the new/edit account window */
accounts_win_new = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -120,8 +119,8 @@
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
/* Folder name entry */
- folder_name = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(folder_name), "");
+ folder_name = gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(folder_name), "");
gtk_widget_set_usize(GTK_WIDGET(folder_name), 200, 20);
gtk_table_attach(GTK_TABLE(table), folder_name, 1, 2, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -133,7 +132,7 @@
/* Full name entry */
full_name = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(full_name), "");
+ gtk_entry_set_text(GTK_ENTRY(full_name), "");
gtk_widget_set_usize(GTK_WIDGET(full_name), 200, 20);
gtk_table_attach(GTK_TABLE(table), full_name, 1, 2, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -145,7 +144,7 @@
/* E-mail address entry */
email_address = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(email_address), "");
+ gtk_entry_set_text(GTK_ENTRY(email_address), "");
gtk_widget_set_usize(GTK_WIDGET(email_address), 200, 20);
gtk_table_attach(GTK_TABLE(table), email_address, 1, 2, 2,
3, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -162,7 +161,7 @@
/* Username entry */
username = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(username), "");
+ gtk_entry_set_text(GTK_ENTRY(username), "");
gtk_widget_set_usize(GTK_WIDGET(username), 100, 20);
gtk_table_attach(GTK_TABLE(table), username, 1, 2, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -174,7 +173,7 @@
/* Password entry */
password = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(password), "");
+ gtk_entry_set_text(GTK_ENTRY(password), "");
gtk_widget_set_usize(GTK_WIDGET(password), 100, 20);
gtk_table_attach(GTK_TABLE(table), password, 3, 4, 0,
1, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -186,7 +185,7 @@
/* Server entry */
server = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(server), "");
+ gtk_entry_set_text(GTK_ENTRY(server), "");
gtk_widget_set_usize(GTK_WIDGET(server), 100, 20);
gtk_table_attach(GTK_TABLE(table), server, 1, 2, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -198,7 +197,7 @@
/* Path entry */
path = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(path), "");
+ gtk_entry_set_text(GTK_ENTRY(path), "");
gtk_widget_set_usize(GTK_WIDGET(path), 100, 20);
gtk_table_attach(GTK_TABLE(table), path, 3, 4, 1,
2, GTK_EXPAND | GTK_FILL, 0, 1, 1);
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- main.c 2000/11/21 22:33:40 1.9
+++ main.c 2000/11/21 23:25:47 1.10
@@ -17,7 +17,7 @@
GtkWidget *reply;
GtkWidget *reply_all;
GtkWidget *forward;
-gchar *theme;
+gchar *theme;
int main(int argc, char **argv)
{
@@ -65,8 +65,7 @@
set_theme_dir();
- title =
- g_strdup_printf("Core %s", CORE_VERSION);
+ title = g_strdup_printf("Core %s", CORE_VERSION);
main_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(GTK_WIDGET(main_win), config.xsize,
config.ysize);
@@ -142,21 +141,28 @@
{
DIR *dir;
gchar *tmp;
- tmp = g_strconcat(getenv("HOME"), "/.core/themes/", config.theme, NULL);
+
+ tmp =
+ g_strconcat(getenv("HOME"), "/.core/themes/", config.theme,
+ NULL);
dir = opendir(tmp);
if (dir != NULL) {
- theme = g_strconcat(getenv("HOME"), "/.core/themes/", config.theme, NULL);
- return 1;
+ theme =
+ g_strconcat(getenv("HOME"), "/.core/themes/",
+ config.theme, "/", NULL);
+ return TRUE;
}
tmp = g_strconcat(CORE_SHARE, "/themes/", config.theme, NULL);
dir = opendir(tmp);
if (dir != NULL) {
- theme = g_strconcat(CORE_SHARE, "/themes/", config.theme, NULL);;
- return 1;
+ theme =
+ g_strconcat(CORE_SHARE, "/themes/", config.theme, "/",
+ NULL);
+ return TRUE;
}
- return 0;
+ return FALSE;
}
GtkWidget *create_main_toolbar()
@@ -177,8 +183,8 @@
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
&bitmap, NULL,
g_strconcat(theme,
- "new.xpm",
- NULL));
+ "new.xpm",
+ NULL));
new = gtk_pixmap_new(pixmap, bitmap);
gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "New",
"Send a new message.",
|
|
From: CORE C. L. <cor...@li...> - 2000-11-21 23:39:59
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c
Log Message:
Now all of the accounts will be displayed, not just the last one found.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- account.c 2000/11/21 17:59:01 1.8
+++ account.c 2000/11/21 23:39:59 1.9
@@ -293,8 +293,11 @@
if (stat(temp, &file_stat) < 0)
break;
- if (S_ISREG(file_stat.st_mode))
+ if (S_ISREG(file_stat.st_mode)) {
mbox = account_read(temp);
+ g_free(temp);
+ break;
+ }
/* g_free(dentry); */
g_free(temp);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-22 23:45:01
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
callbacks.c callbacks.h main.c menus.c menus.h panes.c
Log Message:
A few sanity checks, and some code to test.
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- callbacks.c 2000/11/22 09:02:01 1.22
+++ callbacks.c 2000/11/22 23:45:00 1.23
@@ -26,7 +26,8 @@
GtkWidget *button_new, *button_edit, *button_remove, *button_close;
gchar **text = NULL;
gchar *titles[] = { "Folder Name", "Full Name", "E-mail Address",
- "Mailbox Path", NULL };
+ "Mailbox Path", NULL
+ };
/* Window title */
title = g_strdup_printf("Accounts");
@@ -42,8 +43,8 @@
gtk_container_add(GTK_CONTAINER(accounts_win), main_vbox);
/* The clist for browsing accounts */
- ctree = gtk_ctree_new_with_titles(4, 0, titles);
- gtk_container_add(GTK_CONTAINER(main_vbox), ctree);
+ ctree = gtk_clist_new_with_titles(4, titles);
+ gtk_box_pack_start(GTK_BOX(main_vbox), ctree, TRUE, FALSE, 0);
while ((mbox = get_next_folder())) {
if (text[0])
g_free(text[0]);
@@ -61,9 +62,13 @@
text[3] = g_strdup("Test 3");
item = gtk_ctree_insert_node(GTK_CTREE(ctree),
- NULL, NULL, text, 0, NULL, NULL, NULL, NULL, FALSE, FALSE);
- gtk_ctree_node_set_row_data_full(GTK_CTREE(ctree), item, mbox,
- (GtkDestroyNotify)destroy_account);
+ NULL, NULL, text, 0, NULL,
+ NULL, NULL, NULL, FALSE,
+ FALSE);
+ gtk_ctree_node_set_row_data_full(GTK_CTREE(ctree), item,
+ mbox,
+ (GtkDestroyNotify)
+ destroy_account);
}
hbox = gtk_hbox_new(FALSE, 0);
@@ -277,14 +282,20 @@
return;
}
-void switch_theme(gchar *theme)
+void switch_theme(gchar * theme)
{
- g_free(config.theme);
+ if (!theme)
+ return;
+
+ if (strcmp(theme, config.theme) == 0)
+ return;
+
+ g_free(config.theme);
config.theme = g_strdup(theme);
- set_theme_dir();
- gtk_widget_destroy(toolbar);
- create_main_toolbar();
- return;
+ set_theme_dir();
+ gtk_widget_destroy(toolbar);
+ create_main_toolbar();
+ return;
}
/* This creates the preference window with the correct title About */
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- callbacks.h 2000/11/22 09:02:01 1.9
+++ callbacks.h 2000/11/22 23:45:00 1.10
@@ -66,4 +66,4 @@
void save_account(void);
/* Function for switching the where *theme is the directory name of the theme */
-void switch_theme(gchar *theme);
+void switch_theme(gchar * theme);
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- main.c 2000/11/22 09:02:01 1.12
+++ main.c 2000/11/22 23:45:00 1.13
@@ -139,11 +139,15 @@
{
DIR *dir;
gchar *tmp;
- tmp = g_strconcat(getenv("HOME"), "/.core/themes/", config.theme, "/", NULL);
+ tmp =
+ g_strconcat(getenv("HOME"), "/.core/themes/", config.theme,
+ "/", NULL);
dir = opendir(tmp);
if (dir != NULL) {
- theme = g_strconcat(getenv("HOME"), "/.core/themes/", config.theme, "/", NULL);
+ theme =
+ g_strconcat(getenv("HOME"), "/.core/themes/",
+ config.theme, "/", NULL);
return TRUE;
}
tmp = g_strconcat(CORE_SHARE, "/themes/", config.theme, NULL);
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- menus.c 2000/11/22 09:02:01 1.6
+++ menus.c 2000/11/22 23:45:00 1.7
@@ -38,10 +38,10 @@
{
GtkWidget *menu, *file, *filemenu, *edit, *editmenu, *view,
*viewmenu, *help, *helpmenu;
- GtkWidget *quit, *accounts, *preferences, *themes, *themesmenu, *toolbar, *toolbarmenu,
- *show, *text, *icons, *both, *about, *message_list,
- *message_listmenu, *mpriority, *mread, *mattachment, *mscore,
- *mfrom, *msubject, *mdate, *mserver;
+ GtkWidget *quit, *accounts, *preferences, *themes, *themesmenu,
+ *toolbar, *toolbarmenu, *show, *text, *icons, *both, *about,
+ *message_list, *message_listmenu, *mpriority, *mread,
+ *mattachment, *mscore, *mfrom, *msubject, *mdate, *mserver;
GSList *radio_buttons = NULL;
menu = gtk_menu_bar_new();
/********************************
@@ -245,13 +245,15 @@
return (menu);
}
-void create_themes_menu(GtkWidget *menu)
+void create_themes_menu(GtkWidget * menu)
{
gint i;
- gchar *dirs[] = {g_strconcat(getenv("HOME"), "/.core/themes", NULL),
- g_strconcat(CORE_SHARE, "/themes", NULL)};
+ gchar *dirs[] =
+ { g_strconcat(getenv("HOME"), "/.core/themes", NULL),
+ g_strconcat(CORE_SHARE, "/themes", NULL)
+ };
- for (i = 0 ; i < 2 ; i++) {
+ for (i = 0; i < 2; i++) {
gchar *dirname = dirs[i];
DIR *dir;
struct dirent *dent;
@@ -266,7 +268,9 @@
GdkPixmap *pixmap;
GtkWidget *icon;
while ((dent = readdir(dir))) {
- gchar *temp = g_strconcat(dirname, "/", dent->d_name, NULL);
+ gchar *temp =
+ g_strconcat(dirname, "/", dent->d_name,
+ NULL);
stat(temp, &stats);
if (!S_ISDIR(stats.st_mode)) {
g_free(temp);
@@ -280,24 +284,34 @@
g_free(temp);
continue;
}
- menu_item = gtk_menu_item_new();
- label = gtk_label_new(dent->d_name);
- colormap = gtk_widget_get_colormap(menu_item);
- pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
- &bitmap, NULL,
- g_strconcat(dirname, "/",
- dent->d_name, "/new.xpm", NULL));
- icon = gtk_pixmap_new(pixmap, bitmap);
-
- hbox = gtk_hbox_new(0,8);
- gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(menu_item), hbox);
- gtk_signal_connect(GTK_OBJECT(menu_item), "activate", GTK_SIGNAL_FUNC(switch_theme), g_strdup(dent->d_name));
- gtk_menu_append(GTK_MENU(menu), menu_item);
- g_free(temp);
- }
+ menu_item = gtk_menu_item_new();
+ label = gtk_label_new(dent->d_name);
+ colormap =
+ gtk_widget_get_colormap(menu_item);
+ pixmap =
+ gdk_pixmap_colormap_create_from_xpm
+ (NULL, colormap, &bitmap, NULL,
+ g_strconcat(dirname, "/",
+ dent->d_name, "/new.xpm",
+ NULL));
+ icon = gtk_pixmap_new(pixmap, bitmap);
+
+ hbox = gtk_hbox_new(0, 8);
+ gtk_box_pack_start(GTK_BOX(hbox), icon,
+ FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), label,
+ FALSE, FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(menu_item),
+ hbox);
+ gtk_signal_connect_object(GTK_OBJECT(menu_item),
+ "activate",
+ GTK_SIGNAL_FUNC
+ (switch_theme),
+ g_strdup(dent->d_name));
+ gtk_menu_append(GTK_MENU(menu), menu_item);
+ g_free(temp);
}
+ }
}
return;
}
===================================================================
RCS file: /cvsroot/corem/core/src/menus.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- menus.h 2000/11/22 19:12:09 1.1
+++ menus.h 2000/11/22 23:45:00 1.2
@@ -1,2 +1,2 @@
GtkWidget *create_main_menu();
-void create_themes_menu(GtkWidget *menu);
+void create_themes_menu(GtkWidget * menu);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- panes.c 2000/11/22 09:02:01 1.8
+++ panes.c 2000/11/22 23:45:00 1.9
@@ -110,7 +110,7 @@
GdkBitmap *bitmap;
GtkStyle *style;
GdkFont *font;
-
+
gint col = 0;
gchar *field_titles[8] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
@@ -171,12 +171,12 @@
gtk_signal_connect(GTK_OBJECT(mail_ctree), "tree_select_row",
GTK_SIGNAL_FUNC(mail_selected), NULL);
- font = gdk_font_load(config.default_font);
- style = gtk_style_copy(gtk_widget_get_style(hpane));
- gdk_font_unref(style->font);
- style->font = font;
- gdk_font_ref(style->font);
- gtk_widget_set_style(mail_ctree, style);
+ font = gdk_font_load(config.default_font);
+ style = gtk_style_copy(gtk_widget_get_style(hpane));
+ gdk_font_unref(style->font);
+ style->font = font;
+ gdk_font_ref(style->font);
+ gtk_widget_set_style(mail_ctree, style);
if (config.ml_from == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), ifrom,
@@ -187,7 +187,7 @@
if (config.ml_subject == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), isubject,
- 175);
+ 175);
}
if (config.ml_date == 1) {
|
|
From: CORE C. L. <cor...@li...> - 2000-11-23 02:23:04
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c account.h callbacks.c callbacks.h main.c menus.c
message.h panes.c panes.h
Log Message:
Added a check for message status in the message list, reorganized a bit. Also added a couple fields to the account struct to track the number of new and total messages. Hopefully, I'll get the account pane to show the number of new and total messages tonight.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- account.c 2000/11/21 23:39:59 1.9
+++ account.c 2000/11/23 02:23:03 1.10
@@ -22,7 +22,9 @@
ret->address = NULL;
ret->server = NULL;
ret->path = NULL;
- ret->fp = NULL;
+ ret->fp = NULL;
+ ret->messages = 0;
+ ret->new_messages = 0;
return ret;
}
@@ -88,6 +90,42 @@
return TRUE;
}
+int account_get_num_messages(Account * ac)
+{
+ if (!ac)
+ return 0;
+
+ return ac->messages;
+}
+
+int account_set_num_messages(Account * ac, int num)
+{
+ if (!ac)
+ return FALSE;
+
+ ac->messages = num;
+
+ return TRUE;
+}
+
+int account_get_num_new_messages(Account * ac)
+{
+ if (!ac)
+ return 0;
+
+ return ac->new_messages;
+}
+
+int account_set_num_new_messages(Account * ac, int num)
+{
+ if (!ac)
+ return FALSE;
+
+ ac->new_messages = num;
+
+ return TRUE;
+}
+
char *account_get_name(Account * ac)
{
if (!ac)
@@ -259,7 +297,7 @@
return TRUE;
}
-Account *get_next_folder()
+Account *get_next_account()
{
struct stat file_stat;
struct dirent *dentry = NULL;
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- account.h 2000/11/21 17:59:01 1.7
+++ account.h 2000/11/23 02:23:03 1.8
@@ -10,8 +10,10 @@
/* Folder specific info */
char *name; /* Name of the mailbox. */
AccountType type; /* Mailbox type. */
- char *path; /* Path to the local mailbox. */
- FILE *fp; /* Pointer to the local mbox file */
+ char *path; /* Path to the local mailbox. */
+ int messages; /* Number of messages in mailbox */
+ int new_messages; /* Number of new messages in mailbox */
+ FILE *fp; /* Pointer to the local mailbox file */
/* User specific info */
char *full_name; /* The full name of the user. */
@@ -53,11 +55,21 @@
/* Return a malloc()'d copy of the full name in account ac. */
char *account_get_full_name(Account * ac);
+/* Return the number of messages in the account */
+int account_get_num_messages(Account * ac);
+/* Set the number of messages to num */
+int account_set_num_messages(Account * ac, int num);
+
+/* Return the number of new messages in the account */
+int account_get_num_new_messages(Account * ac);
+/* Set the number of new messages to num */
+int account_set_num_new_messages(Account * ac, int num);
+
/* Read in the settings found in the file path, return an account structure */
Account *account_read(gchar * path);
int account_write(Account * acct);
/* Move through the various folders returning them one at a time */
-Account *get_next_folder(void);
+Account *get_next_account(void);
/* Reset the file pointer for the local mailbox */
int account_reset(Account * ac);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- callbacks.c 2000/11/22 23:45:00 1.23
+++ callbacks.c 2000/11/23 02:23:03 1.24
@@ -15,101 +15,6 @@
GtkWidget *accounts_win_new;
extern GtkWidget *toolbar;
-/* The main account window */
-void create_account_window()
-{
- Account *mbox;
- GtkWidget *accounts_win;
- GtkWidget *main_vbox, *hbox;
- GtkCTreeNode *item;
- GtkWidget *hbutton_box;
- GtkWidget *button_new, *button_edit, *button_remove, *button_close;
- gchar **text = NULL;
- gchar *titles[] = { "Folder Name", "Full Name", "E-mail Address",
- "Mailbox Path", NULL
- };
-
- /* Window title */
- title = g_strdup_printf("Accounts");
-
- /* Create the account window */
- accounts_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- /* Set title for the account window */
- gtk_window_set_title(GTK_WINDOW(accounts_win), title);
-
- /* Account window main vbox */
- main_vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 0);
- gtk_container_add(GTK_CONTAINER(accounts_win), main_vbox);
-
- /* The clist for browsing accounts */
- ctree = gtk_clist_new_with_titles(4, titles);
- gtk_box_pack_start(GTK_BOX(main_vbox), ctree, TRUE, FALSE, 0);
- while ((mbox = get_next_folder())) {
- if (text[0])
- g_free(text[0]);
- if (text[1])
- g_free(text[1]);
- if (text[2])
- g_free(text[2]);
- if (text[3])
- g_free(text[3]);
-
- text = (char **) g_malloc(4 * sizeof(char *));
- text[0] = account_get_name(mbox);
- text[1] = g_strdup("Test 1");
- text[2] = g_strdup("Test 2");
- text[3] = g_strdup("Test 3");
-
- item = gtk_ctree_insert_node(GTK_CTREE(ctree),
- NULL, NULL, text, 0, NULL,
- NULL, NULL, NULL, FALSE,
- FALSE);
- gtk_ctree_node_set_row_data_full(GTK_CTREE(ctree), item,
- mbox,
- (GtkDestroyNotify)
- destroy_account);
- }
-
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
-
- /* The buttons at the bottom of the window */
- hbutton_box = gtk_hbutton_box_new();
- gtk_box_pack_start(GTK_BOX(hbox), hbutton_box, FALSE, FALSE, 0);
-
- /* New account button */
- button_new = gtk_button_new_with_label("New");
- gtk_widget_set_usize(GTK_WIDGET(button_new), 55, 22);
- gtk_signal_connect_object(GTK_OBJECT(button_new), "clicked",
- GTK_SIGNAL_FUNC
- (create_accounts_win_new_edit), NULL);
- gtk_container_add(GTK_CONTAINER(hbutton_box), button_new);
-
- /* Edit account button */
- button_edit = gtk_button_new_with_label("Edit");
- gtk_widget_set_usize(GTK_WIDGET(button_edit), 55, 22);
- gtk_signal_connect_object(GTK_OBJECT(button_edit), "clicked",
- GTK_SIGNAL_FUNC
- (create_accounts_win_new_edit), NULL);
- gtk_container_add(GTK_CONTAINER(hbutton_box), button_edit);
-
- /* Remove account button */
- button_remove = gtk_button_new_with_label("Remove");
- gtk_widget_set_usize(GTK_WIDGET(button_remove), 55, 22);
- gtk_container_add(GTK_CONTAINER(hbutton_box), button_remove);
-
- /* Close button */
- button_close = gtk_button_new_with_label("Close");
- gtk_signal_connect_object(GTK_OBJECT(button_close), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT(accounts_win));
- gtk_container_add(GTK_CONTAINER(hbutton_box), button_close);
-
- /* Show all widgets in the accounts window */
- gtk_widget_show_all(accounts_win);
-}
-
/* The new/edit account window */
void create_accounts_win_new_edit()
{
@@ -511,7 +416,24 @@
}
if (config.ml_read == 1) {
- text[col] = g_strdup("");
+ found = find_header(head, "Status:");
+ if (found) {
+ text[col] = header_get_value(found);
+ if (strchr(text[col], 'R')) {
+ free(text[col]);
+ text[col] = g_strdup("Read");
+ }
+ else if (strchr(text[col], 'O')) {
+ free(text[col]);
+ text[col] = g_strdup("Unread");
+ }
+ else {
+ free(text[col]);
+ text[col] = g_strdup("New");
+ }
+ }
+ else
+ text[col] = g_strdup("New");
col++;
}
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- callbacks.h 2000/11/22 23:45:00 1.10
+++ callbacks.h 2000/11/23 02:23:03 1.11
@@ -56,9 +56,6 @@
/* Quit core funcion */
void core_main_quit(void);
-/* The main account window */
-void create_account_window();
-
/* The new/edit account window */
void create_accounts_win_new_edit(void);
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- main.c 2000/11/23 01:08:37 1.14
+++ main.c 2000/11/23 02:23:03 1.15
@@ -95,15 +95,15 @@
- hpane = gtk_hpaned_new();
+ hpane = gtk_hpaned_new();
- {
- pane = core_create_folder_pane();
- gtk_paned_pack1(GTK_PANED(hpane), pane, TRUE, TRUE);
+ {
+ pane = core_create_folder_pane();
+ gtk_paned_pack1(GTK_PANED(hpane), pane, TRUE, TRUE);
- pane = core_create_mlist_pane();
- gtk_paned_pack2(GTK_PANED(hpane), pane, TRUE, TRUE);
- }
+ pane = core_create_mlist_pane();
+ gtk_paned_pack2(GTK_PANED(hpane), pane, TRUE, TRUE);
+ }
main_menu = create_main_menu();
gtk_container_set_border_width(GTK_CONTAINER(main_menu), 0);
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- menus.c 2000/11/23 01:08:37 1.8
+++ menus.c 2000/11/23 02:23:03 1.9
@@ -41,11 +41,12 @@
*viewmenu, *help, *helpmenu;
GtkWidget *quit, *accounts, *preferences, *themes, *themesmenu,
*toolbar, *toolbarmenu, *show, *text, *icons, *both, *about,
- *message_list, *message_listmenu, *mline_style, *mline_stylemenu,
- *mline_none, *mline_solid, *mline_dotted, *mline_tabbed, *folder_list,
- *folder_listmenu, *fline_style, *fline_stylemenu, *fline_none,
- *fline_solid, *fline_dotted, *fline_tabbed, *mpriority,
- *mread, *mattachment, *mscore, *mfrom, *msubject, *mdate, *mserver;
+ *message_list, *message_listmenu, *mline_style,
+ *mline_stylemenu, *mline_none, *mline_solid, *mline_dotted,
+ *mline_tabbed, *folder_list, *folder_listmenu, *fline_style,
+ *fline_stylemenu, *fline_none, *fline_solid, *fline_dotted,
+ *fline_tabbed, *mpriority, *mread, *mattachment, *mscore,
+ *mfrom, *msubject, *mdate, *mserver;
GSList *radio_buttons = NULL;
GSList *mline_radio = NULL;
GSList *fline_radio = NULL;
@@ -176,47 +177,64 @@
gtk_menu_append(GTK_MENU(message_listmenu), mline_style);
mline_stylemenu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(mline_style), mline_stylemenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mline_style),
+ mline_stylemenu);
- mline_none = gtk_radio_menu_item_new_with_label(mline_radio, "None");
- mline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_none));
+ mline_none =
+ gtk_radio_menu_item_new_with_label(mline_radio, "None");
+ mline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_none));
gtk_signal_connect_object(GTK_OBJECT(mline_none), "toggled",
- GTK_SIGNAL_FUNC(mail_ctree_change_line_style),
- GINT_TO_POINTER(0));
+ GTK_SIGNAL_FUNC
+ (mail_ctree_change_line_style),
+ GINT_TO_POINTER(0));
gtk_menu_append(GTK_MENU(mline_stylemenu), mline_none);
+
+ mline_solid =
+ gtk_radio_menu_item_new_with_label(mline_radio, "Solid");
+ mline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_solid));
+ gtk_signal_connect_object(GTK_OBJECT(mline_solid), "toggled",
+ GTK_SIGNAL_FUNC
+ (mail_ctree_change_line_style),
+ GINT_TO_POINTER(1));
+ gtk_menu_append(GTK_MENU(mline_stylemenu), mline_solid);
+
+ mline_dotted =
+ gtk_radio_menu_item_new_with_label(mline_radio, "Dotted");
+ mline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_dotted));
+ gtk_signal_connect_object(GTK_OBJECT(mline_none), "toggled",
+ GTK_SIGNAL_FUNC
+ (mail_ctree_change_line_style),
+ GINT_TO_POINTER(2));
+ gtk_menu_append(GTK_MENU(mline_stylemenu), mline_dotted);
- mline_solid = gtk_radio_menu_item_new_with_label(mline_radio, "Solid");
- mline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_solid));
- gtk_signal_connect_object(GTK_OBJECT(mline_solid), "toggled",
- GTK_SIGNAL_FUNC(mail_ctree_change_line_style),
- GINT_TO_POINTER(1));
- gtk_menu_append(GTK_MENU(mline_stylemenu), mline_solid);
-
- mline_dotted = gtk_radio_menu_item_new_with_label(mline_radio, "Dotted");
- mline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_dotted));
- gtk_signal_connect_object(GTK_OBJECT(mline_none), "toggled",
- GTK_SIGNAL_FUNC(mail_ctree_change_line_style),
- GINT_TO_POINTER(2));
- gtk_menu_append(GTK_MENU(mline_stylemenu), mline_dotted);
-
- mline_tabbed = gtk_radio_menu_item_new_with_label(mline_radio, "Tabbed");
- mline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_tabbed));
- gtk_signal_connect_object(GTK_OBJECT(mline_tabbed), "toggled",
- GTK_SIGNAL_FUNC(mail_ctree_change_line_style),
- GINT_TO_POINTER(3));
- gtk_menu_append(GTK_MENU(mline_stylemenu), mline_tabbed);
+ mline_tabbed =
+ gtk_radio_menu_item_new_with_label(mline_radio, "Tabbed");
+ mline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(mline_tabbed));
+ gtk_signal_connect_object(GTK_OBJECT(mline_tabbed), "toggled",
+ GTK_SIGNAL_FUNC
+ (mail_ctree_change_line_style),
+ GINT_TO_POINTER(3));
+ gtk_menu_append(GTK_MENU(mline_stylemenu), mline_tabbed);
if (config.ml_linestyle == 0)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mline_none), TRUE);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (mline_none), TRUE);
- if (config.ml_linestyle == 1)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mline_solid), TRUE);
+ if (config.ml_linestyle == 1)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (mline_solid), TRUE);
- if (config.ml_linestyle == 2)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mline_dotted), TRUE);
+ if (config.ml_linestyle == 2)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (mline_dotted), TRUE);
- if (config.ml_linestyle == 3)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mline_tabbed), TRUE);
+ if (config.ml_linestyle == 3)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (mline_tabbed), TRUE);
mpriority = gtk_check_menu_item_new_with_label("Show Priority");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mpriority),
@@ -279,58 +297,75 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mserver), TRUE);
- folder_list = gtk_menu_item_new_with_label("Folder List");
- gtk_menu_append(GTK_MENU(viewmenu), folder_list);
+ folder_list = gtk_menu_item_new_with_label("Folder List");
+ gtk_menu_append(GTK_MENU(viewmenu), folder_list);
- folder_listmenu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(folder_list),
- folder_listmenu);
-
- fline_style = gtk_menu_item_new_with_label("Line Style");
- gtk_menu_append(GTK_MENU(folder_listmenu), fline_style);
-
- fline_stylemenu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(fline_style), fline_stylemenu);
-
- fline_none = gtk_radio_menu_item_new_with_label(fline_radio, "None");
- fline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_none));
- gtk_signal_connect_object(GTK_OBJECT(fline_none), "toggled",
- GTK_SIGNAL_FUNC(folder_ctree_change_line_style),
- GINT_TO_POINTER(0));
- gtk_menu_append(GTK_MENU(fline_stylemenu), fline_none);
-
- fline_solid = gtk_radio_menu_item_new_with_label(fline_radio, "Solid");
- fline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_solid));
- gtk_signal_connect_object(GTK_OBJECT(fline_solid), "toggled",
- GTK_SIGNAL_FUNC(folder_ctree_change_line_style),
- GINT_TO_POINTER(1));
- gtk_menu_append(GTK_MENU(fline_stylemenu), fline_solid);
-
- fline_dotted = gtk_radio_menu_item_new_with_label(fline_radio, "Dotted");
- fline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_dotted));
- gtk_signal_connect_object(GTK_OBJECT(fline_none), "toggled",
- GTK_SIGNAL_FUNC(folder_ctree_change_line_style),
- GINT_TO_POINTER(2));
- gtk_menu_append(GTK_MENU(fline_stylemenu), fline_dotted);
-
- fline_tabbed = gtk_radio_menu_item_new_with_label(fline_radio, "Tabbed");
- fline_radio = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_tabbed));
- gtk_signal_connect_object(GTK_OBJECT(fline_tabbed), "toggled",
- GTK_SIGNAL_FUNC(folder_ctree_change_line_style),
- GINT_TO_POINTER(3));
- gtk_menu_append(GTK_MENU(fline_stylemenu), fline_tabbed);
-
- if (config.fl_linestyle == 0)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(fline_none), TRUE);
+ folder_listmenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(folder_list),
+ folder_listmenu);
+
+ fline_style = gtk_menu_item_new_with_label("Line Style");
+ gtk_menu_append(GTK_MENU(folder_listmenu), fline_style);
+
+ fline_stylemenu = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(fline_style),
+ fline_stylemenu);
+
+ fline_none =
+ gtk_radio_menu_item_new_with_label(fline_radio, "None");
+ fline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_none));
+ gtk_signal_connect_object(GTK_OBJECT(fline_none), "toggled",
+ GTK_SIGNAL_FUNC
+ (folder_ctree_change_line_style),
+ GINT_TO_POINTER(0));
+ gtk_menu_append(GTK_MENU(fline_stylemenu), fline_none);
- if (config.fl_linestyle == 1)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(fline_solid), TRUE);
+ fline_solid =
+ gtk_radio_menu_item_new_with_label(fline_radio, "Solid");
+ fline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_solid));
+ gtk_signal_connect_object(GTK_OBJECT(fline_solid), "toggled",
+ GTK_SIGNAL_FUNC
+ (folder_ctree_change_line_style),
+ GINT_TO_POINTER(1));
+ gtk_menu_append(GTK_MENU(fline_stylemenu), fline_solid);
+
+ fline_dotted =
+ gtk_radio_menu_item_new_with_label(fline_radio, "Dotted");
+ fline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_dotted));
+ gtk_signal_connect_object(GTK_OBJECT(fline_none), "toggled",
+ GTK_SIGNAL_FUNC
+ (folder_ctree_change_line_style),
+ GINT_TO_POINTER(2));
+ gtk_menu_append(GTK_MENU(fline_stylemenu), fline_dotted);
+
+ fline_tabbed =
+ gtk_radio_menu_item_new_with_label(fline_radio, "Tabbed");
+ fline_radio =
+ gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(fline_tabbed));
+ gtk_signal_connect_object(GTK_OBJECT(fline_tabbed), "toggled",
+ GTK_SIGNAL_FUNC
+ (folder_ctree_change_line_style),
+ GINT_TO_POINTER(3));
+ gtk_menu_append(GTK_MENU(fline_stylemenu), fline_tabbed);
+
+ if (config.fl_linestyle == 0)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (fline_none), TRUE);
- if (config.fl_linestyle == 2)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(fline_dotted), TRUE);
+ if (config.fl_linestyle == 1)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (fline_solid), TRUE);
- if (config.fl_linestyle == 3)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(fline_tabbed), TRUE);
+ if (config.fl_linestyle == 2)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (fline_dotted), TRUE);
+
+ if (config.fl_linestyle == 3)
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
+ (fline_tabbed), TRUE);
/********************************
* Help menu *
@@ -408,11 +443,14 @@
FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(menu_item),
hbox);
- gtk_signal_connect_object(GTK_OBJECT(menu_item),
- "activate",
- GTK_SIGNAL_FUNC
- (switch_theme),
- g_strdup(dent->d_name));
+ gtk_signal_connect_object(GTK_OBJECT
+ (menu_item),
+ "activate",
+ GTK_SIGNAL_FUNC
+ (switch_theme),
+ (gpointer)
+ g_strdup(dent->
+ d_name));
gtk_menu_append(GTK_MENU(menu), menu_item);
g_free(temp);
}
===================================================================
RCS file: /cvsroot/corem/core/src/message.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- message.h 2000/11/14 19:23:24 1.1.1.1
+++ message.h 2000/11/23 02:23:03 1.2
@@ -17,6 +17,7 @@
} MessageFlags;
#define SHOW_ALL (SHOW_ACCOUNT | SHOW_FROM | SHOW_TO | SHOW_CC | SHOW_BCC | SHOW_SUBJECT)
+#define is_new(m) (strchr(find_header(message_get_headers(m), "Status:", 'N')))
Message *new_message();
int destroy_message(Message * message);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- panes.c 2000/11/23 01:08:37 1.10
+++ panes.c 2000/11/23 02:23:03 1.11
@@ -9,7 +9,9 @@
GtkWidget *folder_ctree;
extern GtkWidget *main_win;
extern GtkWidget *hpane;
+extern GtkWidget *ctree;
extern gchar *theme;
+extern gchar *title;
GtkWidget *core_create_folder_pane()
{
@@ -71,7 +73,7 @@
text, 0, cpixmap, cbitmap, opixmap,
obitmap, FALSE, TRUE);
- while ((mbox = get_next_folder())) {
+ while ((mbox = get_next_account())) {
if (text[0])
g_free(text[0]);
@@ -98,14 +100,18 @@
gtk_widget_set_usize(scroll, 12, 50);
gtk_widget_show_all(folder_ctree);
- if (config.ml_linestyle == 0)
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_NONE);
- if (config.ml_linestyle == 1)
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_SOLID);
- if (config.ml_linestyle == 2)
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_DOTTED);
- if (config.ml_linestyle == 3)
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_TABBED);
+ if (config.ml_linestyle == 0)
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_NONE);
+ if (config.ml_linestyle == 1)
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_SOLID);
+ if (config.ml_linestyle == 2)
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_DOTTED);
+ if (config.ml_linestyle == 3)
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_TABBED);
return (scroll);
}
@@ -202,7 +208,7 @@
if (config.ml_date == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate,
- 150);
+ 120);
}
if (config.ml_server == 1) {
@@ -227,7 +233,7 @@
gtk_clist_set_column_widget(GTK_CLIST(mail_ctree), iread,
read);
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iread,
- 8);
+ 38);
gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
iread, FALSE);
gdk_bitmap_unref(bitmap);
@@ -280,17 +286,117 @@
gtk_container_add(GTK_CONTAINER(scroll), mail_ctree);
gtk_widget_show_all(mail_ctree);
if (config.ml_linestyle == 0)
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_NONE);
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_NONE);
if (config.ml_linestyle == 1)
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_SOLID);
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_SOLID);
if (config.ml_linestyle == 2)
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_DOTTED);
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_DOTTED);
if (config.ml_linestyle == 3)
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_TABBED);
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_TABBED);
return (scroll);
}
+/* The main account window */
+void create_account_window()
+{
+ Account *mbox;
+ GtkWidget *accounts_win;
+ GtkWidget *main_vbox, *hbox;
+ GtkCTreeNode *item;
+ GtkWidget *hbutton_box;
+ GtkWidget *button_new, *button_edit, *button_remove, *button_close;
+ gchar **text = NULL;
+ gchar *titles[] = { "Folder Name", "Full Name", "E-mail Address",
+ "Mailbox Path", NULL
+ };
+
+ /* Window title */
+ title = g_strdup_printf("Accounts");
+
+ /* Create the account window */
+ accounts_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ /* Set title for the account window */
+ gtk_window_set_title(GTK_WINDOW(accounts_win), title);
+
+ /* Account window main vbox */
+ main_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 0);
+ gtk_container_add(GTK_CONTAINER(accounts_win), main_vbox);
+
+ /* The clist for browsing accounts */
+ ctree = gtk_clist_new_with_titles(4, titles);
+ gtk_box_pack_start(GTK_BOX(main_vbox), ctree, TRUE, FALSE, 0);
+ while ((mbox = get_next_account())) {
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+
+ text = (char **) g_malloc(4 * sizeof(char *));
+ text[0] = account_get_name(mbox);
+ text[1] = g_strdup("Test 1");
+ text[2] = g_strdup("Test 2");
+ text[3] = g_strdup("Test 3");
+
+ item = gtk_ctree_insert_node(GTK_CTREE(ctree),
+ NULL, NULL, text, 0, NULL,
+ NULL, NULL, NULL, FALSE,
+ FALSE);
+ gtk_ctree_node_set_row_data_full(GTK_CTREE(ctree), item,
+ mbox,
+ (GtkDestroyNotify)
+ destroy_account);
+ }
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
+
+ /* The buttons at the bottom of the window */
+ hbutton_box = gtk_hbutton_box_new();
+ gtk_box_pack_start(GTK_BOX(hbox), hbutton_box, FALSE, FALSE, 0);
+
+ /* New account button */
+ button_new = gtk_button_new_with_label("New");
+ gtk_widget_set_usize(GTK_WIDGET(button_new), 55, 22);
+ gtk_signal_connect_object(GTK_OBJECT(button_new), "clicked",
+ GTK_SIGNAL_FUNC
+ (create_accounts_win_new_edit), NULL);
+ gtk_container_add(GTK_CONTAINER(hbutton_box), button_new);
+
+ /* Edit account button */
+ button_edit = gtk_button_new_with_label("Edit");
+ gtk_widget_set_usize(GTK_WIDGET(button_edit), 55, 22);
+ gtk_signal_connect_object(GTK_OBJECT(button_edit), "clicked",
+ GTK_SIGNAL_FUNC
+ (create_accounts_win_new_edit), NULL);
+ gtk_container_add(GTK_CONTAINER(hbutton_box), button_edit);
+
+ /* Remove account button */
+ button_remove = gtk_button_new_with_label("Remove");
+ gtk_widget_set_usize(GTK_WIDGET(button_remove), 55, 22);
+ gtk_container_add(GTK_CONTAINER(hbutton_box), button_remove);
+
+ /* Close button */
+ button_close = gtk_button_new_with_label("Close");
+ gtk_signal_connect_object(GTK_OBJECT(button_close), "clicked",
+ GTK_SIGNAL_FUNC(gtk_widget_destroy),
+ GTK_OBJECT(accounts_win));
+ gtk_container_add(GTK_CONTAINER(hbutton_box), button_close);
+
+ /* Show all widgets in the accounts window */
+ gtk_widget_show_all(accounts_win);
+}
+
+
GtkWidget *core_create_message_pane(Message * message, MessageFlags mode)
{
GtkWidget *vbox;
@@ -497,47 +603,55 @@
void folder_ctree_change_line_style(gint type)
{
- if (type == 0) {
- config.fl_linestyle = 0;
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_NONE);
- }
-
- if (type == 1) {
- config.fl_linestyle = 1;
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_SOLID);
- }
-
- if (type == 2) {
- config.fl_linestyle = 2;
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_DOTTED);
- }
-
- if (type == 3) {
- config.fl_linestyle = 3;
- gtk_ctree_set_line_style(GTK_CTREE(folder_ctree), GTK_CTREE_LINES_TABBED);
- }
+ if (type == 0) {
+ config.fl_linestyle = 0;
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_NONE);
+ }
+
+ if (type == 1) {
+ config.fl_linestyle = 1;
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_SOLID);
+ }
+
+ if (type == 2) {
+ config.fl_linestyle = 2;
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_DOTTED);
+ }
+
+ if (type == 3) {
+ config.fl_linestyle = 3;
+ gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
+ GTK_CTREE_LINES_TABBED);
+ }
}
void mail_ctree_change_line_style(gint type)
{
- if (type == 0) {
- config.ml_linestyle = 0;
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_NONE);
- }
-
- if (type == 1) {
- config.ml_linestyle = 1;
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_SOLID);
- }
-
- if (type == 2) {
- config.ml_linestyle = 2;
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_DOTTED);
- }
-
- if (type == 3) {
- config.ml_linestyle = 3;
- gtk_ctree_set_line_style(GTK_CTREE(mail_ctree), GTK_CTREE_LINES_TABBED);
- }
+ if (type == 0) {
+ config.ml_linestyle = 0;
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_NONE);
+ }
+
+ if (type == 1) {
+ config.ml_linestyle = 1;
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_SOLID);
+ }
+
+ if (type == 2) {
+ config.ml_linestyle = 2;
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_DOTTED);
+ }
+
+ if (type == 3) {
+ config.ml_linestyle = 3;
+ gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
+ GTK_CTREE_LINES_TABBED);
+ }
}
===================================================================
RCS file: /cvsroot/corem/core/src/panes.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- panes.h 2000/11/23 01:08:37 1.4
+++ panes.h 2000/11/23 02:23:03 1.5
@@ -4,3 +4,6 @@
GtkWidget *core_create_fonts_page(GtkWidget * window);
void folder_ctree_change_line_style(gint type);
void mail_ctree_change_line_style(gint type);
+
+/* The main account window */
+void create_account_window();
|
|
From: CORE C. L. <cor...@li...> - 2000-11-23 09:32:14
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c account.h callbacks.c callbacks.h menus.c message.c
message.h panes.c util.c
Log Message:
Some basic framework for checking for new messages, and listing the total number of messages and total number of new messages.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- account.c 2000/11/23 02:23:03 1.10
+++ account.c 2000/11/23 09:32:12 1.11
@@ -22,9 +22,10 @@
ret->address = NULL;
ret->server = NULL;
ret->path = NULL;
- ret->fp = NULL;
- ret->messages = 0;
- ret->new_messages = 0;
+ ret->fp = NULL;
+ ret->messages = 0;
+ ret->new_messages = 0;
+ ret->last_access = 0;
return ret;
}
@@ -54,6 +55,24 @@
return TRUE;
}
+int account_set_last_access(Account * ac, time_t time)
+{
+ if (!ac)
+ return FALSE;
+
+ ac->last_access = time;
+
+ return TRUE;
+}
+
+time_t account_get_last_access(Account * ac)
+{
+ if (!ac)
+ return 0;
+
+ return (ac->last_access);
+}
+
int account_set_name(Account * ac, char *name)
{
if (!name || !ac)
@@ -103,9 +122,9 @@
if (!ac)
return FALSE;
- ac->messages = num;
+ ac->messages = num;
- return TRUE;
+ return TRUE;
}
int account_get_num_new_messages(Account * ac)
@@ -121,9 +140,9 @@
if (!ac)
return FALSE;
- ac->new_messages = num;
+ ac->new_messages = num;
- return TRUE;
+ return TRUE;
}
char *account_get_name(Account * ac)
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- account.h 2000/11/23 02:23:03 1.8
+++ account.h 2000/11/23 09:32:12 1.9
@@ -10,9 +10,10 @@
/* Folder specific info */
char *name; /* Name of the mailbox. */
AccountType type; /* Mailbox type. */
- char *path; /* Path to the local mailbox. */
- int messages; /* Number of messages in mailbox */
- int new_messages; /* Number of new messages in mailbox */
+ char *path; /* Path to the local mailbox. */
+ int messages; /* Number of messages in mailbox */
+ int new_messages; /* Number of new messages in mailbox */
+ time_t last_access; /* Time the mailbox was last checked */
FILE *fp; /* Pointer to the local mailbox file */
/* User specific info */
@@ -29,6 +30,11 @@
Account *new_account(void);
/* Free an account created with new_account() */
int destroy_account(Account * ac);
+
+/* Set the time in seconds that the mailbox was last checked for updates */
+int account_set_last_access(Account * ac, time_t time);
+/* Return the last time the mailbox was last checked for updates */
+time_t account_get_last_access(Account * ac);
/* Set the address of account ac to the string address */
int account_set_address(Account * ac, char *address);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- callbacks.c 2000/11/23 03:28:13 1.25
+++ callbacks.c 2000/11/23 09:32:12 1.26
@@ -2,15 +2,18 @@
#include "core.h"
#include "callbacks.h"
#include "panes.h"
+#include <signal.h>
-extern Account *current_mbox;
+#define TIMEOUT 30
+
+Account *current_mbox;
extern GtkWidget *mail_ctree;
extern GtkWidget *main_win;
extern ConfigData config;
extern gchar *title;
extern gchar *theme;
-GtkWidget *ctree;
+extern GtkWidget *folder_ctree;
GtkWidget *folder_name, *full_name, *email_address, *type, *username,
*password, *server, *path;
GtkWidget *accounts_win_new;
@@ -342,6 +345,7 @@
GTK_CTREE_NODE
(node));
+ gtk_clist_freeze(GTK_CLIST(mail_ctree));
while (1) {
GtkCTreeNode *top, *item;
char *temp;
@@ -443,18 +447,25 @@
if (config.ml_read == 1) {
found = find_header(head, "Status:");
- if (found) {
+ if (found)
text[col] = header_get_value(found);
- if (strchr(text[col], 'O')) {
- g_free(text[col]);
- colormap = gtk_widget_get_colormap(mail_ctree);
- pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap, &bitmap, NULL, g_strconcat(theme, "read.xpm", NULL));
- gtk_ctree_node_set_pixmap(GTK_CTREE(mail_ctree), item, col, pixmap, bitmap);
- gdk_bitmap_unref(bitmap);
- gdk_pixmap_unref(pixmap);
- }
+
+ if (!found || strchr(text[col], 'N')) {
+ g_free(text[col]);
+ colormap =
+ gtk_widget_get_colormap(mail_ctree);
+ pixmap =
+ gdk_pixmap_colormap_create_from_xpm
+ (NULL, colormap, &bitmap, NULL,
+ g_strconcat(theme, "read.xpm", NULL));
+ gtk_ctree_node_set_pixmap(GTK_CTREE
+ (mail_ctree),
+ item, col,
+ pixmap, bitmap);
+ gdk_bitmap_unref(bitmap);
+ gdk_pixmap_unref(pixmap);
}
- }
+ }
temp = header_get_value(find_header(head, "Message-Id:"));
if (temp)
@@ -464,7 +475,9 @@
(GtkDestroyNotify)
free);
destroy_message(message);
- }
+ }
+
+ gtk_clist_thaw(GTK_CLIST(mail_ctree));
current_mbox = mbox;
account_reset_file(mbox);
@@ -515,4 +528,38 @@
node = NULL;
col = 0;
data = NULL;
+}
+
+/* Function for checking folders for new mail */
+void check_for_new_mail(int signum)
+{
+ int i;
+ char *temp;
+ Account *mbox;
+ GtkCTreeNode *node;
+
+ for (i = 1, node = gtk_ctree_node_nth(GTK_CTREE(folder_ctree), i); node;
+ i++, node = gtk_ctree_node_nth(GTK_CTREE(folder_ctree), i)) {
+ mbox = gtk_ctree_node_get_row_data(GTK_CTREE(folder_ctree), node);
+ if (account_get_last_access(mbox) <
+ last_modify(account_get_path(mbox))) {
+ account_set_num_messages(mbox, num_messages(mbox));
+ account_set_num_new_messages(mbox,
+ num_new_messages
+ (mbox));
+ }
+ asprintf(&temp, "%d", account_get_num_messages(mbox));
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 1, temp);
+ free(temp);
+
+ asprintf(&temp, "%d", account_get_num_new_messages(mbox));
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 2, temp);
+ free(temp);
+ }
+
+ signal(SIGALRM, check_for_new_mail);
+ alarm(TIMEOUT);
+
+ return;
+ signum = 0;
}
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- callbacks.h 2000/11/23 02:23:03 1.11
+++ callbacks.h 2000/11/23 09:32:12 1.12
@@ -64,3 +64,6 @@
/* Function for switching the where *theme is the directory name of the theme */
void switch_theme(gchar * theme);
+
+/* Function for checking for new messages. */
+void check_for_new_mail(int signum);
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- menus.c 2000/11/23 02:23:03 1.9
+++ menus.c 2000/11/23 09:32:12 1.10
@@ -449,8 +449,8 @@
GTK_SIGNAL_FUNC
(switch_theme),
(gpointer)
- g_strdup(dent->
- d_name));
+ g_strdup
+ (dent->d_name));
gtk_menu_append(GTK_MENU(menu), menu_item);
g_free(temp);
}
===================================================================
RCS file: /cvsroot/corem/core/src/message.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- message.c 2000/11/14 19:23:24 1.1.1.1
+++ message.c 2000/11/23 09:32:12 1.2
@@ -264,4 +264,50 @@
destroy_message(m);
}
+ return NULL;
+}
+
+int num_messages(Account * mbox)
+{
+ int ret = 0;
+ Message *m;
+
+ if (!mbox)
+ return 0;
+
+ if (mbox->fp)
+ rewind(mbox->fp);
+
+ while ((m = message_get_next(mbox)) != NULL) {
+ destroy_message(m);
+ ret++;
+ }
+
+ return ret;
+}
+
+int num_new_messages(Account * mbox)
+{
+ int ret = 0;
+ char *temp;
+ Message *m;
+
+ if (!mbox)
+ return 0;
+
+ if (mbox->fp)
+ rewind(mbox->fp);
+
+ while ((m = message_get_next(mbox)) != NULL) {
+ temp =
+ header_get_value(find_header
+ (message_get_headers(m), "Status:"));
+ if (temp) {
+ free(temp);
+ ret++;
+ }
+ destroy_message(m);
+ }
+
+ return ret;
}
===================================================================
RCS file: /cvsroot/corem/core/src/message.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- message.h 2000/11/23 02:23:03 1.2
+++ message.h 2000/11/23 09:32:12 1.3
@@ -32,3 +32,8 @@
Message *message_get_n(Account * mbox, int num);
Message *message_find_id(Account * mbox, char *id);
+
+/* Return the number of new messages in the mailbox mbox */
+int num_new_messages(Account * mbox);
+/* Return the number of messages in the mailbox mbox */
+int num_messages(Account * mbox);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- panes.c 2000/11/23 02:23:03 1.11
+++ panes.c 2000/11/23 09:32:12 1.12
@@ -4,12 +4,11 @@
#include "callbacks.h"
ConfigData config;
-Account *current_mbox = NULL;
GtkWidget *mail_ctree;
GtkWidget *folder_ctree;
+GtkWidget *ctree;
extern GtkWidget *main_win;
extern GtkWidget *hpane;
-extern GtkWidget *ctree;
extern gchar *theme;
extern gchar *title;
@@ -113,6 +112,7 @@
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
+ check_for_new_mail(0);
return (scroll);
}
@@ -208,7 +208,7 @@
if (config.ml_date == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate,
- 120);
+ 150);
}
if (config.ml_server == 1) {
@@ -233,13 +233,14 @@
gtk_clist_set_column_widget(GTK_CLIST(mail_ctree), iread,
read);
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iread,
- 38);
+ 8);
gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
iread, FALSE);
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
}
+
if (config.ml_attachment == 1) {
colormap = gtk_widget_get_colormap(mail_ctree);
pixmap =
@@ -393,7 +394,7 @@
gtk_container_add(GTK_CONTAINER(hbutton_box), button_close);
/* Show all widgets in the accounts window */
- gtk_widget_show_all(accounts_win);
+ gtk_widget_show_all(accounts_win);
}
===================================================================
RCS file: /cvsroot/corem/core/src/util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- util.c 2000/11/14 22:07:28 1.2
+++ util.c 2000/11/23 09:32:12 1.3
@@ -1,4 +1,8 @@
#include "util.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <time.h>
#define BUFSIZE 400
@@ -115,4 +119,17 @@
line++;
return token;
+}
+
+time_t last_modify(char *path)
+{
+ struct stat dstat;
+
+ if (!path)
+ return 0;
+
+ if (stat(path, &dstat) < 0)
+ return 0;
+
+ return dstat.st_mtime;
}
|
|
From: CORE C. L. <cor...@li...> - 2000-11-23 09:37:09
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
message.c
Log Message:
Had some inverted logic for finding new messages. Fixed.
===================================================================
RCS file: /cvsroot/corem/core/src/message.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- message.c 2000/11/23 09:32:12 1.2
+++ message.c 2000/11/23 09:37:08 1.3
@@ -302,10 +302,14 @@
temp =
header_get_value(find_header
(message_get_headers(m), "Status:"));
- if (temp) {
+ if (!temp) {
free(temp);
ret++;
- }
+ }
+ else if (strchr(temp, 'N')) {
+ free(temp);
+ ret++;
+ }
destroy_message(m);
}
|
|
From: CORE C. L. <cor...@li...> - 2000-11-25 19:11:55
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.h callbacks.c
Log Message:
Fixed some of the issues with folder_selected.
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- account.h 2000/11/23 09:32:12 1.9
+++ account.h 2000/11/25 19:11:52 1.10
@@ -78,4 +78,4 @@
Account *get_next_account(void);
/* Reset the file pointer for the local mailbox */
-int account_reset(Account * ac);
+int account_reset_file(Account * ac);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- callbacks.c 2000/11/24 01:56:10 1.27
+++ callbacks.c 2000/11/25 19:11:52 1.28
@@ -15,7 +15,7 @@
extern GtkWidget *folder_ctree;
GtkWidget *folder_name, *full_name, *email_address, *type, *username,
- *password, *server, *path;
+ *password, *server, *path;
GtkWidget *accounts_win_new;
extern GtkWidget *toolbar;
@@ -345,6 +345,7 @@
GTK_CTREE_NODE
(node));
+ account_reset_file(mbox);
gtk_clist_freeze(GTK_CLIST(mail_ctree));
while (1) {
GtkCTreeNode *top, *item;
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 07:51:21
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c account.h panes.c
Log Message:
The account window now lists the accounts available. Still need to fix the info displayed.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- account.c 2000/11/23 09:32:12 1.11
+++ account.c 2000/11/26 07:51:21 1.12
@@ -371,3 +371,13 @@
rewind(ac->fp);
return TRUE;
}
+
+int account_reset_dir()
+{
+ if (!acct_dir)
+ return FALSE;
+
+ rewinddir(acct_dir);
+
+ return TRUE;
+}
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- account.h 2000/11/25 19:11:52 1.10
+++ account.h 2000/11/26 07:51:21 1.11
@@ -79,3 +79,5 @@
/* Reset the file pointer for the local mailbox */
int account_reset_file(Account * ac);
+/* Reset the directory to read from the beginning */
+int account_reset_dir(void);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- panes.c 2000/11/23 09:32:12 1.12
+++ panes.c 2000/11/26 07:51:21 1.13
@@ -6,7 +6,7 @@
ConfigData config;
GtkWidget *mail_ctree;
GtkWidget *folder_ctree;
-GtkWidget *ctree;
+GtkWidget *clist;
extern GtkWidget *main_win;
extern GtkWidget *hpane;
extern gchar *theme;
@@ -305,10 +305,10 @@
/* The main account window */
void create_account_window()
{
+ int i;
Account *mbox;
GtkWidget *accounts_win;
GtkWidget *main_vbox, *hbox;
- GtkCTreeNode *item;
GtkWidget *hbutton_box;
GtkWidget *button_new, *button_edit, *button_remove, *button_close;
gchar **text = NULL;
@@ -330,33 +330,46 @@
gtk_container_add(GTK_CONTAINER(accounts_win), main_vbox);
/* The clist for browsing accounts */
- ctree = gtk_clist_new_with_titles(4, titles);
- gtk_box_pack_start(GTK_BOX(main_vbox), ctree, TRUE, FALSE, 0);
- while ((mbox = get_next_account())) {
- if (text[0])
- g_free(text[0]);
- if (text[1])
- g_free(text[1]);
- if (text[2])
- g_free(text[2]);
- if (text[3])
- g_free(text[3]);
+ clist = gtk_clist_new_with_titles(4, titles);
+ gtk_box_pack_start(GTK_BOX(main_vbox), clist , TRUE, TRUE, 0);
- text = (char **) g_malloc(4 * sizeof(char *));
+ account_reset_dir();
+ i = 0;
+ while ((mbox = get_next_account())) {
+ if (text) {
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+ }
+ else
+ text = (char **) g_malloc(4 * sizeof(char *));
+
text[0] = account_get_name(mbox);
text[1] = g_strdup("Test 1");
text[2] = g_strdup("Test 2");
text[3] = g_strdup("Test 3");
- item = gtk_ctree_insert_node(GTK_CTREE(ctree),
- NULL, NULL, text, 0, NULL,
- NULL, NULL, NULL, FALSE,
- FALSE);
- gtk_ctree_node_set_row_data_full(GTK_CTREE(ctree), item,
+ gtk_clist_insert(GTK_CLIST(clist), i, text);
+ gtk_clist_set_row_data_full(GTK_CLIST(clist), i,
mbox,
(GtkDestroyNotify)
- destroy_account);
- }
+ destroy_account);
+ i++;
+ }
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+ g_free(text);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 09:29:44
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.h panes.c
Log Message:
Correct items now shown in account window list. Need to get the widths set to a better default, and maybe just have them auto-resize.
===================================================================
RCS file: /cvsroot/corem/core/src/account.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- account.h 2000/11/26 07:51:21 1.11
+++ account.h 2000/11/26 09:29:43 1.12
@@ -59,7 +59,7 @@
/* Set the full name of account ac to the string path */
int account_set_full_name(Account * ac, char *fullname);
/* Return a malloc()'d copy of the full name in account ac. */
-char *account_get_full_name(Account * ac);
+char *account_get_fullname(Account * ac);
/* Return the number of messages in the account */
int account_get_num_messages(Account * ac);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- panes.c 2000/11/26 07:51:21 1.13
+++ panes.c 2000/11/26 09:29:43 1.14
@@ -350,9 +350,9 @@
text = (char **) g_malloc(4 * sizeof(char *));
text[0] = account_get_name(mbox);
- text[1] = g_strdup("Test 1");
- text[2] = g_strdup("Test 2");
- text[3] = g_strdup("Test 3");
+ text[1] = account_get_fullname(mbox);
+ text[2] = account_get_address(mbox);
+ text[3] = account_get_path(mbox);
gtk_clist_insert(GTK_CLIST(clist), i, text);
gtk_clist_set_row_data_full(GTK_CLIST(clist), i,
@@ -370,6 +370,11 @@
if (text[3])
g_free(text[3]);
g_free(text);
+
+ gtk_clist_optimal_column_width(GTK_CLIST(clist), 0);
+ gtk_clist_optimal_column_width(GTK_CLIST(clist), 1);
+ gtk_clist_optimal_column_width(GTK_CLIST(clist), 2);
+ gtk_clist_optimal_column_width(GTK_CLIST(clist), 3);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 17:18:42
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
panes.c
Log Message:
Small fix for getting the accounts windows columns to look pretty. :)
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- panes.c 2000/11/26 11:39:17 1.15
+++ panes.c 2000/11/26 17:18:38 1.16
@@ -374,10 +374,10 @@
g_free(text[3]);
g_free(text);
- gtk_clist_optimal_column_width(GTK_CLIST(clist), 0);
- gtk_clist_optimal_column_width(GTK_CLIST(clist), 1);
- gtk_clist_optimal_column_width(GTK_CLIST(clist), 2);
- gtk_clist_optimal_column_width(GTK_CLIST(clist), 3);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 1, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 2, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 3, TRUE);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 21:28:18
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c callbacks.c message.c panes.c prefs.c
Log Message:
Now the total number of messages and new messages are displayed in the top level folder.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- account.c 2000/11/26 07:51:21 1.12
+++ account.c 2000/11/26 21:28:17 1.13
@@ -374,10 +374,10 @@
int account_reset_dir()
{
- if (!acct_dir)
- return FALSE;
+ if (!acct_dir)
+ return FALSE;
- rewinddir(acct_dir);
+ rewinddir(acct_dir);
- return TRUE;
+ return TRUE;
}
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- callbacks.c 2000/11/26 11:39:17 1.30
+++ callbacks.c 2000/11/26 21:28:17 1.31
@@ -15,7 +15,7 @@
extern GtkWidget *folder_ctree;
GtkWidget *folder_name, *full_name, *email_address, *type, *username,
- *password, *server, *path;
+ *password, *server, *path;
GtkWidget *accounts_win_new;
extern GtkWidget *toolbar;
@@ -168,81 +168,81 @@
void save_account()
{
- Account *acct;
- gchar *tmp_folder_name, *tmp_full_name, *tmp_email_address,
- *tmp_username, *tmp_password, *tmp_server, *tmp_path;
-
-
- tmp_folder_name = gtk_entry_get_text(GTK_ENTRY(folder_name));
- tmp_full_name = gtk_entry_get_text(GTK_ENTRY(full_name));
- tmp_email_address = gtk_entry_get_text(GTK_ENTRY(email_address));
- tmp_username = gtk_entry_get_text(GTK_ENTRY(username));
- tmp_password = gtk_entry_get_text(GTK_ENTRY(password));
- tmp_server = gtk_entry_get_text(GTK_ENTRY(server));
- tmp_path = gtk_entry_get_text(GTK_ENTRY(path));
- create_error_window(g_strdup("ERROR"),
- g_strdup
- ("Make sure you have filled in everything"),
- g_strdup("OK"));
- if (g_strdup(tmp_folder_name) == NULL /* &&
- tmp_full_name == NULL &&
- tmp_email_address == NULL &&
- tmp_username == NULL &&
- tmp_password == NULL &&
- tmp_server == NULL &&
- tmp_path == NULL */ ) {
- create_error_window(g_strdup("ERROR"),
- g_strdup
- ("Make sure you have filled in everything"),
- g_strdup("OK"));
- return;
- }
- acct = new_account();
-
- account_set_name(acct, tmp_folder_name);
- account_set_fullname(acct, tmp_full_name);
- account_set_address(acct, tmp_email_address);
- /*acct->type = gtk_entry_get_text(GTK_ENTRY(type)); */
- account_set_username(acct, tmp_username);
- account_set_password(acct, tmp_password);
- account_set_server(acct, tmp_server);
- account_set_path(acct, tmp_path);
+ Account *acct;
+ gchar *tmp_folder_name, *tmp_full_name, *tmp_email_address,
+ *tmp_username, *tmp_password, *tmp_server, *tmp_path;
+
+
+ tmp_folder_name = gtk_entry_get_text(GTK_ENTRY(folder_name));
+ tmp_full_name = gtk_entry_get_text(GTK_ENTRY(full_name));
+ tmp_email_address = gtk_entry_get_text(GTK_ENTRY(email_address));
+ tmp_username = gtk_entry_get_text(GTK_ENTRY(username));
+ tmp_password = gtk_entry_get_text(GTK_ENTRY(password));
+ tmp_server = gtk_entry_get_text(GTK_ENTRY(server));
+ tmp_path = gtk_entry_get_text(GTK_ENTRY(path));
+ create_error_window(g_strdup("ERROR"),
+ g_strdup
+ ("Make sure you have filled in everything"),
+ g_strdup("OK"));
+ if (g_strdup(tmp_folder_name) == NULL /* &&
+ tmp_full_name == NULL &&
+ tmp_email_address == NULL &&
+ tmp_username == NULL &&
+ tmp_password == NULL &&
+ tmp_server == NULL &&
+ tmp_path == NULL */ ) {
+ create_error_window(g_strdup("ERROR"),
+ g_strdup
+ ("Make sure you have filled in everything"),
+ g_strdup("OK"));
+ return;
+ }
+ acct = new_account();
+
+ account_set_name(acct, tmp_folder_name);
+ account_set_fullname(acct, tmp_full_name);
+ account_set_address(acct, tmp_email_address);
+ /*acct->type = gtk_entry_get_text(GTK_ENTRY(type)); */
+ account_set_username(acct, tmp_username);
+ account_set_password(acct, tmp_password);
+ account_set_server(acct, tmp_server);
+ account_set_path(acct, tmp_path);
- account_write(acct);
+ account_write(acct);
- gtk_widget_destroy(accounts_win_new);
- return;
+ gtk_widget_destroy(accounts_win_new);
+ return;
}
void create_error_window(gchar * title, gchar * text, gchar * button_text)
{
- GtkWidget *window;
- GtkWidget *main_vbox;
- GtkWidget *label;
- GtkWidget *buttonshbox, *button;
-
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_usize(GTK_WIDGET(window), 200, 45);
- gtk_window_set_title(GTK_WINDOW(window), title);
- gtk_signal_connect(GTK_OBJECT(window), "delete_event",
- gtk_widget_destroy, GTK_OBJECT(window));
- gtk_signal_connect(GTK_OBJECT(window), "destroy",
- gtk_widget_destroy, GTK_OBJECT(window));
-
- main_vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), main_vbox);
-
- label = gtk_label_new(text);
- gtk_box_pack_start(GTK_BOX(main_vbox), label, FALSE, FALSE, 0);
-
- buttonshbox = gtk_hbutton_box_new();
- gtk_box_pack_start(GTK_BOX(main_vbox), buttonshbox, FALSE, FALSE,
- 0);
+ GtkWidget *window;
+ GtkWidget *main_vbox;
+ GtkWidget *label;
+ GtkWidget *buttonshbox, *button;
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_widget_set_usize(GTK_WIDGET(window), 200, 45);
+ gtk_window_set_title(GTK_WINDOW(window), title);
+ gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+ gtk_widget_destroy, GTK_OBJECT(window));
+ gtk_signal_connect(GTK_OBJECT(window), "destroy",
+ gtk_widget_destroy, GTK_OBJECT(window));
- button = gtk_button_new_with_label(button_text);
- gtk_container_add(GTK_CONTAINER(buttonshbox), button);
+ main_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(window), main_vbox);
- gtk_widget_show_all(window);
+ label = gtk_label_new(text);
+ gtk_box_pack_start(GTK_BOX(main_vbox), label, FALSE, FALSE, 0);
+
+ buttonshbox = gtk_hbutton_box_new();
+ gtk_box_pack_start(GTK_BOX(main_vbox), buttonshbox, FALSE, FALSE,
+ 0);
+
+ button = gtk_button_new_with_label(button_text);
+ gtk_container_add(GTK_CONTAINER(buttonshbox), button);
+
+ gtk_widget_show_all(window);
}
void switch_theme(gchar * theme)
@@ -388,8 +388,8 @@
int folder_selected(GtkWidget * list, GList * node, gint col,
gpointer data)
{
- GtkStyle *style;
- GdkFont *font;
+ GtkStyle *style;
+ GdkFont *font;
GdkBitmap *bitmap;
GdkColormap *colormap;
GdkPixmap *pixmap;
@@ -401,8 +401,8 @@
GTK_CTREE_NODE
(node));
- account_reset_file(mbox);
- gtk_clist_freeze(GTK_CLIST(mail_ctree));
+ account_reset_file(mbox);
+ gtk_clist_freeze(GTK_CLIST(mail_ctree));
while (1) {
GtkCTreeNode *top, *item;
char *temp;
@@ -522,16 +522,16 @@
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
- font = gdk_font_load(config.new_font);
- style =
- gtk_style_copy(gtk_widget_get_style
- (mail_ctree));
- gdk_font_unref(style->font);
- style->font = font;
- gdk_font_ref(style->font);
- gtk_ctree_node_set_row_style(GTK_CTREE
- (mail_ctree),
- item, style);
+ font = gdk_font_load(config.new_font);
+ style =
+ gtk_style_copy(gtk_widget_get_style
+ (mail_ctree));
+ gdk_font_unref(style->font);
+ style->font = font;
+ gdk_font_ref(style->font);
+ gtk_ctree_node_set_row_style(GTK_CTREE
+ (mail_ctree),
+ item, style);
}
}
@@ -543,9 +543,9 @@
(GtkDestroyNotify)
free);
destroy_message(message);
- }
+ }
- gtk_clist_thaw(GTK_CLIST(mail_ctree));
+ gtk_clist_thaw(GTK_CLIST(mail_ctree));
current_mbox = mbox;
account_reset_file(mbox);
@@ -601,33 +601,63 @@
/* Function for checking folders for new mail */
void check_for_new_mail(int signum)
{
- gint i;
- gchar *temp;
+ gint i;
+ gint val = 0;
+ gint nval = 0;
+ gint total = 0;
+ gint ntotal = 0;
+ gchar *temp;
Account *mbox;
GtkCTreeNode *node;
- for (i = 1, node = gtk_ctree_node_nth(GTK_CTREE(folder_ctree), i); node;
+
+ for (i = 1, node = gtk_ctree_node_nth(GTK_CTREE(folder_ctree), i);
+ node;
i++, node = gtk_ctree_node_nth(GTK_CTREE(folder_ctree), i)) {
- mbox = gtk_ctree_node_get_row_data(GTK_CTREE(folder_ctree), node);
+ mbox =
+ gtk_ctree_node_get_row_data(GTK_CTREE(folder_ctree),
+ node);
+ /* Check if the mailbox has been modified since last read. */
if (account_get_last_access(mbox) <
last_modify(account_get_path(mbox))) {
+
+ /* Update the number of messages displayed */
account_set_num_messages(mbox, num_messages(mbox));
account_set_num_new_messages(mbox,
num_new_messages
(mbox));
- }
- asprintf(&temp, "%d", account_get_num_messages(mbox));
- gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 1, temp);
- g_free(temp);
-
- asprintf(&temp, "%d", account_get_num_new_messages(mbox));
- gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 2, temp);
- g_free(temp);
+ account_set_last_access(mbox,
+ last_modify
+ (account_get_path(mbox)));
+ }
+ val = account_get_num_messages(mbox);
+ asprintf(&temp, "%d", val);
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 1,
+ temp);
+ total += val;
+ g_free(temp);
+
+ nval = account_get_num_new_messages(mbox);
+ asprintf(&temp, "%d", nval);
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 2,
+ temp);
+ ntotal += nval;
+ g_free(temp);
}
+ asprintf(&temp, "%d", total);
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree),
+ gtk_ctree_node_nth(GTK_CTREE(folder_ctree),
+ 0), 1, temp);
+ g_free(temp);
+
+ asprintf(&temp, "%d", ntotal);
+ gtk_ctree_node_set_text(GTK_CTREE(folder_ctree),
+ gtk_ctree_node_nth(GTK_CTREE(folder_ctree),
+ 0), 2, temp);
+ g_free(temp);
signal(SIGALRM, check_for_new_mail);
- alarm(TIMEOUT);
+ alarm(TIMEOUT);
- return;
- signum = 0;
-
+ return;
+ signum = 0;
}
===================================================================
RCS file: /cvsroot/corem/core/src/message.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- message.c 2000/11/23 09:37:08 1.3
+++ message.c 2000/11/26 21:28:17 1.4
@@ -305,11 +305,10 @@
if (!temp) {
free(temp);
ret++;
- }
- else if (strchr(temp, 'N')) {
- free(temp);
- ret++;
- }
+ } else if (strchr(temp, 'N')) {
+ free(temp);
+ ret++;
+ }
destroy_message(m);
}
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- panes.c 2000/11/26 17:18:38 1.16
+++ panes.c 2000/11/26 21:28:17 1.17
@@ -39,8 +39,8 @@
GTK_SIGNAL_FUNC(folder_unselected), NULL);
if (!text || !text[0] || !text[1] || !text[2]) {
- fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
- RED, GREEN);
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
@@ -113,7 +113,7 @@
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
- check_for_new_mail(0);
+ check_for_new_mail(0);
return (scroll);
}
@@ -271,15 +271,15 @@
text = (char **) g_malloc(5 * sizeof(char *));
if (!text) {
- fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
- RED, GREEN);
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
text[1] = g_strdup("Message In Thread");
if (!text) {
- fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
- RED, GREEN);
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
@@ -308,7 +308,7 @@
/* The main account window */
void create_account_window()
{
- int i;
+ int i;
Account *mbox;
GtkWidget *accounts_win;
GtkWidget *main_vbox, *hbox;
@@ -334,23 +334,22 @@
/* The clist for browsing accounts */
clist = gtk_clist_new_with_titles(4, titles);
- gtk_box_pack_start(GTK_BOX(main_vbox), clist , TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(main_vbox), clist, TRUE, TRUE, 0);
- account_reset_dir();
- i = 0;
- while ((mbox = get_next_account())) {
- if (text) {
- if (text[0])
- g_free(text[0]);
- if (text[1])
- g_free(text[1]);
- if (text[2])
- g_free(text[2]);
- if (text[3])
- g_free(text[3]);
- }
- else
- text = (char **) g_malloc(4 * sizeof(char *));
+ account_reset_dir();
+ i = 0;
+ while ((mbox = get_next_account())) {
+ if (text) {
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+ } else
+ text = (char **) g_malloc(4 * sizeof(char *));
text[0] = account_get_name(mbox);
text[1] = account_get_fullname(mbox);
@@ -359,25 +358,25 @@
gtk_clist_insert(GTK_CLIST(clist), i, text);
gtk_clist_set_row_data_full(GTK_CLIST(clist), i,
- mbox,
- (GtkDestroyNotify)
- destroy_account);
- i++;
- }
- if (text[0])
- g_free(text[0]);
- if (text[1])
- g_free(text[1]);
- if (text[2])
- g_free(text[2]);
- if (text[3])
- g_free(text[3]);
- g_free(text);
-
- gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
- gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 1, TRUE);
- gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 2, TRUE);
- gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 3, TRUE);
+ mbox,
+ (GtkDestroyNotify)
+ destroy_account);
+ i++;
+ }
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+ g_free(text);
+
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 0, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 1, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 2, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(clist), 3, TRUE);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
@@ -415,9 +414,8 @@
gtk_container_add(GTK_CONTAINER(hbutton_box), button_close);
/* Show all widgets in the accounts window */
- gtk_widget_show_all(accounts_win);
+ gtk_widget_show_all(accounts_win);
}
-
GtkWidget *core_create_message_pane(Message * message, MessageFlags mode)
{
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- prefs.c 2000/11/26 11:39:17 1.8
+++ prefs.c 2000/11/26 21:28:17 1.9
@@ -417,8 +417,9 @@
rc = g_strconcat(home, "/.corerc", NULL);
config_file = fopen(rc, "w");
if (config_file == NULL) {
- fprintf(config_file, "%sERROR: %sMalloc failed, Exiting....\n",
- RED, GREEN);
+ fprintf(config_file,
+ "%sERROR: %sMalloc failed, Exiting....\n", RED,
+ GREEN);
return;
}
|
|
From: CORE C. L. <cor...@so...> - 2000-12-19 20:40:37
|
Core CVS committal
Author : rbdpngn
Project : core
Module : src
Modified Files:
account.c callbacks.c main.c menus.c message.c panes.c prefs.c
prefs.h
Log Message:
Some memory leak fixes, and various other code cleaning. There are still some
segfaults to work out.
===================================================================
RCS file: /cvsroot/corem/core/src/account.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- account.c 2000/12/15 22:27:17 1.14
+++ account.c 2000/12/19 20:40:37 1.15
@@ -331,8 +331,11 @@
asprintf(&path, "%s/.core/accounts", temp);
if (!path)
return NULL;
- temp = NULL; /* We don't need to free it since it's just a pointer to
- some environment variable string. */
+ temp = NULL;
+ /*
+ * We don't need to free temp since it's just a pointer to
+ * some environment variable string.
+ */
if (!acct_dir)
acct_dir = opendir(path);
@@ -357,7 +360,6 @@
break;
}
- /* g_free(dentry); */
g_free(temp);
}
g_free(path);
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- callbacks.c 2000/12/19 16:24:10 1.36
+++ callbacks.c 2000/12/19 20:40:37 1.37
@@ -7,6 +7,7 @@
#include "core.h"
#include "callbacks.h"
#include "panes.h"
+#include "prefs.h"
#define TIMEOUT 30
@@ -195,10 +196,9 @@
(tmp_password == NULL || *tmp_password == '\0') &&
(tmp_server == NULL || *tmp_server == '\0') &&
(tmp_path == NULL || *tmp_path == '\0')) {
- create_error_window(g_strdup("ERROR"),
- g_strdup
- ("Make sure you have filled in everything"),
- g_strdup("OK"));
+ create_error_window("ERROR",
+ "Make sure you have filled in everything",
+ "OK");
return;
}
@@ -245,7 +245,8 @@
if (text[2])
g_free(text[2]);
if (text[3])
- g_free(text[3]);
+ g_free(text[3]);
+ g_free(text);
}
text = (char **) g_malloc(4 * sizeof(char *));
@@ -266,7 +267,8 @@
if (text[2])
g_free(text[2]);
if (text[3])
- g_free(text[3]);
+ g_free(text[3]);
+ g_free(text);
}
gtk_widget_destroy(accounts_win_new);
@@ -309,7 +311,7 @@
if (!theme || !rc_get_value("theme"))
return;
- if (strcmp(theme, (char *) rc_get_value("theme")) == 0)
+ if (rc_compare(theme, "theme") == 0)
return;
rc_set_value("theme", theme);
@@ -325,7 +327,8 @@
/* Set the title */
gchar *title = g_strdup_printf("About");
/* Pass the title to right callback */
- create_preferences_window_cb(title);
+ create_preferences_window_cb(title);
+ g_free(title);
}
/* Calls the create_mail_window_cb showing the right stuff for viewing a mail */
@@ -490,37 +493,36 @@
text[col] = g_strdup("");
col++;
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
+ if (rc_compare("1", "ml_server") == 0) {
text[col] = header_get_value(head, "Server:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
+ if (rc_compare("1", "ml_priority") == 0) {
text[col] = header_get_value(head, "Priority:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
+ if (rc_compare("1", "ml_attachment") == 0) {
text[col] = header_get_value(head, "Attachment:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
+ if (rc_compare("1", "ml_score") == 0) {
text[col] = header_get_value(head, "Score:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
+ if (rc_compare("1", "ml_read") == 0)
text[col] = g_strdup("");
- }
temp = header_get_value(head, "References:");
@@ -540,7 +542,7 @@
NULL, text, 0, NULL, NULL, NULL,
NULL, FALSE, TRUE);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
+ if (rc_compare("1", "ml_read") == 0) {
char *xpm_name;
text[col] = header_get_value(head, "Status:");
@@ -566,7 +568,9 @@
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
- font = gdk_font_load((char *) rc_get_value("new_font"));
+ font =
+ gdk_font_load(rc_get_value("new_font"));
+
style =
gtk_style_copy(gtk_widget_get_style
(mail_ctree));
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- main.c 2000/12/19 16:42:51 1.19
+++ main.c 2000/12/19 20:40:37 1.20
@@ -41,28 +41,28 @@
void core_init()
{
- gchar *dir;
- /* Create $HOME/.core directory */
- dir = g_strconcat(getenv("HOME"), "/.core", NULL);
- if (dir) {
- mkdir(dir, 0700);
- g_free(dir);
- }
-
- /* Create $HOME/.core/accounts directory */
- dir = g_strconcat(getenv("HOME"), "/.core/accounts", NULL);
- if (dir) {
- mkdir(dir, 0700);
- g_free(dir);
- }
-
- /* Create $HOME/.core/themes directory */
- dir = g_strconcat(getenv("HOME"), "/.core/themes", NULL);
- if (dir) {
- mkdir(dir, 0700);
- g_free(dir);
- }
+ gchar *dir;
+ /* Create $HOME/.core directory */
+ dir = g_strconcat(getenv("HOME"), "/.core", NULL);
+ if (dir) {
+ mkdir(dir, 0700);
+ g_free(dir);
+ }
+
+ /* Create $HOME/.core/accounts directory */
+ dir = g_strconcat(getenv("HOME"), "/.core/accounts", NULL);
+ if (dir) {
+ mkdir(dir, 0700);
+ g_free(dir);
+ }
+ /* Create $HOME/.core/themes directory */
+ dir = g_strconcat(getenv("HOME"), "/.core/themes", NULL);
+ if (dir) {
+ mkdir(dir, 0700);
+ g_free(dir);
+ }
+
rc_set_defaults();
rc_parse_into_hash();
/* Create main window */
@@ -79,54 +79,64 @@
GtkWidget *main_menu;
GtkWidget *pane;
gint i = 0;
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
set_theme_dir();
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
title = g_strdup_printf("Core %s", CORE_VERSION);
main_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_usize(GTK_WIDGET(main_win), 800,
- 600);
+ gtk_widget_set_usize(GTK_WIDGET(main_win), 800, 600);
gtk_window_set_title(GTK_WINDOW(main_win), title);
gtk_signal_connect(GTK_OBJECT(main_win), "delete_event",
core_main_quit, NULL);
gtk_signal_connect(GTK_OBJECT(main_win), "destroy",
core_main_quit, NULL);
gtk_widget_realize(main_win);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
main_vbox = gtk_vbox_new(FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 0);
gtk_container_add(GTK_CONTAINER(main_win), main_vbox);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
mhandle = gtk_handle_box_new();
gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(mhandle),
GTK_SHADOW_NONE);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(mhandle),
GTK_POS_LEFT);
gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(mhandle),
GTK_POS_LEFT);
gtk_box_pack_start(GTK_BOX(main_vbox), mhandle, FALSE, FALSE, 0);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
thandle = gtk_handle_box_new();
create_main_toolbar();
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
hpane = gtk_hpaned_new();
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
{
pane = core_create_folder_pane();
gtk_paned_pack1(GTK_PANED(hpane), pane, TRUE, TRUE);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
pane = core_create_mlist_pane();
gtk_paned_pack2(GTK_PANED(hpane), pane, TRUE, TRUE);
}
-g_print("%d\n", i); i++; /***************9***************/
- /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/
- main_menu = create_main_menu();
- /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++; /***************9***************/
+ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/
+ main_menu = create_main_menu();
+ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/
+ g_print("%d\n", i); i++;
gtk_container_set_border_width(GTK_CONTAINER(main_menu), 0);
gtk_container_add(GTK_CONTAINER(mhandle), main_menu);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(thandle),
GTK_SHADOW_NONE);
gtk_handle_box_set_handle_position(GTK_HANDLE_BOX(thandle),
@@ -134,22 +144,27 @@
gtk_handle_box_set_snap_edge(GTK_HANDLE_BOX(thandle),
GTK_POS_LEFT);
gtk_box_pack_start(GTK_BOX(main_vbox), thandle, FALSE, FALSE, 0);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
gtk_box_pack_start(GTK_BOX(main_vbox), hpane, TRUE, TRUE, 0);
-g_print("%d\n", i); i++;
+ g_print("%d\n", i);
+ i++;
gtk_widget_show_all(main_win);
-g_print("%d\n", i); i++;
- if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 0) {
+ g_print("%d\n", i);
+ i++;
+ if (!rc_get_value("tb_show")) {
gtk_widget_hide(thandle);
}
-g_print("%d\n", i); i++;
- if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 0) {
+ g_print("%d\n", i);
+ i++;
+ if (!rc_get_value("tb_buttons")) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_TEXT);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
}
-g_print("%d\n", i); i++;
- if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 1) {
+ g_print("%d\n", i);
+ i++;
+ if (rc_get_value("tb_buttons")) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_ICONS);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
@@ -162,8 +177,8 @@
gchar *tmp;
tmp =
- g_strconcat(getenv("HOME"), "/.core/themes/", rc_get_value("theme"),
- "/", NULL);
+ g_strconcat(getenv("HOME"), "/.core/themes/",
+ rc_get_value("theme"), "/", NULL);
dir = opendir(tmp);
if (dir != NULL) {
@@ -175,14 +190,16 @@
g_free(tmp);
- tmp = g_strconcat(CORE_SHARE, "/themes/", rc_get_value("theme"), NULL);
+ tmp =
+ g_strconcat(CORE_SHARE, "/themes/", rc_get_value("theme"),
+ NULL);
dir = opendir(tmp);
g_free(tmp);
if (dir != NULL) {
theme =
- g_strconcat(CORE_SHARE, "/themes/", rc_get_value("theme"), "/",
- NULL);
+ g_strconcat(CORE_SHARE, "/themes/",
+ rc_get_value("theme"), "/", NULL);
return TRUE;
}
@@ -311,11 +328,11 @@
void toolbar_hide_show()
{
- if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 1) {
+ if (rc_get_value("tb_show")) {
rc_set_value("tb_show", "0");
gtk_widget_hide(thandle);
return;
- } else if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 0) {
+ } else {
gtk_widget_show(thandle);
rc_set_value("tb_show", "1");
return;
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- menus.c 2000/12/19 16:24:10 1.13
+++ menus.c 2000/12/19 20:40:37 1.14
@@ -110,14 +110,16 @@
show = gtk_check_menu_item_new_with_label("Show");
gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(show),
TRUE);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("tb_show")) == 0) {
+ if (rc_compare("0", "tb_show") == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show),
FALSE);
- }
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("tb_show")) == 0) {
+ }
+
+ if (rc_compare("1", "tb_show") == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show),
TRUE);
- }
+ }
+
gtk_signal_connect(GTK_OBJECT(show), "toggled",
GTK_SIGNAL_FUNC(toolbar_hide_show), NULL);
gtk_menu_append(GTK_MENU(toolbarmenu), show);
@@ -150,17 +152,18 @@
GINT_TO_POINTER(2));
gtk_menu_append(GTK_MENU(toolbarmenu), both);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("tb_buttons")) == 0) {
+ if (rc_compare("0", "tb_buttons") == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(text),
TRUE);
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("tb_buttons")) == 0) {
+ if (rc_compare("1", "tb_buttons") == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(icons),
TRUE);
}
- if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("tb_buttons")) == 0) {
+ if (rc_compare("2", "tb_buttons") == 0) {
+
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(both),
TRUE);
}
@@ -219,50 +222,54 @@
GINT_TO_POINTER(3));
gtk_menu_append(GTK_MENU(mline_stylemenu), mline_tabbed);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
+ if (rc_compare("0", "ml_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_none), TRUE);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
+ if (rc_compare("1", "ml_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_solid), TRUE);
- if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
+ if (rc_compare("2", "ml_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_dotted), TRUE);
- if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
+ if (rc_compare("3", "ml_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_tabbed), TRUE);
mpriority = gtk_check_menu_item_new_with_label("Show Priority");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mpriority),
- FALSE);
+ FALSE);
+
gtk_menu_append(GTK_MENU(message_listmenu), mpriority);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0)
+ if (rc_compare("1", "ml_priority") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mpriority), TRUE);
mread = gtk_check_menu_item_new_with_label("Show Read");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mread), FALSE);
- gtk_menu_append(GTK_MENU(message_listmenu), mread);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
+ gtk_menu_append(GTK_MENU(message_listmenu), mread);
+
+ if (rc_compare("1", "ml_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mread),
TRUE);
mattachment =
gtk_check_menu_item_new_with_label("Show Attachments");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mattachment),
- FALSE);
+ FALSE);
+
gtk_menu_append(GTK_MENU(message_listmenu), mattachment);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0)
+ if (rc_compare("1", "ml_attachment") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mattachment), TRUE);
mscore = gtk_check_menu_item_new_with_label("Show Score");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mscore), FALSE);
- gtk_menu_append(GTK_MENU(message_listmenu), mscore);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0)
+ gtk_menu_append(GTK_MENU(message_listmenu), mscore);
+
+ if (rc_compare("1", "ml_score") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mscore),
TRUE);
@@ -270,7 +277,7 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mserver),
FALSE);
gtk_menu_append(GTK_MENU(message_listmenu), mserver);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0)
+ if (rc_compare("1", "ml_server") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mserver), TRUE);
@@ -328,19 +335,19 @@
GINT_TO_POINTER(3));
gtk_menu_append(GTK_MENU(fline_stylemenu), fline_tabbed);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("fl_linestyle")) == 0)
+ if (rc_compare("0", "fl_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_none), TRUE);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("fl_linestyle")) == 0)
+ if (rc_compare("1", "fl_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_solid), TRUE);
- if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("fl_linestyle")) == 0)
+ if (rc_compare("2", "fl_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_dotted), TRUE);
- if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("fl_linestyle")) == 0)
+ if (rc_compare("3", "fl_linestyle") == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_tabbed), TRUE);
===================================================================
RCS file: /cvsroot/corem/core/src/message.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- message.c 2000/12/15 22:27:17 1.5
+++ message.c 2000/12/19 20:40:37 1.6
@@ -255,10 +255,10 @@
if (mbox->fp)
rewind(mbox->fp);
- m = message_get_next(mbox);
+ m = message_get_next(mbox);
while (m) {
temp = header_get_value(message_get_headers(m),
- "Message-Id:");
+ "Message-Id:");
if (temp) {
if (strcasecmp(temp, id) == 0)
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- panes.c 2000/12/19 16:24:10 1.21
+++ panes.c 2000/12/19 20:40:37 1.22
@@ -1,6 +1,7 @@
#include "message.h"
#include "core.h"
#include "panes.h"
+#include "prefs.h"
#include "callbacks.h"
GtkWidget *mail_ctree;
@@ -98,16 +99,19 @@
gtk_widget_set_usize(scroll, 12, 50);
gtk_widget_show_all(folder_ctree);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
+ if (rc_compare("0", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
- GTK_CTREE_LINES_NONE);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_NONE);
+
+ if (rc_compare("1", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
- GTK_CTREE_LINES_SOLID);
- if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_SOLID);
+
+ if (rc_compare("2", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
- GTK_CTREE_LINES_DOTTED);
- if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_DOTTED);
+
+ if (rc_compare("3", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
@@ -145,31 +149,31 @@
idate = col;
col++;
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
+ if (rc_compare("1", "ml_server") == 0) {
field_titles[col] = "Server";
iserver = col;
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
+ if (rc_compare("1", "ml_priority") == 0) {
field_titles[col] = "Priority";
ipriority = col;
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
+ if (rc_compare("1", "ml_attachment") == 0) {
field_titles[col] = "";
iattachment = col;
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
+ if (rc_compare("1", "ml_score") == 0) {
field_titles[col] = "Score";
iscore = col;
col++;
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
+ if (rc_compare("1", "ml_read") == 0) {
field_titles[col] = "";
iread = col;
col++;
@@ -195,17 +199,17 @@
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate, 150);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
+ if (rc_compare("1", "ml_server") == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iserver,
40);
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
+ if (rc_compare("1", "ml_priority") == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree),
ipriority, 40);
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
+ if (rc_compare("1", "ml_read") == 0) {
colormap = gtk_widget_get_colormap(mail_ctree);
pixmap =
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
@@ -225,7 +229,7 @@
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
+ if (rc_compare("1", "ml_attachment") == 0) {
colormap = gtk_widget_get_colormap(mail_ctree);
pixmap =
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
@@ -245,7 +249,7 @@
}
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
+ if (rc_compare("1", "ml_score") == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iscore,
30);
gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
@@ -271,17 +275,21 @@
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(scroll), mail_ctree);
- gtk_widget_show_all(mail_ctree);
- if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
+ gtk_widget_show_all(mail_ctree);
+
+ if (rc_compare("0", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
- GTK_CTREE_LINES_NONE);
- if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_NONE);
+
+ if (rc_compare("1", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
- GTK_CTREE_LINES_SOLID);
- if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_SOLID);
+
+ if (rc_compare("2", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
- GTK_CTREE_LINES_DOTTED);
- if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
+ GTK_CTREE_LINES_DOTTED);
+
+ if (rc_compare("3", "ml_linestyle") == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
return (scroll);
@@ -348,16 +356,18 @@
(GtkDestroyNotify)
destroy_account);
i++;
- }
- if (text[0])
- g_free(text[0]);
- if (text[1])
- g_free(text[1]);
- if (text[2])
- g_free(text[2]);
- if (text[3])
- g_free(text[3]);
- g_free(text);
+ }
+ if (text) {
+ if (text[0])
+ g_free(text[0]);
+ if (text[1])
+ g_free(text[1]);
+ if (text[2])
+ g_free(text[2]);
+ if (text[3])
+ g_free(text[3]);
+ g_free(text);
+ }
gtk_clist_set_column_auto_resize(GTK_CLIST(account_clist), 0,
TRUE);
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- prefs.c 2000/12/19 16:42:51 1.13
+++ prefs.c 2000/12/19 20:40:37 1.14
@@ -171,7 +171,8 @@
new_font = gtk_entry_new();
gtk_widget_set_usize(GTK_WIDGET(new_font), 320, 20);
gtk_entry_set_editable(GTK_ENTRY(new_font), TRUE);
- gtk_entry_set_text(GTK_ENTRY(new_font), (char *) rc_get_value("new_font"));
+ gtk_entry_set_text(GTK_ENTRY(new_font),
+ (char *) rc_get_value("new_font"));
gtk_table_attach(GTK_TABLE(table), new_font, 0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -257,7 +258,8 @@
static void ok_clicked()
{
- rc_set_value("default_font", gtk_entry_get_text(GTK_ENTRY(def_font)));
+ rc_set_value("default_font",
+ gtk_entry_get_text(GTK_ENTRY(def_font)));
rc_set_value("new_font", gtk_entry_get_text(GTK_ENTRY(new_font)));
apply_clicked();
gtk_widget_destroy(pref_win);
@@ -328,199 +330,218 @@
}
-int rc_remove_key(char * key)
+int rc_remove_key(char *key)
{
- char *tmp;
+ char *tmp;
- tmp = g_hash_table_lookup(config, key);
- if (key && strlen(key)) {
- if (tmp) {
- g_hash_table_freeze(config);
+ tmp = g_hash_table_lookup(config, key);
+ if (key && strlen(key)) {
+ if (tmp) {
+ g_hash_table_freeze(config);
- g_hash_table_remove(config, key);
+ g_hash_table_remove(config, key);
- g_hash_table_thaw(config);
- } else
- return FALSE;
- } else
- return FALSE;
+ g_hash_table_thaw(config);
+ } else
+ return FALSE;
+ } else
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-int rc_set_value(char * key, char * value)
+int rc_set_value(char *key, char *value)
{
- char *tmp;
+ char *tmp;
- if (key && strlen(key)) {
- if (value && strlen(value)) {
- tmp = g_hash_table_lookup(config, key);
- if (tmp) {
- rc_remove_key(key);
- g_free(tmp);
- } else {
- g_hash_table_freeze(config);
+ if (key && strlen(key)) {
+ if (value && strlen(value)) {
+ tmp = g_hash_table_lookup(config, key);
+ if (tmp) {
+ rc_remove_key(key);
+ g_free(tmp);
+ } else {
+ g_hash_table_freeze(config);
- g_hash_table_insert(config, key, value);
+ g_hash_table_insert(config, key, value);
- g_hash_table_thaw(config);
- }
- } else
- return FALSE;
- } else
- return FALSE;
+ g_hash_table_thaw(config);
+ }
+ } else
+ return FALSE;
+ } else
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-char *rc_get_value(char * key)
+char *rc_get_value(char *key)
{
- char *tmp;
+ char *tmp;
- if (key && strlen(key)) {
- tmp = g_hash_table_lookup(config, g_strdup(key));
- if (tmp) {
- return g_strdup(tmp);
- g_free(tmp);
- } else {
- fprintf(stderr, "%sERROR:%s Key %s not found", RED, GREEN, g_strdup(key));
- return FALSE;
+ if (key && strlen(key)) {
+ tmp = g_hash_table_lookup(config, g_strdup(key));
+ if (tmp) {
+ return g_strdup(tmp);
+ g_free(tmp);
+ } else {
+ fprintf(stderr, "%sERROR:%s Key %s not found", RED,
+ GREEN, g_strdup(key));
+ return FALSE;
}
- } else {
- fprintf(stderr, "%sERROR:%s Key not provided in rc_get_value", RED, GREEN);
- return FALSE;
+ } else {
+ fprintf(stderr,
+ "%sERROR:%s Key not provided in rc_get_value", RED,
+ GREEN);
+ return FALSE;
}
- return FALSE;
+ return FALSE;
}
int rc_set_defaults()
{
- config = g_hash_table_new(g_str_hash, g_str_equal);
- rc_set_value("xsize", "800");
- rc_set_value("ysize", "600");
- rc_set_value("tb_show", "1");
- rc_set_value("tb_buttons", "2"); /*0 = TEXT 1 = ICONS 2 = BOTH*/
- rc_set_value("default_font",
- "-schumacher-clean-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
- rc_set_value("new_font",
- "-schumacher-clean-bold-r-normal-*-*-120-*-*-c-*-iso646.1991-irv");
- rc_set_value("ml_priority", "0");
- rc_set_value("ml_read", "1");
- rc_set_value("ml_attachment", "1");
- rc_set_value("ml_score", "0");
- rc_set_value("ml_from", "1");
- rc_set_value("ml_subject", "1");
- rc_set_value("ml_date", "1");
- rc_set_value("ml_server", "0");
- rc_set_value("ml_linestyle", "2");
- rc_set_value("fl_linestyle", "2");
- rc_set_value("theme", "Default");
- return TRUE;
+ config = g_hash_table_new(g_str_hash, g_str_equal);
+ rc_set_value("xsize", "800");
+ rc_set_value("ysize", "600");
+ rc_set_value("tb_show", "1");
+ rc_set_value("tb_buttons", "2"); /*0 = TEXT 1 = ICONS 2 = BOTH */
+ rc_set_value("default_font",
+ "-schumacher-clean-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
+ rc_set_value("new_font",
+ "-schumacher-clean-bold-r-normal-*-*-120-*-*-c-*-iso646.1991-irv");
+ rc_set_value("ml_priority", "0");
+ rc_set_value("ml_read", "1");
+ rc_set_value("ml_attachment", "1");
+ rc_set_value("ml_score", "0");
+ rc_set_value("ml_from", "1");
+ rc_set_value("ml_subject", "1");
+ rc_set_value("ml_date", "1");
+ rc_set_value("ml_server", "0");
+ rc_set_value("ml_linestyle", "2");
+ rc_set_value("fl_linestyle", "2");
+ rc_set_value("theme", "Default");
+ return TRUE;
}
int rc_parse_into_hash()
{
- FILE *config_file;
- gchar *line;
- gchar *rc;
+ FILE *config_file;
+ gchar *line;
+ gchar *rc;
if (!getenv("HOME")) {
- fprintf(stderr, "%sERROR:%s Environment variable HOME not set.\n", RED, GREEN);
+ fprintf(stderr,
+ "%sERROR:%s Environment variable HOME not set.\n",
+ RED, GREEN);
return FALSE;
}
-
+
rc = g_strconcat(getenv("HOME"), "/.corerc", NULL);
- config_file = fopen(rc, "r");
- if (config_file == NULL) {
- rc_write();
- return FALSE;
- }
-
- line = get_next_line(config_file);
- while (line != NULL) {
- if (g_strncasecmp(line, "xsize=", 6) == 0) {
- rc_set_value("xsize", line + 6);
- } else if (g_strncasecmp(line, "ysize=", 6) == 0) {
- rc_set_value("ysize", line + 6);
- } else if (g_strncasecmp(line, "tb_show=", 8) == 0) {
- rc_set_value("tb_show", line + 8);
- } else if (g_strncasecmp(line, "tb_buttons=", 11) == 0) {
- rc_set_value("tb_buttons", line + 11);
- } else if (g_strncasecmp(line, "default_font=", 13) == 0) {
- rc_set_value("default_font", line + 13);
- } else if (g_strncasecmp(line, "new_font=", 9) == 0) {
- rc_set_value("new_font", line + 9);
- } else if (g_strncasecmp(line, "ml_priority=", 12) == 0) {
- rc_set_value("ml_priority",line + 12);
- } else if (g_strncasecmp(line, "ml_read=", 8) == 0) {
- rc_set_value("ml_read", line + 8);
- } else if (g_strncasecmp(line, "ml_attachment=", 14) == 0) {
- rc_set_value("ml_attachment", line + 14);
- } else if (g_strncasecmp(line, "ml_score=", 9) == 0) {
- rc_set_value("ml_score", line + 9);
- } else if (g_strncasecmp(line, "ml_from=", 8) == 0) {
- rc_set_value("ml_from", line + 8);
- } e...
[truncated message content] |