Really Minor Patch. :)
- From: Mathieu Fenniak <laotzu pobox com>
- To: balsa-list gnome org
- Subject: Really Minor Patch. :)
- Date: Mon, 14 Jun 1999 09:11:30 -0600
The attached minor patch adds a popt table to be parsed, and the command line
option -c --checkmail to check mail upon startup, just as if you had hit the
check mail button. This patch also includes updates to the address book patch I
recently sent here, and thus that patch is needed for this to work. It adds
functionality to the 'Import' button (now 'Re-Import'), and changes the add
button to a 'Run GnomeCard' button that doesn't function completely. (Can
someone find out why? I don't know much about forking and using execlp, or
whatever I used. :)
This patch also adds a small dialog while checking mail which isn't ideal
presently. Basically I wanted to send this out for the changes to the address
book, and so that I could get some feedback on the gnomecard thing. (Btw, I
will be adding support for Gaby import soon. Also simple file-reading support.
CORBA would be nice but it's not something I can do.)
PS: Wow, a plug in the gnome summary for the week. Impressive considering there
isn't that much development work yet. :)
---
Mathieu Fenniak
laotzu@pobox.com
diff -urP balsa-old/src/address-book.c balsa/src/address-book.c
--- balsa-old/src/address-book.c Mon Jun 14 08:53:16 1999
+++ balsa/src/address-book.c Mon Jun 14 09:08:42 1999
@@ -14,6 +14,19 @@
} AddressData;
gint
+ab_gnomecard_cb(GtkWidget * widget, gpointer data)
+{
+ gint forkpid;
+
+ forkpid = fork();
+
+ if (forkpid == 0) {
+ execlp("gnomecard", NULL);
+ }
+ return FALSE;
+}
+
+gint
ab_cancel_cb(GtkWidget * widget, gpointer data)
{
GnomeDialog *dialog = (GnomeDialog *) data;
@@ -29,7 +42,7 @@
{
gpointer row;
gchar *text;
- gchar new[512];
+ gchar new[512];
if (composing) {
@@ -45,13 +58,26 @@
gtk_clist_remove(GTK_CLIST(add_clist), 0);
}
- gtk_entry_set_text(GTK_ENTRY(ab_entry), new);
+ gtk_entry_set_text(GTK_ENTRY(ab_entry), new);
}
ab_cancel_cb(widget, data);
return FALSE;
}
+void
+ab_clear_clist(GtkCList * clist)
+{
+ gpointer row;
+ while (row = gtk_clist_get_row_data(clist, 0)) {
+ AddressData *addy = (AddressData *) row;
+ free(addy->name);
+ free(addy->addy);
+ g_free(addy);
+ gtk_clist_remove(GTK_CLIST(clist), 0);
+ }
+}
+
gint
ab_delete_compare(gconstpointer a, gconstpointer b)
{
@@ -101,7 +127,7 @@
}
void
-ab_load()
+ab_load(GtkWidget * widget, gpointer data)
{
FILE *gc;
gchar name[256],
@@ -110,6 +136,10 @@
*listdata[2];
gint got_name = FALSE;
+ ab_clear_clist(GTK_CLIST(book_clist));
+ if (composing)
+ ab_clear_clist(GTK_CLIST(add_clist));
+
gc = fopen(gnome_util_prepend_user_home(".gnome/GnomeCard.gcrd"), "r");
if (!gc) {
g_print(N_("Unable to open ~/.gnome/GnomeCard.gcrd for read.\n - %s\n"), g_unix_error_string(errno));
@@ -245,13 +275,14 @@
hbox = gtk_hbutton_box_new();
gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_START);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
- w = gnome_pixmap_button(gnome_stock_pixmap_widget(dialog, GNOME_STOCK_PIXMAP_ADD), N_("Add New Entry"));
- gtk_signal_connect(GTK_OBJECT(w), "clicked", GTK_SIGNAL_FUNC(ab_add_cb), book_clist);
+ w = gnome_pixmap_button(gnome_pixmap_new_from_file(gnome_unconditional_pixmap_file("gnome-card.xpm")), N_("Run GnomeCard"));
+ gtk_signal_connect(GTK_OBJECT(w), "clicked", GTK_SIGNAL_FUNC(ab_gnomecard_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), w);
- w = gnome_pixmap_button(gnome_stock_pixmap_widget(dialog, GNOME_STOCK_PIXMAP_ADD), N_("Import New Entries"));
+ w = gnome_pixmap_button(gnome_stock_pixmap_widget(dialog, GNOME_STOCK_PIXMAP_ADD), N_("Re-Import"));
+ gtk_signal_connect(GTK_OBJECT(w), "clicked", GTK_SIGNAL_FUNC(ab_load), NULL);
gtk_container_add(GTK_CONTAINER(hbox), w);
- ab_load(book_clist);
+ ab_load(NULL, NULL);
gtk_widget_show_all(dialog);
diff -urP balsa-old/src/balsa-app.h balsa/src/balsa-app.h
--- balsa-old/src/balsa-app.h Mon Jun 14 08:53:16 1999
+++ balsa/src/balsa-app.h Mon Jun 14 08:53:53 1999
@@ -88,6 +88,8 @@
/* arp --- string to prefix "replied to" messages. */
gchar *quote_str;
+
+ gint check_mail_upon_startup;
}
balsa_app;
diff -urP balsa-old/src/main-window.c balsa/src/main-window.c
--- balsa-old/src/main-window.c Mon Jun 14 08:53:16 1999
+++ balsa/src/main-window.c Mon Jun 14 08:53:44 1999
@@ -312,6 +312,9 @@
gnome_app_install_menu_hints(mdi->active_window,
gnome_mdi_get_menubar_info(mdi->active_window));
+
+ if (balsa_app.check_mail_upon_startup)
+ check_new_messages_cb(NULL, NULL);
}
static gint
@@ -435,11 +438,24 @@
static void
check_new_messages_cb (GtkWidget * widget, gpointer data)
{
+ GtkWidget *dialog, *w;
+
+ dialog = gnome_dialog_new("Checking Mail...", GNOME_STOCK_BUTTON_OK, NULL);
+ gnome_dialog_set_close(GNOME_DIALOG(dialog), TRUE);
+
+ w = gtk_label_new("Checking Mail....");
+ gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), w, FALSE, FALSE, 0);
+
+ gtk_widget_show_all(dialog);
+
check_all_pop3_hosts (balsa_app.inbox, balsa_app.inbox_input);
check_all_imap_hosts (balsa_app.inbox, balsa_app.inbox_input);
if (balsa_app.current_index_child != NULL)
mailbox_check_new_messages (BALSA_INDEX (balsa_app.current_index_child->index)->mailbox);
+
+ gtk_label_set_text(GTK_LABEL(w), N_("Checked."));
+// gtk_widget_destroy(dialog);
}
static void
diff -urP balsa-old/src/main.c balsa/src/main.c
--- balsa-old/src/main.c Mon Jun 14 08:53:16 1999
+++ balsa/src/main.c Mon Jun 14 08:53:44 1999
@@ -74,11 +74,15 @@
balsa_mail_send balsa_servant;
PortableServer_POA root_poa;
PortableServer_POAManager pm;
+ static struct poptOption options[] = {
+ {"checkmail", 'c', POPT_ARG_NONE, &(balsa_app.check_mail_upon_startup), 0, N_("Get new mail on startup"), NULL},
+ {NULL, '\0', 0, NULL, 0} /* end the list */
+ };
CORBA_exception_init (&ev);
- orb = gnome_CORBA_init ("balsa", VERSION,
- &argc, argv,
+ orb = gnome_CORBA_init_with_popt_table ("balsa", VERSION,
+ &argc, argv, options, 0, NULL,
GNORBA_INIT_SERVER_FUNC,
&ev);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]