/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef HAVE_CONFIG_H
# include "config.h"
+#include "claws-features.h"
#endif
#include "defs.h"
/* Basic data tab */
GtkWidget *entry_name;
- GtkCList *clist_group;
- GtkCList *clist_avail;
+ GtkCMCList *clist_group;
+ GtkCMCList *clist_avail;
GHashTable *hashEMail;
}
static gboolean edit_group_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
- if (event && event->keyval == GDK_Escape) {
+ if (event && event->keyval == GDK_KEY_Escape) {
*cancelled = TRUE;
gtk_main_quit();
}
return str;
}
-static gint edit_group_clist_add_email( GtkCList *clist, ItemEMail *email ) {
+static gint edit_group_clist_add_email( GtkCMCList *clist, ItemEMail *email ) {
ItemPerson *person = ( ItemPerson * ) ADDRITEM_PARENT(email);
gchar *str = edit_group_format_item_clist( person, email );
gchar *text[ GROUP_N_COLS ];
text[ GROUP_COL_EMAIL ] = email->address;
text[ GROUP_COL_REMARKS ] = email->remarks;
- row = gtk_clist_append( clist, text );
- gtk_clist_set_row_data( clist, row, email );
+ row = gtk_cmclist_append( clist, text );
+ gtk_cmclist_set_row_data( clist, row, email );
return row;
}
-static void edit_group_load_clist( GtkCList *clist, GList *listEMail ) {
+static void edit_group_load_clist( GtkCMCList *clist, GList *listEMail ) {
GList *node = listEMail;
- gtk_clist_freeze(clist);
+ gtk_cmclist_freeze(clist);
while( node ) {
ItemEMail *email = node->data;
edit_group_clist_add_email( clist, email );
node = g_list_next( node );
}
- gtk_clist_thaw(clist);
+ gtk_cmclist_thaw(clist);
}
-static void edit_group_move_email( GtkCList *clist_from, GtkCList *clist_to, GtkCTreeNode *node ) {
- ItemEMail *email = gtk_ctree_node_get_row_data( GTK_CTREE(clist_from), node );
- GtkCTreeNode *next = gtkut_ctree_node_next(GTK_CTREE(clist_from), node);
- GtkCTreeNode *prev = gtkut_ctree_node_prev(GTK_CTREE(clist_from), node);
+static void edit_group_move_email( GtkCMCList *clist_from, GtkCMCList *clist_to, GtkCMCTreeNode *node ) {
+ ItemEMail *email = gtk_cmctree_node_get_row_data( GTK_CMCTREE(clist_from), node );
+ GtkCMCTreeNode *next = gtkut_ctree_node_next(GTK_CMCTREE(clist_from), node);
+ GtkCMCTreeNode *prev = gtkut_ctree_node_prev(GTK_CMCTREE(clist_from), node);
int rrow = 0;
if( email ) {
- gtk_ctree_remove_node(GTK_CTREE(clist_from), node);
+ gtk_cmctree_remove_node(GTK_CMCTREE(clist_from), node);
rrow = edit_group_clist_add_email( clist_to, email );
- gtk_clist_select_row( clist_to, rrow, 0 );
+ gtk_cmclist_select_row( clist_to, rrow, 0 );
if (next)
- gtk_ctree_select(GTK_CTREE(clist_from), next);
+ gtk_cmctree_select(GTK_CMCTREE(clist_from), next);
else if (prev)
- gtk_ctree_select(GTK_CTREE(clist_from), prev);
+ gtk_cmctree_select(GTK_CMCTREE(clist_from), prev);
}
}
static void edit_group_to_group( GtkWidget *widget, gpointer data ) {
- GList *selected = g_list_copy(GTK_CLIST(groupeditdlg.clist_avail)->selection);
+ GList *selected = g_list_copy(GTK_CMCLIST(groupeditdlg.clist_avail)->selection);
/* Clear the selected rows on destination clist */
- gtk_clist_freeze(groupeditdlg.clist_avail);
- gtk_clist_freeze(groupeditdlg.clist_group);
- gtk_clist_unselect_all(groupeditdlg.clist_group);
+ gtk_cmclist_freeze(groupeditdlg.clist_avail);
+ gtk_cmclist_freeze(groupeditdlg.clist_group);
+ gtk_cmclist_unselect_all(groupeditdlg.clist_group);
while (selected) {
edit_group_move_email( groupeditdlg.clist_avail,
- groupeditdlg.clist_group, GTK_CTREE_NODE(selected->data) );
+ groupeditdlg.clist_group, GTK_CMCTREE_NODE(selected->data) );
selected = selected->next;
}
g_list_free(selected);
- gtk_clist_thaw(groupeditdlg.clist_avail);
- gtk_clist_thaw(groupeditdlg.clist_group);
+ gtk_cmclist_thaw(groupeditdlg.clist_avail);
+ gtk_cmclist_thaw(groupeditdlg.clist_group);
}
static void edit_group_to_avail( GtkWidget *widget, gpointer data ) {
- GList *selected = g_list_copy(GTK_CLIST(groupeditdlg.clist_group)->selection);
- gtk_clist_freeze(groupeditdlg.clist_avail);
- gtk_clist_freeze(groupeditdlg.clist_group);
- gtk_clist_unselect_all(groupeditdlg.clist_avail);
+ GList *selected = g_list_copy(GTK_CMCLIST(groupeditdlg.clist_group)->selection);
+ gtk_cmclist_freeze(groupeditdlg.clist_avail);
+ gtk_cmclist_freeze(groupeditdlg.clist_group);
+ gtk_cmclist_unselect_all(groupeditdlg.clist_avail);
while (selected) {
edit_group_move_email( groupeditdlg.clist_group,
- groupeditdlg.clist_avail, GTK_CTREE_NODE(selected->data) );
+ groupeditdlg.clist_avail, GTK_CMCTREE_NODE(selected->data) );
selected = selected->next;
}
g_list_free(selected);
- gtk_clist_thaw(groupeditdlg.clist_avail);
- gtk_clist_thaw(groupeditdlg.clist_group);
+ gtk_cmclist_thaw(groupeditdlg.clist_avail);
+ gtk_cmclist_thaw(groupeditdlg.clist_group);
}
-static gboolean edit_group_list_group_button( GtkCList *clist, GdkEventButton *event, gpointer data ) {
+static gboolean edit_group_list_group_button( GtkCMCList *clist, GdkEventButton *event, gpointer data ) {
if( ! event ) return FALSE;
+ if( event->window != clist->clist_window ) return FALSE;
if( event->button == 1 ) {
if( event->type == GDK_2BUTTON_PRESS ) {
return FALSE;
}
-static gboolean edit_group_list_avail_button( GtkCList *clist, GdkEventButton *event, gpointer data ) {
+static gboolean edit_group_list_avail_button( GtkCMCList *clist, GdkEventButton *event, gpointer data ) {
if( ! event ) return FALSE;
+ if( event->window != clist->clist_window ) return FALSE;
if( event->button == 1 ) {
if( event->type == GDK_2BUTTON_PRESS ) {
return FALSE;
}
-static gint edit_group_list_compare_func( GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2 ) {
- GtkCell *cell1 = ((GtkCListRow *)ptr1)->cell;
- GtkCell *cell2 = ((GtkCListRow *)ptr2)->cell;
+static gint edit_group_list_compare_func( GtkCMCList *clist, gconstpointer ptr1, gconstpointer ptr2 ) {
+ GtkCMCell *cell1 = ((GtkCMCListRow *)ptr1)->cell;
+ GtkCMCell *cell2 = ((GtkCMCListRow *)ptr2)->cell;
gchar *name1 = NULL, *name2 = NULL;
if( cell1 ) name1 = cell1->u.text;
if( cell2 ) name2 = cell2->u.text;
static void addressbook_edit_group_size_allocate_cb(GtkWidget *widget,
GtkAllocation *allocation)
{
- g_return_if_fail(allocation != NULL);
+ cm_return_if_fail(allocation != NULL);
prefs_common.addressbookeditgroupwin_width = allocation->width;
prefs_common.addressbookeditgroupwin_height = allocation->height;
gtk_container_set_border_width(GTK_CONTAINER(window), 0);
gtk_window_set_title(GTK_WINDOW(window), _("Edit Group Data"));
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
- gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+ gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(edit_group_delete_event),
cancelled);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- clist_group = gtk_sctree_new_with_titles( GROUP_N_COLS, GROUP_N_COLS, titles );
+ clist_group = gtk_sctree_new_with_titles( GROUP_N_COLS, 0, titles );
gtk_container_add( GTK_CONTAINER(clist_swin), clist_group );
- gtk_clist_set_selection_mode( GTK_CLIST(clist_group), GTK_SELECTION_EXTENDED );
- gtk_clist_set_column_width( GTK_CLIST(clist_group), GROUP_COL_NAME, GROUP_COL_WIDTH_NAME );
- gtk_clist_set_column_width( GTK_CLIST(clist_group), GROUP_COL_EMAIL, GROUP_COL_WIDTH_EMAIL );
- gtk_clist_set_compare_func( GTK_CLIST(clist_group), edit_group_list_compare_func );
- gtk_clist_set_auto_sort( GTK_CLIST(clist_group), TRUE );
+ gtk_cmctree_set_expander_style(GTK_CMCTREE(clist_group),
+ GTK_CMCTREE_EXPANDER_TRIANGLE);
+ gtk_sctree_set_stripes(GTK_SCTREE(clist_group), prefs_common.use_stripes_in_summaries);
+ gtk_cmclist_set_selection_mode( GTK_CMCLIST(clist_group), GTK_SELECTION_MULTIPLE );
+ gtk_cmclist_set_column_width( GTK_CMCLIST(clist_group), GROUP_COL_NAME, GROUP_COL_WIDTH_NAME );
+ gtk_cmclist_set_column_width( GTK_CMCLIST(clist_group), GROUP_COL_EMAIL, GROUP_COL_WIDTH_EMAIL );
+ gtk_cmclist_set_compare_func( GTK_CMCLIST(clist_group), edit_group_list_compare_func );
+ gtk_cmclist_set_auto_sort( GTK_CMCLIST(clist_group), TRUE );
for( i = 0; i < GROUP_N_COLS; i++ )
- GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist_group)->column[i].button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(GTK_CMCLIST(clist_group)->column[i].button, FALSE);
/* Available list */
vboxl = gtk_vbox_new( FALSE, 0 );
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- clist_avail = gtk_sctree_new_with_titles( GROUP_N_COLS, GROUP_N_COLS, titles );
+ clist_avail = gtk_sctree_new_with_titles( GROUP_N_COLS, 0, titles );
gtk_container_add( GTK_CONTAINER(clist_swin), clist_avail );
- gtk_clist_set_selection_mode( GTK_CLIST(clist_avail), GTK_SELECTION_EXTENDED );
- gtk_clist_set_column_width( GTK_CLIST(clist_avail), GROUP_COL_NAME, GROUP_COL_WIDTH_NAME );
- gtk_clist_set_column_width( GTK_CLIST(clist_avail), GROUP_COL_EMAIL, GROUP_COL_WIDTH_EMAIL );
- gtk_clist_set_compare_func( GTK_CLIST(clist_avail), edit_group_list_compare_func );
- gtk_clist_set_auto_sort( GTK_CLIST(clist_avail), TRUE );
+ gtk_cmctree_set_expander_style(GTK_CMCTREE(clist_avail),
+ GTK_CMCTREE_EXPANDER_TRIANGLE);
+ gtk_cmclist_set_selection_mode( GTK_CMCLIST(clist_avail), GTK_SELECTION_MULTIPLE );
+ gtk_cmclist_set_column_width( GTK_CMCLIST(clist_avail), GROUP_COL_NAME, GROUP_COL_WIDTH_NAME );
+ gtk_cmclist_set_column_width( GTK_CMCLIST(clist_avail), GROUP_COL_EMAIL, GROUP_COL_WIDTH_EMAIL );
+ gtk_cmclist_set_compare_func( GTK_CMCLIST(clist_avail), edit_group_list_compare_func );
+ gtk_cmclist_set_auto_sort( GTK_CMCLIST(clist_avail), TRUE );
for( i = 0; i < GROUP_N_COLS; i++ )
- GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist_avail)->column[i].button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(GTK_CMCLIST(clist_avail)->column[i].button, FALSE);
/* Status line */
hsbox = gtk_hbox_new(FALSE, 0);
groupeditdlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit Group Dialog" );
groupeditdlg.entry_name = entry_name;
- groupeditdlg.clist_group = GTK_CLIST( clist_group );
- groupeditdlg.clist_avail = GTK_CLIST( clist_avail );
+ groupeditdlg.clist_group = GTK_CMCLIST( clist_group );
+ groupeditdlg.clist_avail = GTK_CMCLIST( clist_avail );
if( ! _edit_group_dfl_message_ ) {
_edit_group_dfl_message_ = _( "Move Email Addresses to or from Group with arrow buttons" );
* Return list of email items.
*/
static GList *edit_group_build_email_list() {
- GtkCList *clist = GTK_CLIST(groupeditdlg.clist_group);
+ GtkCMCList *clist = GTK_CMCLIST(groupeditdlg.clist_group);
GList *listEMail = NULL;
ItemEMail *email;
gint row = 0;
- while( (email = gtk_clist_get_row_data( clist, row )) ) {
+ while( (email = gtk_cmclist_get_row_data( clist, row )) ) {
listEMail = g_list_append( listEMail, email );
row++;
}
gtk_widget_grab_focus(groupeditdlg.entry_name);
gtk_widget_show(groupeditdlg.window);
manage_window_set_transient(GTK_WINDOW(groupeditdlg.window));
-
+ gtk_window_set_modal(GTK_WINDOW(groupeditdlg.window), TRUE);
/* Clear all fields */
edit_group_status_show( "" );
- gtk_clist_clear( GTK_CLIST(groupeditdlg.clist_group) );
- gtk_clist_clear( GTK_CLIST(groupeditdlg.clist_avail) );
+ gtk_cmclist_clear( GTK_CMCLIST(groupeditdlg.clist_group) );
+ gtk_cmclist_clear( GTK_CMCLIST(groupeditdlg.clist_avail) );
if( group ) {
if( ADDRITEM_NAME(group) )
listEMail = addrbook_get_available_email_list( abf, group );
edit_group_load_clist( groupeditdlg.clist_avail, listEMail );
- mgu_clear_list( listEMail );
- listEMail = NULL;
- gtk_clist_select_row( groupeditdlg.clist_group, 0, 0 );
- gtk_clist_select_row( groupeditdlg.clist_avail, 0, 0 );
+ g_list_free( listEMail );
+ gtk_cmclist_select_row( groupeditdlg.clist_group, 0, 0 );
+ gtk_cmclist_select_row( groupeditdlg.clist_avail, 0, 0 );
edit_group_status_show( _edit_group_dfl_message_ );
gtk_main();
gtk_widget_hide( groupeditdlg.window );
-
+ gtk_window_set_modal(GTK_WINDOW(groupeditdlg.window), FALSE);
if( cancelled ) {
return NULL;
}