diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | libsylph/prefs_common.c | 6 | ||||
-rw-r--r-- | libsylph/prefs_common.h | 7 | ||||
-rw-r--r-- | src/addressbook.c | 66 |
5 files changed, 78 insertions, 8 deletions
@@ -1,3 +1,8 @@ +2011-02-04 + + * libsylph/prefs_common.[ch] + src/addressbook.c: save the columns width of address book. + 2011-01-31 * version 3.1.0 diff --git a/configure.in b/configure.in index 716e0533..3060d1d3 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 EXTRA_VERSION= -BUILD_REVISION=1114 +BUILD_REVISION=1115 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl define if this is a development release diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index 683bc069..c121ecd7 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -305,6 +305,10 @@ static PrefParam param[] = { {"addressbook_y", "32", &prefs_common.addressbook_y, P_INT}, {"addressbook_width", "620", &prefs_common.addressbook_width, P_INT}, {"addressbook_height", "360", &prefs_common.addressbook_height, P_INT}, + {"addressbook_folder_width", "190", &prefs_common.addressbook_folder_width, P_INT}, + {"addressbook_col_name", "164", &prefs_common.addressbook_col_name, P_INT}, + {"addressbook_col_addr", "156", &prefs_common.addressbook_col_addr, P_INT}, + {"addressbook_col_rem", "100", &prefs_common.addressbook_col_rem, P_INT}, /* Message */ {"enable_color", "TRUE", &prefs_common.enable_color, P_BOOL}, diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h index 8a68039d..f3210630 100644 --- a/libsylph/prefs_common.h +++ b/libsylph/prefs_common.h @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -325,6 +325,11 @@ struct _PrefsCommon gboolean always_add_address_only; /* Compose */ gboolean show_send_dialog; /* Send */ + + gint addressbook_folder_width; + gint addressbook_col_name; + gint addressbook_col_addr; + gint addressbook_col_rem; }; extern PrefsCommon prefs_common; diff --git a/src/addressbook.c b/src/addressbook.c index bfe119af..67d50c33 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * 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 @@ -227,6 +227,13 @@ static void addressbook_drag_received (GtkWidget *widget, guint time, gpointer user_data); +static void addressbook_folder_resized (GtkWidget *widget, + GtkAllocation *allocation, + gpointer data); +static void addressbook_col_resized (GtkWidget *widget, + GtkAllocation *allocation, + gpointer data); + static void addressbook_popup_close (GtkMenuShell *menu_shell, gpointer data); @@ -646,7 +653,7 @@ static void addressbook_create(void) GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(tree_swin), GTK_SHADOW_IN); - gtk_widget_set_size_request(tree_swin, COL_FOLDER_WIDTH + 40, -1); + gtk_widget_set_size_request(tree_swin, prefs_common.addressbook_folder_width, -1); /* Address index */ tree_store = gtk_tree_store_new(N_TREE_COLS, G_TYPE_STRING, @@ -672,7 +679,6 @@ static void addressbook_create(void) column = gtk_tree_view_column_new(); gtk_tree_view_column_set_spacing(column, 1); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_fixed_width(column, COL_FOLDER_WIDTH); gtk_tree_view_column_set_resizable(column, TRUE); renderer = gtk_cell_renderer_pixbuf_new(); @@ -701,6 +707,9 @@ static void addressbook_create(void) COL_FOLDER_NAME, GTK_SORT_ASCENDING); + g_signal_connect(G_OBJECT(tree_swin), "size-allocate", + G_CALLBACK(addressbook_folder_resized), NULL); + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(addressbook_tree_selection_changed), NULL); g_signal_connect(G_OBJECT(treeview), "button_press_event", @@ -761,7 +770,8 @@ static void addressbook_create(void) column = gtk_tree_view_column_new(); gtk_tree_view_column_set_spacing(column, 1); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_fixed_width(column, COL_NAME_WIDTH); + gtk_tree_view_column_set_fixed_width + (column, prefs_common.addressbook_col_name); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_title(column, _("Name")); @@ -784,6 +794,9 @@ static void addressbook_create(void) gtk_tree_view_column_set_sort_column_id(column, COL_NAME); gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); gtk_tree_view_set_expander_column(GTK_TREE_VIEW(listview), column); + g_signal_connect(G_OBJECT(column->button), "size-allocate", + G_CALLBACK(addressbook_col_resized), + GINT_TO_POINTER(COL_NAME)); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, @@ -794,10 +807,14 @@ static void addressbook_create(void) column = gtk_tree_view_column_new_with_attributes (_("E-Mail address"), renderer, "text", COL_ADDRESS, NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); - gtk_tree_view_column_set_fixed_width(column, COL_ADDRESS_WIDTH); + gtk_tree_view_column_set_fixed_width + (column, prefs_common.addressbook_col_addr); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, COL_ADDRESS); gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); + g_signal_connect(G_OBJECT(column->button), "size-allocate", + G_CALLBACK(addressbook_col_resized), + GINT_TO_POINTER(COL_ADDRESS)); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, @@ -811,6 +828,9 @@ static void addressbook_create(void) gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, COL_REMARKS); gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); + g_signal_connect(G_OBJECT(column->button), "size-allocate", + G_CALLBACK(addressbook_col_resized), + GINT_TO_POINTER(COL_REMARKS)); gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_store), COL_NAME, GTK_SORT_ASCENDING); @@ -1969,6 +1989,42 @@ static void addressbook_drag_received(GtkWidget *widget, addressbook_modified(); } +static void addressbook_folder_resized(GtkWidget *widget, + GtkAllocation *allocation, + gpointer data) +{ + gint width = allocation->width; + + if (width < 8) + return; + + prefs_common.addressbook_folder_width = width; +} + +static void addressbook_col_resized(GtkWidget *widget, + GtkAllocation *allocation, gpointer data) +{ + AddressBookListColumnPos type = (gint)data; + gint width = allocation->width; + + if (width < 8) + return; + + switch (type) { + case COL_NAME: + prefs_common.addressbook_col_name = width; + break; + case COL_ADDRESS: + prefs_common.addressbook_col_addr = width; + break; + case COL_REMARKS: + prefs_common.addressbook_col_rem = width; + break; + default: + break; + } +} + static void addressbook_popup_close(GtkMenuShell *menu_shell, gpointer data) { GtkTreeView *treeview = GTK_TREE_VIEW(addrbook.treeview); |