aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-03-16 04:36:07 +0800
committerChris Lahey <clahey@src.gnome.org>2002-03-16 04:36:07 +0800
commita17d29d26cad4dec987f3db39da19e36a545bb01 (patch)
tree9a5af41dee6bf73960523731b5dfedb1cbb5b9d8
parentcbbaa07125fafaa8c0546d5ba087c25eb39480c7 (diff)
downloadgsoc2013-evolution-a17d29d26cad4dec987f3db39da19e36a545bb01.tar.gz
gsoc2013-evolution-a17d29d26cad4dec987f3db39da19e36a545bb01.tar.zst
gsoc2013-evolution-a17d29d26cad4dec987f3db39da19e36a545bb01.zip
New function that returns the total minimum width of all the columns.
2002-03-15 Christopher James Lahey <clahey@ximian.com> * e-table-header.c, e-table-header.h (e_table_header_min_width): New function that returns the total minimum width of all the columns. * e-table.c, e-table.h (set_header_width): Call e_table_header_min_width here instead of total_width. (et_size_request): Override the size_request method instead of doing set_usize. svn path=/trunk/; revision=16175
-rw-r--r--widgets/table/e-table-header.c21
-rw-r--r--widgets/table/e-table-header.h1
-rw-r--r--widgets/table/e-table.c19
-rw-r--r--widgets/table/e-table.h2
4 files changed, 39 insertions, 4 deletions
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index d983ab36e7..e5eda9fd42 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -570,6 +570,27 @@ e_table_header_total_width (ETableHeader *eth)
}
/**
+ * e_table_header_min_width:
+ * @eth: The ETableHeader to query
+ *
+ * Returns: the minimum number of pixels required by the @eth object.
+ **/
+int
+e_table_header_min_width (ETableHeader *eth)
+{
+ int total, i;
+
+ g_return_val_if_fail (eth != NULL, 0);
+ g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
+
+ total = 0;
+ for (i = 0; i < eth->col_count; i++)
+ total += eth->columns [i]->min_width;
+
+ return total;
+}
+
+/**
* e_table_header_move:
* @eth: The ETableHeader to operate on.
* @source_index: the source column to move.
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
index 355618b5a6..b30bca47cd 100644
--- a/widgets/table/e-table-header.h
+++ b/widgets/table/e-table-header.h
@@ -90,6 +90,7 @@ ETableCol **e_table_header_get_columns (ETableHeader *eth);
int e_table_header_get_selected (ETableHeader *eth);
int e_table_header_total_width (ETableHeader *eth);
+int e_table_header_min_width (ETableHeader *eth);
void e_table_header_move (ETableHeader *eth,
int source_index,
int target_index);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 7e101b2363..9116f03356 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -195,13 +195,21 @@ e_table_state_change (ETable *et)
#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header);
static void
+et_size_request (GtkWidget *widget, GtkRequisition *request)
+{
+ ETable *et = E_TABLE (widget);
+ if (GTK_WIDGET_CLASS (parent_class)->size_request)
+ GTK_WIDGET_CLASS (parent_class)->size_request (widget, request);
+ if (et->horizontal_resize)
+ request->width = MAX (request->width, et->header_width);
+}
+
+static void
set_header_width (ETable *et)
{
if (et->horizontal_resize) {
- int width = e_table_header_total_width (et->header);
- gtk_widget_set_usize (GTK_WIDGET (et->table_canvas), width,
- -2);
- gtk_widget_queue_resize (GTK_WIDGET (et->table_canvas));
+ et->header_width = e_table_header_min_width (et->header);
+ gtk_widget_queue_resize (GTK_WIDGET (et));
}
}
@@ -463,6 +471,8 @@ e_table_init (GtkObject *object)
e_table->current_search = NULL;
e_table->current_search_col = -1;
+
+ e_table->header_width = 0;
}
/* Grab_focus handler for the ETable */
@@ -2898,6 +2908,7 @@ e_table_class_init (ETableClass *class)
widget_class->grab_focus = et_grab_focus;
widget_class->unrealize = et_unrealize;
+ widget_class->size_request = et_size_request;
container_class->focus = et_focus;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index e3c7623d9d..067b3ab872 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -152,6 +152,8 @@ typedef struct {
int drag_row;
int drag_col;
ETableDragSourceSite *site;
+
+ int header_width;
} ETable;
typedef struct {
pbapt2014-02-072-1/+2 * chinese/kcfonts: Mark jobs unsafemarino2014-02-061-0/+2 * - Update to 3.8.1sunpoet2014-02-042-3/+3 * - Update to 3.8.1sunpoet2014-02-042-3/+3 * Stage support for japanese/kon2-16dot and it's slavespawel2014-02-021-5/+8 * - Update gimp-help ports to 2.8.1. Polish translation has been removed, newmakc2014-02-011-3/+3 * Respect $CCjohans2014-01-261-4/+7 * Master port has been stage, add stage support here too so that the man pageantoine2014-01-261-1/+0 * Fix properties on pkg-plistbapt2014-01-2211-11/+0 * Stage supportantoine2014-01-211-4/+0 * Stage supportantoine2014-01-211-15/+6 * Stage supportantoine2014-01-211-19/+12 * Stage supportantoine2014-01-211-1/+0 * Support stagebapt2014-01-161-18/+7 * Reduce over inclusion of bsd.port.mkbapt2014-01-161-8/+2 * Reduce over inclusion of bsd.port.mkbapt2014-01-161-7/+2 * Reduce over inclusion of bsd.port.mkbapt2014-01-161-7/+1 * Add stagedir support.vanilla2014-01-0913-39/+53 * Add stagedir support.vanilla2014-01-092-1/+11 * Add stagedir support.vanilla2014-01-0915-63/+51 * Support STAGEDIR.vanilla2014-01-0817-80/+82 * Remove color code from pkg-message this is terminal dependantbapt2014-01-072-5/+5 * Revise previous change: only remove USE_GCC=yes when we are usingdelphij2014-01-071-1/+7 * In preparation for Qt 5 ports:makc2014-01-074-34/+4 * Mark as MAKE_JOBS_UNSAFE, it fails to link with MAKE_JOBS_NUMBER=8antoine2014-01-051-0/+1 * Support stagebapt2014-01-051-1/+0 * With gtk 2.4.22, immodule cache has moved from gtk.immodules toantoine2014-01-058-61/+48 * Fix packaging after MASTER port was stagedantoine2014-01-041-1/+0 * Convert chinese to MDOCSadamw2014-01-0312-14/+32 * Stage supportantoine2013-12-311-6/+4 * Stage support, uses gmakeantoine2013-12-311-3/+1 * Stage support, uses gmakeantoine2013-12-311-3/+1 * - rename AL2 to APACHE20 in Mk/bsd.licenses.db.mkohauer2013-12-311-1/+1 * - Update to 3.8sunpoet2013-12-242-3/+3 * - Update to 3.8sunpoet2013-12-242-3/+3 * Don't use USE_GCC. The C++ runtime would conflict withdelphij2013-12-201-2/+1 * Reset maintainer for llwang@infor.orgkoobs2013-12-181-1/+1 * - Update Calligra Suite to 2.7.5.avilla2013-12-174-6/+4 * Finish stage supportantoine2013-12-152-1/+2 * LEGAL, chinese/moettf: sync LEGAL texteadler2013-12-121-1/+1 * In preparation for making libtool generate libraries with a sane name, fix allbapt2013-12-1121-35/+35 * - Remove NO_LATEST_LINKsunpoet2013-12-111-2/+2 * - Update to 0.20sunpoet2013-12-092-3/+3 * - Add LICENSEsunpoet2013-11-231-2/+3 * - Add LICENSEsunpoet2013-11-221-0/+2 * - Add LICENSEsunpoet2013-11-201-2/+3 * - Support STAGElwhsu2013-11-181-5/+4 * - Replace QT_.*_REL with QT_.* in PLIST_SUB.avilla2013-11-17