New Balsa Message 3.1
- From: Ian Campbell <ijc25 cam ac uk>
- To: balsa-list gnome org
- Subject: New Balsa Message 3.1
- Date: Mon, 17 Apr 2000 19:34:51 +0100
I've had complaints that the 3rd patch didn't apply cleanly to CVS.
The attached patch is identical to the previous one, but is made from CVS about
5 minutes ago (7:30pm UK time on monday).
Cheers,
Ian.
--
Ian Campbell
Churchill College, Cambridge.
new-balsa-message.patch3.1.gz
/* Balsa E-Mail Client
* Copyright (C) 2000 Ian Campbell
*
* 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "config.h"
#include "balsa-non-scrolled-window.h"
static void balsa_non_scrolled_window_class_init(BalsaNonScrolledWindowClass *klass);
static void balsa_non_scrolled_window_init(BalsaNonScrolledWindow *bns);
/* Class methods */
static void balsa_non_scrolled_window_add(GtkContainer *container, GtkWidget *child);
static void balsa_non_scrolled_window_size_request(GtkWidget *widget, GtkRequisition *requisition);
static void balsa_non_scrolled_window_finalize(GtkObject *object);
static GtkEventBoxClass *parent_class = NULL;
GtkType balsa_non_scrolled_window_get_type(void)
{
static GtkType balsa_non_scrolled_window_type = 0;
if ( !balsa_non_scrolled_window_type) {
GtkTypeInfo balsa_non_scrolled_window_info = {
"BalsaNonScrolledWindow",
sizeof(BalsaNonScrolledWindow),
sizeof(BalsaNonScrolledWindowClass),
(GtkClassInitFunc) balsa_non_scrolled_window_class_init,
(GtkObjectInitFunc) balsa_non_scrolled_window_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
(GtkClassInitFunc) NULL
};
balsa_non_scrolled_window_type = gtk_type_unique (gtk_event_box_get_type(),
&balsa_non_scrolled_window_info);
}
return balsa_non_scrolled_window_type;
}
GtkWidget *
balsa_non_scrolled_window_new(void)
{
BalsaNonScrolledWindow *bns;
bns = gtk_type_new (balsa_non_scrolled_window_get_type ());
return GTK_WIDGET(bns);
}
static void
balsa_non_scrolled_window_class_init(BalsaNonScrolledWindowClass *klass)
{
GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
parent_class = gtk_type_class(GTK_TYPE_EVENT_BOX);
container_class->add = balsa_non_scrolled_window_add;
widget_class->size_request = balsa_non_scrolled_window_size_request;
object_class->finalize = balsa_non_scrolled_window_finalize;
}
static void
balsa_non_scrolled_window_init(BalsaNonScrolledWindow *bns)
{
bns->vadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
bns->hadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
gtk_object_ref(GTK_OBJECT(bns->hadj));
gtk_object_ref(GTK_OBJECT(bns->vadj));
}
static void
balsa_non_scrolled_window_add(GtkContainer *container, GtkWidget *child)
{
BalsaNonScrolledWindow *bns;
g_return_if_fail(BALSA_IS_NON_SCROLLED_WINDOW(container));
bns = BALSA_NON_SCROLLED_WINDOW(container);
if ( !gtk_widget_set_scroll_adjustments(child, bns->hadj, bns->vadj)) {
g_warning("Cannot add non scrollable widget to a BalsaNonScrolledWindow\n");
return;
}
if ( GTK_CONTAINER_CLASS(parent_class)->add )
GTK_CONTAINER_CLASS(parent_class)->add(container, child);
}
static void
balsa_non_scrolled_window_size_request(GtkWidget *widget, GtkRequisition *requisition)
{
GtkBin *bin;
BalsaNonScrolledWindow *bns;
g_return_if_fail(widget != NULL);
g_return_if_fail(BALSA_IS_NON_SCROLLED_WINDOW(widget));
g_return_if_fail(requisition != NULL);
bin = GTK_BIN(widget);
bns = BALSA_NON_SCROLLED_WINDOW(widget);
requisition->width = ( GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness + 1 ) * 2;
requisition->height = ( GTK_CONTAINER (widget)->border_width + widget->style->klass->ythickness + 1 ) * 2;
if (bin->child && GTK_WIDGET_VISIBLE(bin->child) ) {
GtkRequisition child_requisition;
gtk_widget_size_request(bin->child, &child_requisition);
requisition->height += MAX(child_requisition.height, bns->vadj->upper - bns->vadj->lower);
requisition->width += MAX(child_requisition.width, bns->hadj->upper - bns->hadj->lower );
}
}
static void
balsa_non_scrolled_window_finalize(GtkObject *object)
{
BalsaNonScrolledWindow *bns = BALSA_NON_SCROLLED_WINDOW(object);
gtk_object_unref(GTK_OBJECT(bns->hadj));
gtk_object_unref(GTK_OBJECT(bns->vadj));
GTK_OBJECT_CLASS(parent_class)->finalize(object);
}
/* Balsa E-Mail Client
* Copyright (C) 2000 Ian Campbell
*
* 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __BALSA_NON_SCROLLED_WINDOW_H__
#define __BALSA_NON_SCROLLED_WINDOW_H__
#include <gnome.h>
#include "libbalsa.h"
#ifdef __cplusplus
extern "C"
{
#endif
#define BALSA_NON_SCROLLED_WINDOW(obj) (GTK_CHECK_CAST((obj), balsa_non_scrolled_window_get_type(), \
BalsaNonScrolledWindow))
#define BALSA_NON_SCROLLED_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), \
balsa_non_scrolled_window_get_type(), BalsaNonScrolledWindowClass))
#define BALSA_IS_NON_SCROLLED_WINDOW(obj) (GTK_CHECK_TYPE(obj, balsa_non_scrolled_window_get_type()))
/* This widget contains a scrollable object in a non-scrolling fashion */
typedef struct _BalsaNonScrolledWindow BalsaNonScrolledWindow;
typedef struct _BalsaNonScrolledWindowClass BalsaNonScrolledWindowClass;
struct _BalsaNonScrolledWindow {
GtkEventBox parent;
GtkAdjustment *hadj;
GtkAdjustment *vadj;
};
struct _BalsaNonScrolledWindowClass {
GtkEventBoxClass parent_class;
};
/* BalsaNonScrolledWindow */
GtkWidget *balsa_non_scrolled_window_new(void);
GtkType balsa_non_scrolled_window_get_type(void);
#ifdef __cplusplus
}
#endif
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]