You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(50) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: CORE C. L. <cor...@so...> - 2001-02-16 19:01:10
|
Core CVS committal Author : smugg Module : core-rewrite Added Files: AUTHORS Log Message: hehe sorry balony |
|
From: CORE C. L. <cor...@so...> - 2001-02-16 18:58:05
|
Core CVS committal
Author : smugg
Module : core-rewrite
Modified Files:
Makefile.am configure
Log Message:
fix a minor make issue, tnx balony for discovering it
===================================================================
RCS file: /cvsroot/corem/core-rewrite/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- Makefile.am 2001/02/16 18:41:19 1.1.1.1
+++ Makefile.am 2001/02/16 18:58:52 1.2
@@ -8,7 +8,7 @@
GLIB_CFLAGS = $(GLIB_CFLAGS)
GLIB_LIBS = $(GLIB_LIBS)
-docs_DATA = README AUTHORS INSTALL ChangeLog
+docs_DATA = AUTHORS
docsdir = $(prefix)/doc/core
EXTRADIST = core.spec $(docs_DATA)
===================================================================
RCS file: /cvsroot/corem/core-rewrite/configure,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- configure 2001/02/16 18:42:04 1.1.1.1
+++ configure 2001/02/16 18:58:52 1.2
@@ -1103,7 +1103,7 @@
int main() {
/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x = {0,0};
+typedef int charset[2]; const charset x;
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
|
|
From: CORE C. L. <cor...@so...> - 2001-02-16 18:45:25
|
Core CVS committal Author : smugg Module : core-rewrite Log Message: rewrite Status: Vendor Tag: smugg Release Tags: start N core-rewrite/Makefile.am N core-rewrite/aclocal.m4 N core-rewrite/acsite.m4 N core-rewrite/autogen.sh N core-rewrite/configure.in N core-rewrite/core.spec.in N core-rewrite/config.h.in N core-rewrite/Makefile.in N core-rewrite/configure N core-rewrite/src/Makefile.am N core-rewrite/src/Makefile.in N core-rewrite/src/theme.c N core-rewrite/src/main.c N core-rewrite/src/core.h N core-rewrite/src/gui.c N core-rewrite/src/config.c N core-rewrite/src/util.c N core-rewrite/src/icon.xpm N core-rewrite/src/account.c N core-rewrite/src/debug.h N core-rewrite/src/callbacks.c N core-rewrite/src/message.c N core-rewrite/data/Makefile.am N core-rewrite/data/Makefile.in N core-rewrite/data/themes/Makefile.am N core-rewrite/data/themes/Makefile.in N core-rewrite/data/themes/Default/Makefile.am N core-rewrite/data/themes/Default/attachment.xpm N core-rewrite/data/themes/Default/folder_closed_new.xpm N core-rewrite/data/themes/Default/folder_closed_normal.xpm N core-rewrite/data/themes/Default/folder_open_new.xpm N core-rewrite/data/themes/Default/folder_open_normal.xpm N core-rewrite/data/themes/Default/forward.xpm N core-rewrite/data/themes/Default/icon.xpm N core-rewrite/data/themes/Default/load.xpm N core-rewrite/data/themes/Default/logo.xpm N core-rewrite/data/themes/Default/new.xpm N core-rewrite/data/themes/Default/read.xpm N core-rewrite/data/themes/Default/reply-all.xpm N core-rewrite/data/themes/Default/reply.xpm N core-rewrite/data/themes/Default/send-recieve.xpm N core-rewrite/data/themes/Default/trash.xpm N core-rewrite/data/themes/Default/Makefile.in No conflicts created by this import |
|
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);
- } else if (g_strncasecmp(line, "ml_subject=", 11) == 0) {
- rc_set_value("ml_subject", line + 11);
- } else if (g_strncasecmp(line, "ml_date=", 8) == 0) {
- rc_set_value("ml_date", line + 8);
- } else if (g_strncasecmp(line, "ml_server=", 10) == 0) {
- rc_set_value("ml_server", line + 10);
- } else if (g_strncasecmp(line, "ml_linestyle=", 13) == 0) {
- rc_set_value("ml_linestyle", line + 13);
- } else if (g_strncasecmp(line, "fl_linestyle=", 13) == 0) {
- rc_set_value("fl_linestyle", line + 13);
- } else if (g_strncasecmp(line, "theme=", 6) == 0) {
- rc_set_value("theme", line + 6);
- }
- g_free(line);
- line = get_next_line(config_file);
- }
-
- if (line)
- g_free(line);
- fclose(config_file);
- g_free(rc);
+ config_file = fopen(rc, "r");
+ if (config_file == NULL) {
+ rc_write();
+ return FALSE;
+ }
- return TRUE;
+ 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);
+ } else if (g_strncasecmp(line, "ml_subject=", 11) == 0) {
+ rc_set_value("ml_subject", line + 11);
+ } else if (g_strncasecmp(line, "ml_date=", 8) == 0) {
+ rc_set_value("ml_date", line + 8);
+ } else if (g_strncasecmp(line, "ml_server=", 10) == 0) {
+ rc_set_value("ml_server", line + 10);
+ } else if (g_strncasecmp(line, "ml_linestyle=", 13) == 0) {
+ rc_set_value("ml_linestyle", line + 13);
+ } else if (g_strncasecmp(line, "fl_linestyle=", 13) == 0) {
+ rc_set_value("fl_linestyle", line + 13);
+ } else if (g_strncasecmp(line, "theme=", 6) == 0) {
+ rc_set_value("theme", line + 6);
+ }
+ g_free(line);
+ line = get_next_line(config_file);
+ }
+
+ if (line)
+ g_free(line);
+ fclose(config_file);
+ g_free(rc);
+
+ return TRUE;
}
int rc_write()
{
- FILE *config_file;
- gchar *rc;
+ FILE *config_file;
+ gchar *rc;
+
+ rc = g_strconcat(getenv("HOME"), "/.corerc", NULL);
+ config_file = fopen(rc, "w");
+ if (config_file == NULL) {
+ fprintf(config_file,
+ "%sERROR: %sFailed to write to %s\n", RED,
+ GREEN, rc);
+ return FALSE;
+ }
- rc = g_strconcat(getenv("HOME"), "/.corerc", NULL);
- config_file = fopen(rc, "w");
- if (config_file == NULL) {
- fprintf(config_file,
- "%sERROR: %sFailed to write to %s\n", RED,
- GREEN, rc);
- return FALSE;
- }
-
- fprintf(config_file,
- "# ~/.corerc: Created by core, do not modify\n");
- fprintf(config_file, "xsize=%s\n", (char *) rc_get_value("xsize"));
- fprintf(config_file, "ysize=%s\n", (char *) rc_get_value("ysize"));
- fprintf(config_file, "tb_show=%s\n", (char *) rc_get_value("tb_show"));
- fprintf(config_file, "tb_buttons=%s\n", (char *) rc_get_value("tb_buttons"));
- fprintf(config_file, "default_font=%s\n", (char *) rc_get_value("default_font"));
- fprintf(config_file, "new_font=%s\n", (char *) rc_get_value("new_font"));
- fprintf(config_file, "ml_priority=%s\n", (char *) rc_get_value("ml_priority"));
- fprintf(config_file, "ml_read=%s\n", (char *) rc_get_value("ml_read"));
- fprintf(config_file, "ml_attachment=%s\n", (char *) rc_get_value("ml_attachment"));
- fprintf(config_file, "ml_score=%s\n", (char *) rc_get_value("ml_score"));
- fprintf(config_file, "ml_from=%s\n", (char *) rc_get_value("ml_from"));
- fprintf(config_file, "ml_subject=%s\n", (char *) rc_get_value("ml_subject"));
- fprintf(config_file, "ml_date=%s\n", (char *) rc_get_value("ml_date"));
- fprintf(config_file, "ml_server=%s\n", (char *) rc_get_value("ml_server"));
- fprintf(config_file, "ml_linestyle=%s\n", (char *) rc_get_value("ml_linestyle"));
- fprintf(config_file, "fl_linestyle=%s\n", (char *) rc_get_value("fl_linestyle"));
- fprintf(config_file, "theme=%s\n", (char *) rc_get_value("theme"));
- g_free(rc);
- return TRUE;
+ fprintf(config_file,
+ "# ~/.corerc: Created by core, do not modify\n");
+ fprintf(config_file, "xsize=%s\n", (char *) rc_get_value("xsize"));
+ fprintf(config_file, "ysize=%s\n", (char *) rc_get_value("ysize"));
+ fprintf(config_file, "tb_show=%s\n",
+ (char *) rc_get_value("tb_show"));
+ fprintf(config_file, "tb_buttons=%s\n",
+ (char *) rc_get_value("tb_buttons"));
+ fprintf(config_file, "default_font=%s\n",
+ (char *) rc_get_value("default_font"));
+ fprintf(config_file, "new_font=%s\n",
+ (char *) rc_get_value("new_font"));
+ fprintf(config_file, "ml_priority=%s\n",
+ (char *) rc_get_value("ml_priority"));
+ fprintf(config_file, "ml_read=%s\n",
+ (char *) rc_get_value("ml_read"));
+ fprintf(config_file, "ml_attachment=%s\n",
+ (char *) rc_get_value("ml_attachment"));
+ fprintf(config_file, "ml_score=%s\n",
+ (char *) rc_get_value("ml_score"));
+ fprintf(config_file, "ml_from=%s\n",
+ (char *) rc_get_value("ml_from"));
+ fprintf(config_file, "ml_subject=%s\n",
+ (char *) rc_get_value("ml_subject"));
+ fprintf(config_file, "ml_date=%s\n",
+ (char *) rc_get_value("ml_date"));
+ fprintf(config_file, "ml_server=%s\n",
+ (char *) rc_get_value("ml_server"));
+ fprintf(config_file, "ml_linestyle=%s\n",
+ (char *) rc_get_value("ml_linestyle"));
+ fprintf(config_file, "fl_linestyle=%s\n",
+ (char *) rc_get_value("fl_linestyle"));
+ fprintf(config_file, "theme=%s\n", (char *) rc_get_value("theme"));
+ g_free(rc);
+ return TRUE;
}
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- prefs.h 2000/12/19 16:24:10 1.2
+++ prefs.h 2000/12/19 20:40:37 1.3
@@ -3,9 +3,11 @@
void config_read();
void config_write();
-int rc_remove_key(char * key);
-int rc_set_value(char * key, char * value);
-char *rc_get_value(char * key);
+int rc_remove_key(char *key);
+int rc_set_value(char *key, char *value);
+char *rc_get_value(char *key);
int rc_set_defaults();
int rc_parse_into_hash();
typedef GHashTable ConfigData;
+
+#define rc_compare(str, rc_str) g_strcasecmp(str, rc_get_value(rc_str))
|
|
From: CORE C. L. <cor...@so...> - 2000-12-19 16:43:22
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
main.c prefs.c
Log Message:
forgot to add a parser thing
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- main.c 2000/12/19 16:24:10 1.18
+++ main.c 2000/12/19 16:42:51 1.19
@@ -64,6 +64,7 @@
}
rc_set_defaults();
+ rc_parse_into_hash();
/* Create main window */
create_core_main_window();
@@ -78,9 +79,9 @@
GtkWidget *main_menu;
GtkWidget *pane;
gint i = 0;
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
set_theme_dir();
-g_print("%d", 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,
@@ -91,39 +92,41 @@
gtk_signal_connect(GTK_OBJECT(main_win), "destroy",
core_main_quit, NULL);
gtk_widget_realize(main_win);
-g_print("%d", 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", 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", 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", i); i++;
+g_print("%d\n", i); i++;
thandle = gtk_handle_box_new();
create_main_toolbar();
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
hpane = gtk_hpaned_new();
-g_print("%d", 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", 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", i); i++; /***************9***************/
+g_print("%d\n", i); i++; /***************9***************/
+ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/ /*FIXME*/
main_menu = create_main_menu();
-g_print("%d", i); i++;
+ /*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", 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),
@@ -131,21 +134,21 @@
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", i); i++;
+g_print("%d\n", i); i++;
gtk_box_pack_start(GTK_BOX(main_vbox), hpane, TRUE, TRUE, 0);
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
gtk_widget_show_all(main_win);
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 0) {
gtk_widget_hide(thandle);
}
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 0) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_TEXT);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
}
-g_print("%d", i); i++;
+g_print("%d\n", i); i++;
if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 1) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_ICONS);
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- prefs.c 2000/12/19 16:24:10 1.12
+++ prefs.c 2000/12/19 16:42:51 1.13
@@ -328,130 +328,6 @@
}
-/*void config_read()
-{
- FILE *config_file;
- gchar *home;
- gchar *line;
- gchar *rc;
-
- bzero(&config, sizeof(ConfigData));
-
- config.xsize = 800;
- config.ysize = 600;
- config.tb_show = 1;
- config.tb_buttons = 2; 0 = TEXT 1 = ICONS 2 = BOTH
- config.default_font =
- g_strdup
- ("-schumacher-clean-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
- config.new_font =
- g_strdup
- ("-schumacher-clean-bold-r-normal-*-*-120-*-*-c-*-iso646.1991-irv");
- config.ml_priority = 0;
- config.ml_read = 1;
- config.ml_attachment = 1;
- config.ml_score = 0;
- config.ml_from = 1;
- config.ml_subject = 1;
- config.ml_date = 1;
- config.ml_server = 0;
- config.ml_linestyle = 2;
- config.fl_linestyle = 2;
- config.theme = g_strdup("Default");
- home = getenv("HOME");
- rc = g_strconcat(home, "/.corerc", NULL);
-
- config_file = fopen(rc, "r");
- if (config_file == NULL) {
- config_write();
- return;
- }
- line = get_next_line(config_file);
- while (line != NULL) {
- if (g_strncasecmp(line, "xsize=", 6) == 0) {
- config.xsize = atoi(line + 6);
- } else if (g_strncasecmp(line, "ysize=", 6) == 0) {
- config.ysize = atoi(line + 6);
- } else if (g_strncasecmp(line, "tb_show=", 8) == 0) {
- config.tb_show = atoi(line + 8);
- } else if (g_strncasecmp(line, "tb_buttons=", 11) == 0) {
- config.tb_buttons = atoi(line + 11);
- } else if (g_strncasecmp(line, "default_font=", 13) == 0) {
- config.default_font = g_strdup(line + 13);
- } else if (g_strncasecmp(line, "new_font=", 9) == 0) {
- config.new_font = g_strdup(line + 9);
- } else if (g_strncasecmp(line, "ml_priority=", 12) == 0) {
- config.ml_priority = atoi(line + 12);
- } else if (g_strncasecmp(line, "ml_read=", 8) == 0) {
- config.ml_read = atoi(line + 8);
- } else if (g_strncasecmp(line, "ml_attachment=", 14) == 0) {
- config.ml_attachment = atoi(line + 14);
- } else if (g_strncasecmp(line, "ml_score=", 9) == 0) {
- config.ml_score = atoi(line + 9);
- } else if (g_strncasecmp(line, "ml_from=", 8) == 0) {
- config.ml_from = atoi(line + 8);
- } else if (g_strncasecmp(line, "ml_subject=", 11) == 0) {
- config.ml_subject = atoi(line + 11);
- } else if (g_strncasecmp(line, "ml_date=", 8) == 0) {
- config.ml_date = atoi(line + 8);
- } else if (g_strncasecmp(line, "ml_server=", 10) == 0) {
- config.ml_server = atoi(line + 10);
- } else if (g_strncasecmp(line, "ml_linestyle=", 13) == 0) {
- config.ml_linestyle = atoi(line + 13);
- } else if (g_strncasecmp(line, "fl_linestyle=", 13) == 0) {
- config.fl_linestyle = atoi(line + 13);
- } else if (g_strncasecmp(line, "theme=", 6) == 0) {
- config.theme = g_strdup(line + 6);
- }
- g_free(line);
- line = get_next_line(config_file);
- }
- if (line)
- g_free(line);
- fclose(config_file);
- g_free(rc);
-}
-
-void config_write()
-{
- FILE *config_file;
- gchar *home;
- gchar *rc;
-
- home = getenv("HOME");
- 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);
- return;
- }
-
- fprintf(config_file,
- "# ~/.corerc: Created by core, do not modify\n");
- fprintf(config_file, "xsize=%d\n", config.xsize);
- fprintf(config_file, "ysize=%d\n", config.ysize);
- fprintf(config_file, "tb_show=%d\n", config.tb_show);
- fprintf(config_file, "tb_buttons=%d\n", config.tb_buttons);
- fprintf(config_file, "default_font=%s\n", config.default_font);
- fprintf(config_file, "new_font=%s\n", config.new_font);
- fprintf(config_file, "ml_priority=%d\n", config.ml_priority);
- fprintf(config_file, "ml_read=%d\n", config.ml_read);
- fprintf(config_file, "ml_attachment=%d\n", config.ml_attachment);
- fprintf(config_file, "ml_score=%d\n", config.ml_score);
- fprintf(config_file, "ml_from=%d\n", config.ml_from);
- fprintf(config_file, "ml_subject=%d\n", config.ml_subject);
- fprintf(config_file, "ml_date=%d\n", config.ml_date);
- fprintf(config_file, "ml_server=%d\n", config.ml_server);
- fprintf(config_file, "ml_linestyle=%d\n", config.ml_linestyle);
- fprintf(config_file, "fl_linestyle=%d\n", config.fl_linestyle);
- fprintf(config_file, "theme=%s\n", config.theme);
- g_free(rc);
- return;
-}
-*/
-
int rc_remove_key(char * key)
{
char *tmp;
@@ -547,7 +423,67 @@
int rc_parse_into_hash()
{
+ FILE *config_file;
+ gchar *line;
+ gchar *rc;
+
+ if (!getenv("HOME")) {
+ 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);
+ } else if (g_strncasecmp(line, "ml_subject=", 11) == 0) {
+ rc_set_value("ml_subject", line + 11);
+ } else if (g_strncasecmp(line, "ml_date=", 8) == 0) {
+ rc_set_value("ml_date", line + 8);
+ } else if (g_strncasecmp(line, "ml_server=", 10) == 0) {
+ rc_set_value("ml_server", line + 10);
+ } else if (g_strncasecmp(line, "ml_linestyle=", 13) == 0) {
+ rc_set_value("ml_linestyle", line + 13);
+ } else if (g_strncasecmp(line, "fl_linestyle=", 13) == 0) {
+ rc_set_value("fl_linestyle", line + 13);
+ } else if (g_strncasecmp(line, "theme=", 6) == 0) {
+ rc_set_value("theme", line + 6);
+ }
+ g_free(line);
+ line = get_next_line(config_file);
+ }
+
+ if (line)
+ g_free(line);
+ fclose(config_file);
+ g_free(rc);
return TRUE;
}
|
|
From: CORE C. L. <cor...@so...> - 2000-12-19 16:24:11
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c core.h main.c menus.c menus.h panes.c prefs.c
prefs.h
Log Message:
rewrote the config parser to use GHashTables, and fixed everything, somehow core segfaults in create_main_menu, its hard to trace whats causing the segfault since it leaves no traces in the stack
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- callbacks.c 2000/12/15 22:27:17 1.35
+++ callbacks.c 2000/12/19 16:24:10 1.36
@@ -14,7 +14,6 @@
extern GtkWidget *mail_ctree;
extern GtkWidget *account_clist;
extern GtkWidget *main_win;
-extern ConfigData config;
extern gchar *title;
extern gchar *theme;
@@ -307,15 +306,13 @@
void switch_theme(gchar * theme)
{
- if (!theme || !config.theme)
+ if (!theme || !rc_get_value("theme"))
return;
- if (strcmp(theme, config.theme) == 0)
+ if (strcmp(theme, (char *) rc_get_value("theme")) == 0)
return;
- if (config.theme)
- g_free(config.theme);
- config.theme = g_strdup(theme);
+ rc_set_value("theme", theme);
set_theme_dir();
gtk_widget_destroy(toolbar);
create_main_toolbar();
@@ -493,35 +490,35 @@
text[col] = g_strdup("");
col++;
- if (config.ml_server == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
text[col] = header_get_value(head, "Server:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (config.ml_priority == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
text[col] = header_get_value(head, "Priority:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (config.ml_attachment == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
text[col] = header_get_value(head, "Attachment:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (config.ml_score == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
text[col] = header_get_value(head, "Score:");
if (!text[col])
text[col] = g_strdup("");
col++;
}
- if (config.ml_read == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
text[col] = g_strdup("");
}
@@ -543,7 +540,7 @@
NULL, text, 0, NULL, NULL, NULL,
NULL, FALSE, TRUE);
- if (config.ml_read == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
char *xpm_name;
text[col] = header_get_value(head, "Status:");
@@ -569,7 +566,7 @@
gdk_bitmap_unref(bitmap);
gdk_pixmap_unref(pixmap);
- font = gdk_font_load(config.new_font);
+ font = gdk_font_load((char *) rc_get_value("new_font"));
style =
gtk_style_copy(gtk_widget_get_style
(mail_ctree));
===================================================================
RCS file: /cvsroot/corem/core/src/core.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- core.h 2000/11/26 11:39:17 1.10
+++ core.h 2000/12/19 16:24:10 1.11
@@ -5,7 +5,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-typedef struct {
+/*typedef struct {
gint xsize;
gint ysize;
gboolean tb_show;
@@ -23,7 +23,7 @@
gboolean ml_server;
gboolean ml_linestyle;
gboolean fl_linestyle;
-} ConfigData;
+} ConfigData;*/
#define RED "[1;31m"
#define GREEN "[1;32m"
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- main.c 2000/12/15 22:27:17 1.17
+++ main.c 2000/12/19 16:24:10 1.18
@@ -7,9 +7,10 @@
#include <sys/types.h>
#define PREFIX "/usr"
+void core_init();
+
gchar *theme, *title;
GtkWidget *message_pane;
-ConfigData config;
GtkWidget *main_win;
GtkWidget *mhandle;
GtkWidget *thandle;
@@ -22,37 +23,14 @@
int main(int argc, char **argv)
{
- 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);
- }
-
/* Set locale */
gtk_set_locale();
- /* Init */
+ /* Init GTK+ */
gtk_init(&argc, &argv);
-
- /* Create main window */
- create_core_main_window();
+ /* Init Core */
+ core_init();
/* Here core sleeps until the core_main_quit is called */
gtk_main();
@@ -61,60 +39,91 @@
}
+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);
+ }
+
+ rc_set_defaults();
+ /* Create main window */
+ create_core_main_window();
+
+ return;
+}
+
+
/* The main window callback */
void create_core_main_window(void)
{
GtkWidget *main_vbox;
GtkWidget *main_menu;
GtkWidget *pane;
-
- bzero(&config, sizeof(ConfigData));
- config_read();
-
+ gint i = 0;
+g_print("%d", i); i++;
set_theme_dir();
-
+g_print("%d", 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), config.xsize,
- config.ysize);
+ 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", 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", i); i++;
mhandle = gtk_handle_box_new();
gtk_handle_box_set_shadow_type(GTK_HANDLE_BOX(mhandle),
GTK_SHADOW_NONE);
-
+g_print("%d", 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", i); i++;
thandle = gtk_handle_box_new();
create_main_toolbar();
-
+g_print("%d", i); i++;
hpane = gtk_hpaned_new();
-
+g_print("%d", i); i++;
{
pane = core_create_folder_pane();
gtk_paned_pack1(GTK_PANED(hpane), pane, TRUE, TRUE);
-
+g_print("%d", i); i++;
pane = core_create_mlist_pane();
gtk_paned_pack2(GTK_PANED(hpane), pane, TRUE, TRUE);
}
-
+g_print("%d", i); i++; /***************9***************/
main_menu = create_main_menu();
+g_print("%d", i); i++;
gtk_container_set_border_width(GTK_CONTAINER(main_menu), 0);
gtk_container_add(GTK_CONTAINER(mhandle), main_menu);
-
+g_print("%d", 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),
@@ -122,22 +131,22 @@
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", i); i++;
gtk_box_pack_start(GTK_BOX(main_vbox), hpane, TRUE, TRUE, 0);
-
+g_print("%d", i); i++;
gtk_widget_show_all(main_win);
-
- if (config.tb_show == 0) {
+g_print("%d", i); i++;
+ if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 0) {
gtk_widget_hide(thandle);
}
-
- if (config.tb_buttons == 0) {
+g_print("%d", i); i++;
+ if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 0) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_TEXT);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
}
-
- if (config.tb_buttons == 1) {
+g_print("%d", i); i++;
+ if (GPOINTER_TO_INT(rc_get_value("tb_buttons")) == 1) {
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_ICONS);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
@@ -150,26 +159,26 @@
gchar *tmp;
tmp =
- g_strconcat(getenv("HOME"), "/.core/themes/", config.theme,
+ g_strconcat(getenv("HOME"), "/.core/themes/", rc_get_value("theme"),
"/", NULL);
dir = opendir(tmp);
if (dir != NULL) {
theme =
g_strconcat(getenv("HOME"), "/.core/themes/",
- config.theme, "/", NULL);
+ rc_get_value("theme"), "/", NULL);
return TRUE;
}
g_free(tmp);
- tmp = g_strconcat(CORE_SHARE, "/themes/", config.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/", config.theme, "/",
+ g_strconcat(CORE_SHARE, "/themes/", rc_get_value("theme"), "/",
NULL);
return TRUE;
}
@@ -276,21 +285,21 @@
void toolbar_change_layout(gint type)
{
if (type == 0) {
- config.tb_buttons = 0;
+ rc_set_value("tb_buttons", "0");
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_TEXT);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
}
if (type == 1) {
- config.tb_buttons = 1;
+ rc_set_value("tb_buttons", "1");
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_ICONS);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
}
if (type == 2) {
- config.tb_buttons = 2;
+ rc_set_value("tb_buttons", "2");
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
GTK_TOOLBAR_BOTH);
gtk_widget_queue_resize(GTK_WIDGET(thandle));
@@ -299,13 +308,13 @@
void toolbar_hide_show()
{
- if (config.tb_show == 1) {
- config.tb_show = 0;
+ if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 1) {
+ rc_set_value("tb_show", "0");
gtk_widget_hide(thandle);
return;
- } else if (config.tb_show == 0) {
+ } else if (GPOINTER_TO_INT(rc_get_value("tb_show")) == 0) {
gtk_widget_show(thandle);
- config.tb_show = 1;
+ rc_set_value("tb_show", "1");
return;
}
return;
@@ -315,6 +324,6 @@
void core_main_quit(void)
{
- config_write();
+ rc_write();
gtk_main_quit();
}
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- menus.c 2000/12/15 22:27:17 1.12
+++ menus.c 2000/12/19 16:24:10 1.13
@@ -5,15 +5,14 @@
#include "panes.h"
#include "prefs.h"
-extern ConfigData config;
extern GtkWidget *toolbar;
static GtkItemFactoryEntry mail_menu_items[] = {
{"/File", NULL, NULL, 0, "<Branch>"},
{"/File/Close", NULL, NULL, 0, NULL},
};
+static void create_themes_menu(GtkWidget * menu);
-
void core_create_mail_menu(GtkWidget * window, GtkWidget ** menubar)
{
GtkItemFactory *item_factory;
@@ -111,11 +110,11 @@
show = gtk_check_menu_item_new_with_label("Show");
gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(show),
TRUE);
- if (config.tb_show == 0) {
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("tb_show")) == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show),
FALSE);
}
- if (config.tb_show == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("tb_show")) == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show),
TRUE);
}
@@ -151,17 +150,17 @@
GINT_TO_POINTER(2));
gtk_menu_append(GTK_MENU(toolbarmenu), both);
- if (config.tb_buttons == 0) {
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("tb_buttons")) == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(text),
TRUE);
}
- if (config.tb_buttons == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("tb_buttons")) == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(icons),
TRUE);
}
- if (config.tb_buttons == 2) {
+ if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("tb_buttons")) == 0) {
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(both),
TRUE);
}
@@ -220,19 +219,19 @@
GINT_TO_POINTER(3));
gtk_menu_append(GTK_MENU(mline_stylemenu), mline_tabbed);
- if (config.ml_linestyle == 0)
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_none), TRUE);
- if (config.ml_linestyle == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_solid), TRUE);
- if (config.ml_linestyle == 2)
+ if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_dotted), TRUE);
- if (config.ml_linestyle == 3)
+ if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mline_tabbed), TRUE);
@@ -240,14 +239,14 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mpriority),
FALSE);
gtk_menu_append(GTK_MENU(message_listmenu), mpriority);
- if (config.ml_priority == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("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 (config.ml_read == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mread),
TRUE);
@@ -256,14 +255,14 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mattachment),
FALSE);
gtk_menu_append(GTK_MENU(message_listmenu), mattachment);
- if (config.ml_attachment == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("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 (config.ml_score == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mscore),
TRUE);
@@ -271,7 +270,7 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mserver),
FALSE);
gtk_menu_append(GTK_MENU(message_listmenu), mserver);
- if (config.ml_server == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(mserver), TRUE);
@@ -329,19 +328,19 @@
GINT_TO_POINTER(3));
gtk_menu_append(GTK_MENU(fline_stylemenu), fline_tabbed);
- if (config.fl_linestyle == 0)
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("fl_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_none), TRUE);
- if (config.fl_linestyle == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("fl_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_solid), TRUE);
- if (config.fl_linestyle == 2)
+ if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("fl_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_dotted), TRUE);
- if (config.fl_linestyle == 3)
+ if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("fl_linestyle")) == 0)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
(fline_tabbed), TRUE);
@@ -359,11 +358,10 @@
GTK_SIGNAL_FUNC(create_core_about_window),
NULL);
gtk_menu_append(GTK_MENU(helpmenu), about);
-
return (menu);
}
-void create_themes_menu(GtkWidget * menu)
+static void create_themes_menu(GtkWidget * menu)
{
gint i;
gchar *dirs[] =
@@ -416,7 +414,6 @@
g_free(temp);
icon = gtk_pixmap_new(pixmap, bitmap);
-
hbox = gtk_hbox_new(0, 8);
gtk_box_pack_start(GTK_BOX(hbox), icon,
FALSE, FALSE, 0);
===================================================================
RCS file: /cvsroot/corem/core/src/menus.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- menus.h 2000/11/22 23:45:00 1.2
+++ menus.h 2000/12/19 16:24:10 1.3
@@ -1,2 +1 @@
GtkWidget *create_main_menu();
-void create_themes_menu(GtkWidget * menu);
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- panes.c 2000/12/15 22:27:17 1.20
+++ panes.c 2000/12/19 16:24:10 1.21
@@ -3,7 +3,6 @@
#include "panes.h"
#include "callbacks.h"
-extern ConfigData config;
GtkWidget *mail_ctree;
GtkWidget *folder_ctree;
GtkWidget *account_clist;
@@ -44,7 +43,7 @@
exit(-1);
}
- font = gdk_font_load(config.default_font);
+ font = gdk_font_load((char *) rc_get_value("default_font"));
style = gtk_style_copy(gtk_widget_get_style(hpane));
gdk_font_unref(style->font);
style->font = font;
@@ -58,7 +57,6 @@
g_strconcat(theme,
"folder_closed_normal.xpm",
NULL));
-
colormap = gtk_widget_get_colormap(folder_ctree);
opixmap =
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
@@ -100,16 +98,16 @@
gtk_widget_set_usize(scroll, 12, 50);
gtk_widget_show_all(folder_ctree);
- if (config.ml_linestyle == 0)
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_NONE);
- if (config.ml_linestyle == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_SOLID);
- if (config.ml_linestyle == 2)
+ if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_DOTTED);
- if (config.ml_linestyle == 3)
+ if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
@@ -147,31 +145,31 @@
idate = col;
col++;
- if (config.ml_server == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
field_titles[col] = "Server";
iserver = col;
col++;
}
- if (config.ml_priority == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
field_titles[col] = "Priority";
ipriority = col;
col++;
}
- if (config.ml_attachment == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
field_titles[col] = "";
iattachment = col;
col++;
}
- if (config.ml_score == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
field_titles[col] = "Score";
iscore = col;
col++;
}
- if (config.ml_read == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
field_titles[col] = "";
iread = col;
col++;
@@ -182,7 +180,7 @@
gtk_signal_connect(GTK_OBJECT(mail_ctree), "tree_select_row",
GTK_SIGNAL_FUNC(mail_selected), NULL);
- font = gdk_font_load(config.default_font);
+ font = gdk_font_load((char *) rc_get_value("default_font"));
style = gtk_style_copy(gtk_widget_get_style(hpane));
gdk_font_unref(style->font);
style->font = font;
@@ -197,17 +195,17 @@
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate, 150);
- if (config.ml_server == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_server")) == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iserver,
40);
}
- if (config.ml_priority) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_priority")) == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree),
ipriority, 40);
}
- if (config.ml_read == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_read")) == 0) {
colormap = gtk_widget_get_colormap(mail_ctree);
pixmap =
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
@@ -227,7 +225,7 @@
}
- if (config.ml_attachment == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_attachment")) == 0) {
colormap = gtk_widget_get_colormap(mail_ctree);
pixmap =
gdk_pixmap_colormap_create_from_xpm(NULL, colormap,
@@ -247,7 +245,7 @@
}
- if (config.ml_score == 1) {
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_score")) == 0) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iscore,
30);
gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
@@ -274,16 +272,16 @@
GTK_POLICY_AUTOMATIC);
gtk_container_add(GTK_CONTAINER(scroll), mail_ctree);
gtk_widget_show_all(mail_ctree);
- if (config.ml_linestyle == 0)
+ if (g_strcasecmp(g_strdup("0"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_NONE);
- if (config.ml_linestyle == 1)
+ if (g_strcasecmp(g_strdup("1"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_SOLID);
- if (config.ml_linestyle == 2)
+ if (g_strcasecmp(g_strdup("2"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_DOTTED);
- if (config.ml_linestyle == 3)
+ if (g_strcasecmp(g_strdup("3"), (char *) rc_get_value("ml_linestyle")) == 0)
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
return (scroll);
@@ -619,25 +617,25 @@
void folder_ctree_change_line_style(gint type)
{
if (type == 0) {
- config.fl_linestyle = 0;
+ rc_set_value("fl_linestyle", "0");
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_NONE);
}
if (type == 1) {
- config.fl_linestyle = 1;
+ rc_set_value("fl_linestyle", "1");
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_SOLID);
}
if (type == 2) {
- config.fl_linestyle = 2;
+ rc_set_value("fl_linestyle", "2");
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_DOTTED);
}
if (type == 3) {
- config.fl_linestyle = 3;
+ rc_set_value("fl_linestyle", "3");
gtk_ctree_set_line_style(GTK_CTREE(folder_ctree),
GTK_CTREE_LINES_TABBED);
}
@@ -647,25 +645,25 @@
void mail_ctree_change_line_style(gint type)
{
if (type == 0) {
- config.ml_linestyle = 0;
+ rc_set_value("ml_linestyle", "0");
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_NONE);
}
if (type == 1) {
- config.ml_linestyle = 1;
+ rc_set_value("ml_linestyle", "1");
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_SOLID);
}
if (type == 2) {
- config.ml_linestyle = 2;
+ rc_set_value("ml_linestyle", "2");
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_DOTTED);
}
if (type == 3) {
- config.ml_linestyle = 3;
+ rc_set_value("ml_linestyle", "3");
gtk_ctree_set_line_style(GTK_CTREE(mail_ctree),
GTK_CTREE_LINES_TABBED);
}
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- prefs.c 2000/12/15 22:27:17 1.11
+++ prefs.c 2000/12/19 16:24:10 1.12
@@ -1,8 +1,12 @@
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "core.h"
#include "util.h"
#include "prefs.h"
-extern ConfigData config;
+ConfigData *config;
extern GtkWidget *folder_ctree;
extern GtkWidget *mail_ctree;
extern GtkWidget *main_win;
@@ -146,7 +150,7 @@
gtk_widget_set_usize(GTK_WIDGET(def_font), 320, 20);
gtk_entry_set_editable(GTK_ENTRY(def_font), TRUE);
gtk_entry_set_text(GTK_ENTRY(def_font),
- config.default_font);
+ (char *) rc_get_value("default_font"));
gtk_table_attach(GTK_TABLE(table), def_font, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0, 1, 1);
@@ -167,7 +171,7 @@
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), config.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);
@@ -253,10 +257,8 @@
static void ok_clicked()
{
- config.default_font =
- g_strdup(gtk_entry_get_text(GTK_ENTRY(def_font)));
- config.new_font =
- g_strdup(gtk_entry_get_text(GTK_ENTRY(new_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);
}
@@ -326,7 +328,7 @@
}
-void config_read()
+/*void config_read()
{
FILE *config_file;
gchar *home;
@@ -338,7 +340,7 @@
config.xsize = 800;
config.ysize = 600;
config.tb_show = 1;
- config.tb_buttons = 2; /* 0 = TEXT 1 = ICONS 2 = BOTH */
+ config.tb_buttons = 2; 0 = TEXT 1 = ICONS 2 = BOTH
config.default_font =
g_strdup
("-schumacher-clean-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
@@ -447,4 +449,142 @@
fprintf(config_file, "theme=%s\n", config.theme);
g_free(rc);
return;
+}
+*/
+
+int rc_remove_key(char * key)
+{
+ char *tmp;
+
+ 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_thaw(config);
+ } else
+ return FALSE;
+ } else
+ return FALSE;
+
+ return TRUE;
+}
+
+int rc_set_value(char * key, char * value)
+{
+ 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);
+
+ g_hash_table_insert(config, key, value);
+
+ g_hash_table_thaw(config);
+ }
+ } else
+ return FALSE;
+ } else
+ return FALSE;
+
+ return TRUE;
+}
+
+char *rc_get_value(char * key)
+{
+ 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;
+ }
+ } else {
+ fprintf(stderr, "%sERROR:%s Key not provided in rc_get_value", RED, GREEN);
+ 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;
+}
+
+
+int rc_parse_into_hash()
+{
+
+
+ return TRUE;
+}
+
+int rc_write()
+{
+ FILE *config_file;
+ gchar *rc;
+
+ rc = g_strconcat(getenv("HOME"), "/.corerc", NULL);
+ config_file = fopen(rc, "w");
+ if (config_file == NULL) {
+ fprintf(config_file,
+ "%sERROR: %sFailed to write to %s\n", RED,
+ GREEN, rc);
+ return FALSE;
+ }
+
+ fprintf(config_file,
+ "# ~/.corerc: Created by core, do not modify\n");
+ fprintf(config_file, "xsize=%s\n", (char *) rc_get_value("xsize"));
+ fprintf(config_file, "ysize=%s\n", (char *) rc_get_value("ysize"));
+ fprintf(config_file, "tb_show=%s\n", (char *) rc_get_value("tb_show"));
+ fprintf(config_file, "tb_buttons=%s\n", (char *) rc_get_value("tb_buttons"));
+ fprintf(config_file, "default_font=%s\n", (char *) rc_get_value("default_font"));
+ fprintf(config_file, "new_font=%s\n", (char *) rc_get_value("new_font"));
+ fprintf(config_file, "ml_priority=%s\n", (char *) rc_get_value("ml_priority"));
+ fprintf(config_file, "ml_read=%s\n", (char *) rc_get_value("ml_read"));
+ fprintf(config_file, "ml_attachment=%s\n", (char *) rc_get_value("ml_attachment"));
+ fprintf(config_file, "ml_score=%s\n", (char *) rc_get_value("ml_score"));
+ fprintf(config_file, "ml_from=%s\n", (char *) rc_get_value("ml_from"));
+ fprintf(config_file, "ml_subject=%s\n", (char *) rc_get_value("ml_subject"));
+ fprintf(config_file, "ml_date=%s\n", (char *) rc_get_value("ml_date"));
+ fprintf(config_file, "ml_server=%s\n", (char *) rc_get_value("ml_server"));
+ fprintf(config_file, "ml_linestyle=%s\n", (char *) rc_get_value("ml_linestyle"));
+ fprintf(config_file, "fl_linestyle=%s\n", (char *) rc_get_value("fl_linestyle"));
+ fprintf(config_file, "theme=%s\n", (char *) rc_get_value("theme"));
+ g_free(rc);
+ return TRUE;
}
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- prefs.h 2000/11/14 19:23:25 1.1.1.1
+++ prefs.h 2000/12/19 16:24:10 1.2
@@ -2,3 +2,10 @@
void create_preferences_window_cb(gchar * wintitle);
void config_read();
void config_write();
+
+int rc_remove_key(char * key);
+int rc_set_value(char * key, char * value);
+char *rc_get_value(char * key);
+int rc_set_defaults();
+int rc_parse_into_hash();
+typedef GHashTable ConfigData;
|
|
From: CORE C. L. <cor...@li...> - 2000-11-30 22:28:22
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c main.c menus.c panes.c
Log Message:
bleh just tested som stuff iirc
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- callbacks.c 2000/11/27 10:12:11 1.33
+++ callbacks.c 2000/11/30 22:28:21 1.34
@@ -1,8 +1,12 @@
+#include <gdk/gdk.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <signal.h>
+
#include "message.h"
#include "core.h"
#include "callbacks.h"
#include "panes.h"
-#include <signal.h>
#define TIMEOUT 30
@@ -479,33 +483,26 @@
break;
col = 0;
-
- if (config.ml_from == 1) {
- found = find_header(head, "From:");
- if (found)
- text[col] = header_get_value(found);
- else
- text[col] = g_strdup("");
- col++;
- }
- if (config.ml_subject == 1) {
+ found = find_header(head, "From:");
+ if (found)
+ text[col] = header_get_value(found);
+ else
+ text[col] = g_strdup("");
+ col++;
found = find_header(head, "Subject:");
- if (found)
- text[col] = header_get_value(found);
- else
- text[col] = g_strdup("");
- col++;
- }
-
- if (config.ml_date == 1) {
- found = find_header(head, "Date:");
- if (found)
- text[col] = header_get_value(found);
- else
- text[col] = g_strdup("");
- col++;
- }
+ if (found)
+ text[col] = header_get_value(found);
+ else
+ text[col] = g_strdup("");
+ col++;
+
+ found = find_header(head, "Date:");
+ if (found)
+ text[col] = header_get_value(found);
+ else
+ text[col] = g_strdup("");
+ col++;
if (config.ml_server == 1) {
found = find_header(head, "Server:");
===================================================================
RCS file: /cvsroot/corem/core/src/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- main.c 2000/11/23 02:23:03 1.15
+++ main.c 2000/11/30 22:28:21 1.16
@@ -6,9 +6,9 @@
#include <sys/types.h>
#define PREFIX "/usr"
+gchar *theme, *title;
GtkWidget *message_pane;
ConfigData config;
-gchar *title;
GtkWidget *main_win;
GtkWidget *mhandle;
GtkWidget *thandle;
@@ -18,7 +18,6 @@
GtkWidget *reply;
GtkWidget *reply_all;
GtkWidget *forward;
-gchar *theme;
int main(int argc, char **argv)
{
@@ -93,8 +92,6 @@
thandle = gtk_handle_box_new();
create_main_toolbar();
-
-
hpane = gtk_hpaned_new();
{
@@ -118,6 +115,7 @@
gtk_box_pack_start(GTK_BOX(main_vbox), thandle, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(main_vbox), hpane, TRUE, TRUE, 0);
+
gtk_widget_show_all(main_win);
if (config.tb_show == 0) {
@@ -160,6 +158,10 @@
g_strconcat(CORE_SHARE, "/themes/", config.theme, "/",
NULL);
return TRUE;
+ }
+
+ else {
+ create_error_window(g_strdup("ERROR"), g_strdup("Theme not found"), g_strdup("Quit"));
}
return FALSE;
===================================================================
RCS file: /cvsroot/corem/core/src/menus.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- menus.c 2000/11/23 09:32:12 1.10
+++ menus.c 2000/11/30 22:28:21 1.11
@@ -46,7 +46,7 @@
*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;
+ *mserver;
GSList *radio_buttons = NULL;
GSList *mline_radio = NULL;
GSList *fline_radio = NULL;
@@ -265,28 +265,6 @@
gtk_menu_append(GTK_MENU(message_listmenu), mscore);
if (config.ml_score == 1)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mscore),
- TRUE);
-
- mfrom = gtk_check_menu_item_new_with_label("Show From");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mfrom), FALSE);
- gtk_menu_append(GTK_MENU(message_listmenu), mfrom);
- if (config.ml_from == 1)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mfrom),
- TRUE);
-
- msubject = gtk_check_menu_item_new_with_label("Show Subject");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(msubject),
- FALSE);
- gtk_menu_append(GTK_MENU(message_listmenu), msubject);
- if (config.ml_subject == 1)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
- (msubject), TRUE);
-
- mdate = gtk_check_menu_item_new_with_label("Show Date");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mdate), FALSE);
- gtk_menu_append(GTK_MENU(message_listmenu), mdate);
- if (config.ml_date == 1)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mdate),
TRUE);
mserver = gtk_check_menu_item_new_with_label("Show Server");
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- panes.c 2000/11/26 23:32:45 1.18
+++ panes.c 2000/11/30 22:28:21 1.19
@@ -135,24 +135,18 @@
iserver;
gchar **text = NULL;
- if (config.ml_from == 1) {
- field_titles[col] = "From";
- ifrom = col;
- col++;
- }
-
- if (config.ml_subject == 1) {
- field_titles[col] = "Subject";
- isubject = col;
- col++;
- }
+ field_titles[col] = "From";
+ ifrom = col;
+ col++;
+
+ field_titles[col] = "Subject";
+ isubject = col;
+ col++;
+
+ field_titles[col] = "Date";
+ idate = 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;
@@ -195,22 +189,16 @@
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,
237);
gtk_clist_set_column_auto_resize(GTK_CLIST(mail_ctree),
ifrom, FALSE);
- }
- if (config.ml_subject == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), isubject,
175);
- }
- if (config.ml_date == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), idate,
150);
- }
if (config.ml_server == 1) {
gtk_clist_set_column_width(GTK_CLIST(mail_ctree), iserver,
|
|
From: CORE C. L. <cor...@li...> - 2000-11-27 10:12:14
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c prefs.c
Log Message:
cant remember what ive changed, cant be to much ;=)
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- callbacks.c 2000/11/26 23:32:44 1.32
+++ callbacks.c 2000/11/27 10:12:11 1.33
@@ -175,6 +175,7 @@
*tmp_username, *tmp_password, *tmp_server, *tmp_path;
gchar **text = NULL;
+ /* Get the values from the entry boxes */
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));
@@ -183,6 +184,7 @@
tmp_server = gtk_entry_get_text(GTK_ENTRY(server));
tmp_path = gtk_entry_get_text(GTK_ENTRY(path));
+ /* Check and make sure everything is filled in */
if ((tmp_folder_name == NULL || *tmp_folder_name == '\0') &&
(tmp_full_name == NULL || *tmp_full_name == '\0') &&
(tmp_email_address == NULL || *tmp_email_address == '\0') &&
@@ -196,19 +198,30 @@
g_strdup("OK"));
return;
}
+
+ /* Make a new account, this only frees the Account data */
acct = new_account();
+ /* Set the foldername */
account_set_name(acct, tmp_folder_name);
+ /* Set the full name */
account_set_fullname(acct, tmp_full_name);
+ /* Set the email address */
account_set_address(acct, tmp_email_address);
/*acct->type = gtk_entry_get_text(GTK_ENTRY(type)); */
+ /* Set username */
account_set_username(acct, tmp_username);
+ /* Set password */
account_set_password(acct, tmp_password);
+ /* Set server */
account_set_server(acct, tmp_server);
+ /* Set path */
account_set_path(acct, tmp_path);
+ /* Write the account */
account_write(acct);
+ /* Make sure there isnt anything in text, or malloc text[] */
if (text) {
if (text[0])
g_free(text[0]);
@@ -220,13 +233,16 @@
g_free(text[3]);
} else text = (char **) g_malloc(4 * sizeof(char *));
+ /* Set the text in text array */
text[0] = account_get_name(acct);
text[1] = account_get_fullname(acct);
text[2] = account_get_address(acct);
text[3] = account_get_path(acct);
+ /* Insert text[] into account_clist */
gtk_clist_insert(GTK_CLIST(account_clist), 4, text);
+ /* Make sure there isnt anything in text, or malloc text[] */
if (text) {
if (text[0])
g_free(text[0]);
@@ -244,8 +260,18 @@
gtk_ctree_insert_node(GTK_CTREE(folder_ctree), NULL, NULL, text, 0, NULL, NULL, NULL, NULL, FALSE, TRUE);
-
+ /* If everything worked fine we should 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]);
+ }
gtk_widget_destroy(accounts_win_new);
return;
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- prefs.c 2000/11/26 21:28:17 1.9
+++ prefs.c 2000/11/27 10:12:11 1.10
@@ -257,6 +257,7 @@
g_strdup(gtk_entry_get_text(GTK_ENTRY(def_font)));
config.new_font =
g_strdup(gtk_entry_get_text(GTK_ENTRY(new_font)));
+ apply_clicked();
gtk_widget_destroy(pref_win);
}
@@ -269,7 +270,7 @@
font =
gdk_font_load(g_strdup
(gtk_entry_get_text(GTK_ENTRY(def_font))));
- style = gtk_style_copy(gtk_widget_get_style(main_win));
+ style = gtk_style_copy(gtk_widget_get_style(folder_ctree));
gdk_font_unref(style->font);
style->font = font;
gdk_font_ref(style->font);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 23:32:46
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c panes.c
Log Message:
now when you press save in new_account() it checks so you have filled in everything correct, if not a error message displays, if everything is filled in it inserts the new account in the account_window clist and in the folder_ctree, somehow it doesnt save the data? prehaps something wrong with account_write() prehaps i can check it later, need to fix that and fix check_for_new_mail to change the pixmaps in the nodes wich have new messages, to folder_closed_new.xpm and folder_open_new.xpm
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- callbacks.c 2000/11/26 21:28:17 1.31
+++ callbacks.c 2000/11/26 23:32:44 1.32
@@ -8,6 +8,7 @@
Account *current_mbox;
extern GtkWidget *mail_ctree;
+extern GtkWidget *account_clist;
extern GtkWidget *main_win;
extern ConfigData config;
extern gchar *title;
@@ -109,6 +110,7 @@
/* Password entry */
password = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(password), "");
+ gtk_entry_set_visibility(GTK_ENTRY(password), FALSE);
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);
@@ -171,8 +173,8 @@
Account *acct;
gchar *tmp_folder_name, *tmp_full_name, *tmp_email_address,
*tmp_username, *tmp_password, *tmp_server, *tmp_path;
+ gchar **text = NULL;
-
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));
@@ -180,17 +182,14 @@
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 */ ) {
+
+ if ((tmp_folder_name == NULL || *tmp_folder_name == '\0') &&
+ (tmp_full_name == NULL || *tmp_full_name == '\0') &&
+ (tmp_email_address == NULL || *tmp_email_address == '\0') &&
+ (tmp_username == NULL || *tmp_username == '\0') &&
+ (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"),
@@ -209,6 +208,44 @@
account_set_path(acct, tmp_path);
account_write(acct);
+
+ 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(acct);
+ text[1] = account_get_fullname(acct);
+ text[2] = account_get_address(acct);
+ text[3] = account_get_path(acct);
+
+ gtk_clist_insert(GTK_CLIST(account_clist), 4, 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]);
+ } else text = (char **) g_malloc(4 * sizeof(char *));
+
+ text[0] = account_get_name(acct);
+ text[1] = g_strdup("0");
+ text[2] = g_strdup("0");
+
+
+ gtk_ctree_insert_node(GTK_CTREE(folder_ctree), NULL, NULL, text, 0, NULL, NULL, NULL, NULL, FALSE, TRUE);
+
+
gtk_widget_destroy(accounts_win_new);
return;
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- panes.c 2000/11/26 21:28:17 1.17
+++ panes.c 2000/11/26 23:32:45 1.18
@@ -6,7 +6,7 @@
ConfigData config;
GtkWidget *mail_ctree;
GtkWidget *folder_ctree;
-GtkWidget *clist;
+GtkWidget *account_clist;
extern GtkWidget *main_win;
extern GtkWidget *hpane;
extern gchar *theme;
@@ -333,8 +333,8 @@
gtk_container_add(GTK_CONTAINER(accounts_win), main_vbox);
/* 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);
+ account_clist = gtk_clist_new_with_titles(4, titles);
+ gtk_box_pack_start(GTK_BOX(main_vbox), account_clist, TRUE, TRUE, 0);
account_reset_dir();
i = 0;
@@ -356,8 +356,8 @@
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,
+ gtk_clist_insert(GTK_CLIST(account_clist), i, text);
+ gtk_clist_set_row_data_full(GTK_CLIST(account_clist), i,
mbox,
(GtkDestroyNotify)
destroy_account);
@@ -373,10 +373,10 @@
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);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(account_clist), 0, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(account_clist), 1, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(account_clist), 2, TRUE);
+ gtk_clist_set_column_auto_resize(GTK_CLIST(account_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...@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 11:39:18
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c callbacks.h core.h panes.c prefs.c
Log Message:
added some colors to the error msg in the console, made new messages apear with a diffrent font in the mail_ctree, fixed the account listing in accounts_window look nice =), created a create_error_window() wich is used for creating warning windows..... ask in the core-devel list if you want to know more about it.... cant remember anything more =) here goes, im to tired to write what ive dont after your update.... but its - all you did
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- callbacks.c 2000/11/26 00:48:11 1.29
+++ callbacks.c 2000/11/26 11:39:17 1.30
@@ -168,27 +168,81 @@
void save_account()
{
- Account *acct;
+ 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);
- acct = new_account();
+ account_write(acct);
- 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)));
+ gtk_widget_destroy(accounts_win_new);
+ return;
+}
- account_write(acct);
+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);
- gtk_widget_destroy(accounts_win_new);
- return;
+ 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)
@@ -334,6 +388,8 @@
int folder_selected(GtkWidget * list, GList * node, gint col,
gpointer data)
{
+ GtkStyle *style;
+ GdkFont *font;
GdkBitmap *bitmap;
GdkColormap *colormap;
GdkPixmap *pixmap;
@@ -465,6 +521,17 @@
pixmap, bitmap);
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);
}
}
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- callbacks.h 2000/11/23 09:32:12 1.12
+++ callbacks.h 2000/11/26 11:39:17 1.13
@@ -67,3 +67,5 @@
/* Function for checking for new messages. */
void check_for_new_mail(int signum);
+
+void create_error_window(gchar * title, gchar * text, gchar * button_text);
===================================================================
RCS file: /cvsroot/corem/core/src/core.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- core.h 2000/11/23 01:08:37 1.9
+++ core.h 2000/11/26 11:39:17 1.10
@@ -1,3 +1,4 @@
+
#include <dirent.h>
#include <gtk/gtk.h>
#include <stdio.h>
@@ -23,3 +24,8 @@
gboolean ml_linestyle;
gboolean fl_linestyle;
} ConfigData;
+
+#define RED "[1;31m"
+#define GREEN "[1;32m"
+#define YELLOW "[1;33m"
+#define BLUE "[1;34m"
===================================================================
RCS file: /cvsroot/corem/core/src/panes.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- panes.c 2000/11/26 09:29:43 1.14
+++ panes.c 2000/11/26 11:39:17 1.15
@@ -39,7 +39,8 @@
GTK_SIGNAL_FUNC(folder_unselected), NULL);
if (!text || !text[0] || !text[1] || !text[2]) {
- fprintf(stderr, "ERROR: Malloc failed, Exiting....\n");
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
@@ -270,13 +271,15 @@
text = (char **) g_malloc(5 * sizeof(char *));
if (!text) {
- fprintf(stderr, "ERROR: Malloc failed, Exiting....\n");
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
text[1] = g_strdup("Message In Thread");
if (!text) {
- fprintf(stderr, "ERROR: Malloc failed, Exiting....\n");
+ fprintf(stderr, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
exit(-1);
}
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- prefs.c 2000/11/26 01:52:04 1.7
+++ prefs.c 2000/11/26 11:39:17 1.8
@@ -343,7 +343,7 @@
("-schumacher-clean-medium-r-normal-*-*-120-*-*-c-*-iso8859-1");
config.new_font =
g_strdup
- ("-schumacher-clean-bold-r-normal-*-*-140-*-*-c-*-iso646.1991-irv");
+ ("-schumacher-clean-bold-r-normal-*-*-120-*-*-c-*-iso646.1991-irv");
config.ml_priority = 0;
config.ml_read = 1;
config.ml_attachment = 1;
@@ -417,8 +417,8 @@
rc = g_strconcat(home, "/.corerc", NULL);
config_file = fopen(rc, "w");
if (config_file == NULL) {
- fprintf(config_file,
- "ERROR: Cannot write to config file\n");
+ fprintf(config_file, "%sERROR: %sMalloc failed, Exiting....\n",
+ RED, GREEN);
return;
}
|
|
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 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 02:15:02
|
Core CVS committal Author : smugg Project : core Module : themes Added Files: Makefile.am attachment.xpm folder_closed_new.xpm folder_closed_normal.xpm folder_open_new.xpm folder_open_normal.xpm forward.xpm icon.xpm load.xpm logo.xpm new.xpm read.xpm reply-all.xpm reply.xpm send-recieve.xpm trash.xpm Log Message: forgot to add the xpms in themes/Default |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:52:34
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
Makefile.am prefs.c
Log Message:
reorganized some in the repository..... you should remove your $HOME/.corerc for this update to work, now make install works perfectly
===================================================================
RCS file: /cvsroot/corem/core/src/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- Makefile.am 2000/11/25 23:54:24 1.5
+++ Makefile.am 2000/11/26 01:52:04 1.6
@@ -1,7 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-SUBDIRS = pixmaps
-
CFLAGS = -g -W -Wall -Wno-implicit
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
===================================================================
RCS file: /cvsroot/corem/core/src/prefs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- prefs.c 2000/11/23 01:08:37 1.6
+++ prefs.c 2000/11/26 01:52:04 1.7
@@ -354,7 +354,7 @@
config.ml_server = 0;
config.ml_linestyle = 2;
config.fl_linestyle = 2;
- config.theme = g_strdup("default");
+ config.theme = g_strdup("Default");
home = getenv("HOME");
rc = g_strconcat(home, "/.corerc", NULL);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:52:34
|
Core CVS committal Author : smugg Module : core Modified Files: Makefile.am configure.in Log Message: reorganized some in the repository..... you should remove your $HOME/.corerc for this update to work, now make install works perfectly =================================================================== RCS file: /cvsroot/corem/core/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- Makefile.am 2000/11/21 22:45:01 1.2 +++ Makefile.am 2000/11/26 01:52:04 1.3 @@ -1,6 +1,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign MAINTAINERCLEANFILES = Makefile.in core.spec +SUBDIRS = src themes GTK_CFLAGS = $(GTK_CFLAGS) GTK_LIBS = $(GTK_LIBS) @@ -11,5 +12,3 @@ docsdir = $(prefix)/doc/core EXTRADIST = core.spec $(docs_DATA) - -SUBDIRS = src =================================================================== RCS file: /cvsroot/corem/core/configure.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- configure.in 2000/11/25 23:54:24 1.5 +++ configure.in 2000/11/26 01:52:04 1.6 @@ -28,5 +28,6 @@ AC_OUTPUT( Makefile \ src/Makefile \ -src/pixmaps/Makefile +themes/Makefile \ +themes/Default/Makefile ) |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:52:04
|
Core CVS committal Author : smugg Project : core Module : src Removed Files: Makefile.am attachment.xpm folder_closed_new.xpm folder_closed_normal.xpm folder_open_new.xpm folder_open_normal.xpm forward.xpm icon.xpm load.xpm logo.xpm new.xpm read.xpm reply-all.xpm reply.xpm send-recieve.xpm trash.xpm Log Message: reorganized some in the repository..... you should remove your $HOME/.corerc for this update to work, now make install works perfectly |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:52:04
|
Core CVS committal Author : smugg Project : core Module : themes Added Files: Makefile.am Log Message: reorganized some in the repository..... you should remove your $HOME/.corerc for this update to work, now make install works perfectly |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:04:45
|
Core CVS committal Author : smugg Project : core Module : themes Log Message: Directory /cvsroot/corem/core/themes/Default added to the repository |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 01:00:13
|
Core CVS committal Author : smugg Project : core Module : themes Log Message: Directory /cvsroot/corem/core/themes added to the repository |
|
From: CORE C. L. <cor...@li...> - 2000-11-26 00:48:11
|
Core CVS committal
Author : smugg
Project : core
Module : src
Modified Files:
callbacks.c
Log Message:
no change
===================================================================
RCS file: /cvsroot/corem/core/src/callbacks.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- callbacks.c 2000/11/25 19:11:52 1.28
+++ callbacks.c 2000/11/26 00:48:11 1.29
@@ -534,11 +534,10 @@
/* Function for checking folders for new mail */
void check_for_new_mail(int signum)
{
- int i;
- char *temp;
+ gint i;
+ gchar *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);
@@ -551,11 +550,11 @@
}
asprintf(&temp, "%d", account_get_num_messages(mbox));
gtk_ctree_node_set_text(GTK_CTREE(folder_ctree), node, 1, temp);
- free(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);
- free(temp);
+ g_free(temp);
}
signal(SIGALRM, check_for_new_mail);
|
|
From: CORE C. L. <cor...@li...> - 2000-11-25 23:54:55
|
Core CVS committal Author : smugg Project : core Module : src Modified Files: Makefile.am Log Message: fixed so make install is workable... next step is to make core do a accountsfile by itself if no accountsfile exists =================================================================== RCS file: /cvsroot/corem/core/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- Makefile.am 2000/11/21 23:25:47 1.4 +++ Makefile.am 2000/11/25 23:54:24 1.5 @@ -1,5 +1,7 @@ MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = pixmaps + CFLAGS = -g -W -Wall -Wno-implicit GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ |
|
From: CORE C. L. <cor...@li...> - 2000-11-25 23:54:55
|
Core CVS committal Author : smugg Module : core Modified Files: configure.in Log Message: fixed so make install is workable... next step is to make core do a accountsfile by itself if no accountsfile exists =================================================================== RCS file: /cvsroot/corem/core/configure.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- configure.in 2000/11/22 18:55:23 1.4 +++ configure.in 2000/11/25 23:54:24 1.5 @@ -28,4 +28,5 @@ AC_OUTPUT( Makefile \ src/Makefile \ +src/pixmaps/Makefile ) |
|
From: CORE C. L. <cor...@li...> - 2000-11-25 23:54:29
|
Core CVS committal Author : smugg Project : core Module : src Added Files: Makefile.am Log Message: fixed so make install is workable... next step is to make core do a accountsfile by itself if no accountsfile exists |