[PATCH] : cleanups
- From: Emmanuel <e allaud wanadoo fr>
- To: balsa-list gnome org
- Subject: [PATCH] : cleanups
- Date: Sun, 3 Mar 2002 17:48:51 +0100
Hi all,
here is a small patch that cleans up a bit balsa-index : I stripped out
useless functions, made some others "static". So no big deal.
The other part of the patch cleans up a bit filter/search functions (+ it
corrects the "design" of search and filters dialog box, if I can say
"design" here ;-). Changes are straightforward.
Bye
Manu
Common subdirectories: ../balsa-cvs/balsa/src/CVS and balsa-cvs/balsa/src/CVS
Only in balsa-cvs/balsa/src/: Makefile.in
diff -u ../balsa-cvs/balsa/src/balsa-index.c balsa-cvs/balsa/src/balsa-index.c
--- ../balsa-cvs/balsa/src/balsa-index.c Sat Mar 2 12:36:19 2002
+++ balsa-cvs/balsa/src/balsa-index.c Sun Mar 3 16:15:43 2002
@@ -119,8 +119,14 @@
static void refresh_date(GtkCTree * ctree,
GtkCTreeNode *node,
gpointer data);
+static void balsa_index_set_sort_order(BalsaIndex * bindex, int column,
+ GtkSortType order);
+static void balsa_index_set_first_new_message(BalsaIndex * bindex);
+/* adds a new message */
+static void balsa_index_add(BalsaIndex * bindex, LibBalsaMessage * message);
+static void balsa_index_select_row(BalsaIndex * bindex, gint row);
/* mailbox callbacks */
static void balsa_index_del (BalsaIndex * bindex, LibBalsaMessage * message);
@@ -1623,45 +1629,6 @@
gtk_clist_thaw(GTK_CLIST(bindex->ctree));
}
-/*
- * get_selected_rows :
- *
- * return the rows currently selected in the index
- *
- * @bindex : balsa index widget to retrieve the selection from
- * @rows : a pointer on the return array of rows. This array will
- * contain the selected rows.
- * @nb_rows : a pointer on the returned number of selected rows
- *
- */
-void
-balsa_index_get_selected_rows(BalsaIndex * bindex, GtkCTreeNode ***rows,
- guint * nb_rows)
-{
- GList *list_of_selected_rows;
- GtkCList *clist;
- guint nb_selected_rows;
- GtkCTreeNode **selected_rows;
- guint row_count;
-
- clist = GTK_CLIST(bindex->ctree);
-
- /* retreive the selection */
- list_of_selected_rows = clist->selection;
- nb_selected_rows = g_list_length(list_of_selected_rows);
-
- selected_rows = (GtkCTreeNode **) g_malloc(nb_selected_rows * sizeof(GtkCTreeNode *));
- for (row_count = 0; row_count < nb_selected_rows; row_count++) {
- selected_rows[row_count] = (GtkCTreeNode *) (list_of_selected_rows->data);
- list_of_selected_rows = list_of_selected_rows->next;
- }
-
- /* return the result of the search */
- *nb_rows = nb_selected_rows;
- *rows = selected_rows;
-
- return;
-}
/* balsa_index_close_and_destroy:
*/
diff -u ../balsa-cvs/balsa/src/balsa-index.h balsa-cvs/balsa/src/balsa-index.h
--- ../balsa-cvs/balsa/src/balsa-index.h Fri Feb 8 09:03:34 2002
+++ balsa-cvs/balsa/src/balsa-index.h Sun Mar 3 16:17:46 2002
@@ -78,15 +78,9 @@
* contents is loaded into the index */
gboolean balsa_index_load_mailbox_node(BalsaIndex * bindex,
BalsaMailboxNode * mbnode);
- void balsa_index_refresh(BalsaIndex * bindex);
void balsa_index_update_tree(BalsaIndex *bindex, gboolean expand);
void balsa_index_set_threading_type(BalsaIndex * bindex, int thtype);
- void balsa_index_set_sort_order(BalsaIndex * bindex, int column,
- GtkSortType order);
- void balsa_index_set_first_new_message(BalsaIndex * bindex);
-/* adds a new message */
- void balsa_index_add(BalsaIndex * bindex, LibBalsaMessage * message);
void balsa_index_redraw_current(BalsaIndex *);
/* move or copy a list of messages */
@@ -100,18 +94,11 @@
void balsa_index_select_next_unread(BalsaIndex * bindex);
void balsa_index_select_next_flagged(BalsaIndex * bindex);
void balsa_index_select_previous(BalsaIndex *);
- void balsa_index_select_row(BalsaIndex * bindex, gint row);
#ifdef BALSA_SHOW_ALL
void balsa_index_find(BalsaIndex * bindex,gint op,GSList * conditions,gboolean previous);
#endif /* BALSA_SHOW_ALL */
-/* retrieve the selection */
- void balsa_index_get_selected_rows(BalsaIndex * bindex,
- GtkCTreeNode *** rows,
- guint * nb_rows);
-
-
/* balsa index page stuff */
void balsa_message_reply(GtkWidget * widget, gpointer user_data);
void balsa_message_replytoall(GtkWidget * widget, gpointer user_data);
@@ -119,7 +106,6 @@
void balsa_message_forward_attached(GtkWidget * widget, gpointer data);
void balsa_message_forward_inline(GtkWidget * widget, gpointer data);
- void balsa_message_forward_quoted(GtkWidget * widget, gpointer data);
void balsa_message_forward_default(GtkWidget * widget, gpointer data);
void balsa_message_continue(GtkWidget * widget, gpointer data);
@@ -130,7 +116,6 @@
void balsa_message_toggle_flagged(GtkWidget * widget, gpointer user_data);
void balsa_message_toggle_new(GtkWidget * widget, gpointer user_data);
- void balsa_index_reset(BalsaIndex * index);
gint balsa_find_notebook_page_num(LibBalsaMailbox * mailbox);
void balsa_index_update_message(BalsaIndex * index);
Only in balsa-cvs/balsa/src/: balsa-index.h~
diff -u ../balsa-cvs/balsa/src/filter-edit-callbacks.c balsa-cvs/balsa/src/filter-edit-callbacks.c
--- ../balsa-cvs/balsa/src/filter-edit-callbacks.c Wed Jan 30 17:49:23 2002
+++ balsa-cvs/balsa/src/filter-edit-callbacks.c Sun Mar 3 16:38:11 2002
@@ -583,35 +583,32 @@
if (!condition_validate(new_cnd))
return;
/* No error occured, condition is valid, so change/add it
- * based on is_new_condition and only if something has
- * changed of course */
- if (condition_has_changed) {
- if (!is_new_condition) {
- /* We free the old condition*/
- row=GPOINTER_TO_INT(fe_conditions_list->selection->data);
- libbalsa_condition_free((LibBalsaCondition*)
- gtk_clist_get_row_data(fe_conditions_list,row));
- }
- else {
- gchar * str[]={""};
- /* It was a new condition, so add it to the list */
- row=gtk_clist_append(fe_conditions_list,str);
- gtk_clist_select_row(fe_conditions_list,row,-1);
- /* We make the buttons sensitive if they were
- unsensitive */
- if (fe_conditions_list->rows==1) {
- gtk_widget_set_sensitive(fe_condition_delete_button,
- TRUE);
- gtk_widget_set_sensitive(fe_condition_edit_button,
- TRUE);
- }
- }
- /* Associate the new condition to the row in the clist*/
- gtk_clist_set_row_data(fe_conditions_list,row,new_cnd);
- /* And refresh the conditions list */
- update_condition_list_label();
- }
- }
+ * based on is_new_condition */
+ if (!is_new_condition) {
+ /* We free the old condition*/
+ row=GPOINTER_TO_INT(fe_conditions_list->selection->data);
+ libbalsa_condition_free((LibBalsaCondition*)
+ gtk_clist_get_row_data(fe_conditions_list,row));
+ }
+ else {
+ gchar * str[]={""};
+ /* It was a new condition, so add it to the list */
+ row=gtk_clist_append(fe_conditions_list,str);
+ gtk_clist_select_row(fe_conditions_list,row,-1);
+ /* We make the buttons sensitive if they were
+ unsensitive */
+ if (fe_conditions_list->rows==1) {
+ gtk_widget_set_sensitive(fe_condition_delete_button,
+ TRUE);
+ gtk_widget_set_sensitive(fe_condition_edit_button,
+ TRUE);
+ }
+ }
+ /* Associate the new condition to the row in the clist*/
+ gtk_clist_set_row_data(fe_conditions_list,row,new_cnd);
+ /* And refresh the conditions list */
+ update_condition_list_label();
+ }
case 1: /* Cancel button */
/* we only hide it because it is too expensive to destroy and
rebuild each time */
Only in balsa-cvs/balsa/src/: filter-edit-callbacks.c~
diff -u ../balsa-cvs/balsa/src/filter-edit-dialog.c balsa-cvs/balsa/src/filter-edit-dialog.c
--- ../balsa-cvs/balsa/src/filter-edit-dialog.c Sun Dec 23 09:52:15 2001
+++ balsa-cvs/balsa/src/filter-edit-dialog.c Sun Mar 3 17:11:15 2002
@@ -178,7 +178,7 @@
static GtkWidget *
build_left_side(void)
{
- GtkWidget *vbox, *bbox, *button;
+ GtkWidget *vbox, *bbox, *button, *frame;
GtkWidget *pixmap;
GtkWidget *sw;
@@ -197,7 +197,11 @@
| -- -- |
\--------/
*/
+ frame = gtk_frame_new(_("Filters list:"));
+ gtk_frame_set_label_align(GTK_FRAME(frame), GTK_POS_LEFT, GTK_POS_TOP);
+ gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_IN);
vbox = gtk_vbox_new(FALSE, 2);
+ gtk_container_add(GTK_CONTAINER(frame),vbox);
/* the clist */
gtk_widget_push_visual(gdk_rgb_get_visual());
@@ -253,7 +257,7 @@
gtk_container_add(GTK_CONTAINER(bbox), fe_delete_button);
gtk_widget_set_sensitive(fe_delete_button,FALSE);
- return vbox;
+ return frame;
} /* end build_left_side() */
/* Used to populate mailboxes option menu */
@@ -521,7 +525,6 @@
{
GtkWidget *hbox;
GtkWidget *piece;
- GtkWidget *sep;
gint row;
LibBalsaFilter * cpfil,* fil;
GSList * cnds,* filter_list;
@@ -557,8 +560,7 @@
gtk_box_pack_start(GTK_BOX(hbox), piece, FALSE, FALSE, 2);
- sep = gtk_vseparator_new();
- gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 2);
+ gtk_box_pack_start(GTK_BOX(hbox), gtk_vseparator_new(), FALSE, FALSE, 2);
piece = build_right_side();
gtk_box_pack_start(GTK_BOX(hbox), piece, FALSE, FALSE, 2);
Only in balsa-cvs/balsa/src/: filter-edit-dialog.c~
diff -u ../balsa-cvs/balsa/src/main-window.c balsa-cvs/balsa/src/main-window.c
--- ../balsa-cvs/balsa/src/main-window.c Wed Feb 27 14:04:19 2002
+++ balsa-cvs/balsa/src/main-window.c Sun Mar 3 17:41:17 2002
@@ -2543,8 +2543,6 @@
static void
find_real(BalsaIndex * bindex,gboolean again)
{
- /* FIXME : later we could do a search based on a complete filter */
- static LibBalsaFilter * f=NULL;
/* Condition set up for the search, it will be of type
CONDITION_NONE if nothing has been set up */
static LibBalsaCondition * cnd=NULL;
@@ -2565,42 +2563,30 @@
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL));
- GtkWidget *reverse_button, *search_entry, *w, *page, *table;
+ GtkWidget *reverse_button, *search_entry, *w, *table;
GtkToggleButton *matching_body, *matching_from;
GtkToggleButton *matching_to, *matching_cc, *matching_subject;
gint ok;
gnome_dialog_close_hides(dia,TRUE);
- /* FIXME : we'll set up this callback later when selecting
- filters has been enabled
- gtk_signal_connect(GTK_OBJECT(dia),"clicked",
- find_dialog_button_cb,&f);
- */
- reverse_button = gtk_check_button_new_with_label(_("Reverse search"));
-
- page=gtk_table_new(2, 1, FALSE);
+ table=gtk_table_new(2, 1, FALSE);
w = gtk_label_new(_("Search for:"));
- gtk_table_attach(GTK_TABLE(page),w,0, 1, 0, 1,
+ gtk_table_attach(GTK_TABLE(table),w,0, 1, 0, 1,
GTK_FILL | GTK_SHRINK | GTK_EXPAND, GTK_SHRINK, 2, 2);
search_entry = gtk_entry_new_with_max_length(30);
- gtk_table_attach(GTK_TABLE(page),search_entry,1, 2, 0, 1,
+ gtk_table_attach(GTK_TABLE(table),search_entry,1, 2, 0, 1,
GTK_FILL | GTK_SHRINK | GTK_EXPAND, GTK_SHRINK, 2, 2);
- gtk_box_pack_start(GTK_BOX(dia->vbox), page, FALSE, FALSE, 2);
+ gtk_box_pack_start(GTK_BOX(dia->vbox), table, FALSE, FALSE, 2);
/* builds the toggle buttons to specify fields concerned by
* the search. */
- page = gtk_table_new(3, 7, FALSE);
-
+
w = gtk_frame_new(_("In:"));
gtk_frame_set_label_align(GTK_FRAME(w), GTK_POS_LEFT, GTK_POS_TOP);
gtk_frame_set_shadow_type(GTK_FRAME(w), GTK_SHADOW_ETCHED_IN);
- gtk_table_attach(GTK_TABLE(page),
- w,
- 0, 3, 0, 2,
- GTK_FILL | GTK_SHRINK | GTK_EXPAND, GTK_SHRINK, 5, 5);
-
- table = gtk_table_new(3, 3, TRUE);
+
+ table = gtk_table_new(2, 3, TRUE);
gtk_container_add(GTK_CONTAINER(w), table);
matching_body = add_check_button(table, _("Body"), 0, 0);
@@ -2608,10 +2594,12 @@
matching_from = add_check_button(table, _("From:"), 1, 1);
matching_subject = add_check_button(table, _("Subject"), 2, 0);
matching_cc = add_check_button(table, _("Cc:"), 2, 1);
- gtk_box_pack_start(GTK_BOX(dia->vbox), page, FALSE, FALSE, 2);
+ gtk_box_pack_start(GTK_BOX(dia->vbox), w, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(dia->vbox), gtk_hseparator_new(),
FALSE, FALSE, 2);
+
+ reverse_button = gtk_check_button_new_with_label(_("Reverse search"));
gtk_box_pack_start(GTK_BOX(dia->vbox), reverse_button,TRUE,TRUE,0);
gtk_widget_show_all(dia->vbox);
Only in balsa-cvs/balsa/src/: main-window.c~
Common subdirectories: ../balsa-cvs/balsa/src/pixmaps and balsa-cvs/balsa/src/pixmaps
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]