aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-02-14 04:47:26 +0800
committerChris Lahey <clahey@src.gnome.org>2002-02-14 04:47:26 +0800
commit32a1a69f13932b9304a937ca0cb39102d425bc93 (patch)
tree86c1eb93cc4b6053916a677e1183fdfe046aa824 /addressbook/gui
parent9f1ec16fffe3bdaa9ee4ecf0b3111f55e510decc (diff)
downloadgsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar.gz
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar.bz2
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar.lz
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar.xz
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.tar.zst
gsoc2013-evolution-32a1a69f13932b9304a937ca0cb39102d425bc93.zip
Attach to the emvw instead of the emv here.
2002-02-13 Christopher James Lahey <clahey@ximian.com> * gui/widgets/e-addressbook-view.c (display_view): Attach to the emvw instead of the emv here. * gui/widgets/e-minicard-view-widget.c, e-minicard-view-widget.h: Made this object have a "column_width" argument and a "column_width_changed" signal which are a simple layer down to the EMinicardView contained within. * gui/widgets/gal-view-minicard.c, gui/widgets/gal-view-minicard.h (gal_view_minicard_attach): Made this attach to an EMinicardViewWidget instead of a EMinicardView. svn path=/trunk/; revision=15714
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c3
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c55
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h5
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c30
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.h24
5 files changed, 78 insertions, 39 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 93da4c8c29..1679c95392 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -468,8 +468,7 @@ display_view(GalViewInstance *instance,
gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)));
} else if (GAL_IS_VIEW_MINICARD(view)) {
change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
- if (address_view->object && E_MINICARD_VIEW_WIDGET (address_view->object)->emv)
- gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW (E_MINICARD_VIEW_WIDGET (address_view->object)->emv));
+ gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW_WIDGET (address_view->object));
}
address_view->current_view = view;
}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 145c5cecce..84d335b757 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -37,6 +37,7 @@ static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocati
static void e_minicard_view_widget_realize (GtkWidget *widget);
static void selection_change (ESelectionModel *esm, EMinicardViewWidget *widget);
+static void column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget);
static ECanvasClass *parent_class = NULL;
@@ -45,11 +46,13 @@ enum {
ARG_0,
ARG_BOOK,
ARG_QUERY,
- ARG_EDITABLE
+ ARG_EDITABLE,
+ ARG_COLUMN_WIDTH
};
enum {
SELECTION_CHANGE,
+ COLUMN_WIDTH_CHANGED,
LAST_SIGNAL
};
@@ -99,6 +102,8 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
GTK_ARG_READWRITE, ARG_QUERY);
gtk_object_add_arg_type ("EMinicardViewWidget::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EDITABLE);
+ gtk_object_add_arg_type ("EMinicardViewWidget::column_width", GTK_TYPE_INT,
+ GTK_ARG_READWRITE, ARG_COLUMN_WIDTH);
e_minicard_view_widget_signals [SELECTION_CHANGE] =
gtk_signal_new ("selection_change",
@@ -108,6 +113,14 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ e_minicard_view_widget_signals [COLUMN_WIDTH_CHANGED] =
+ gtk_signal_new ("column_width_changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMinicardViewWidgetClass, column_width_changed),
+ e_marshal_NONE__DOUBLE,
+ GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
+
gtk_object_class_add_signals (object_class, e_minicard_view_widget_signals, LAST_SIGNAL);
object_class->set_arg = e_minicard_view_widget_set_arg;
@@ -118,6 +131,9 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
widget_class->size_allocate = e_minicard_view_widget_size_allocate;
canvas_class->reflow = e_minicard_view_widget_reflow;
+
+ klass->selection_change = NULL;
+ klass->column_width_changed = NULL;
}
static void
@@ -128,6 +144,7 @@ e_minicard_view_widget_init (EMinicardViewWidget *view)
view->book = NULL;
view->query = NULL;
view->editable = FALSE;
+ view->column_width = 150;
}
GtkWidget *
@@ -173,9 +190,17 @@ e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_EDITABLE:
emvw->editable = GTK_VALUE_BOOL(*arg);
if (emvw->emv)
- gtk_object_set (GTK_OBJECT(emvw->emv),
- "editable", emvw->editable,
- NULL);
+ gtk_object_set (GTK_OBJECT(emvw->emv),
+ "editable", emvw->editable,
+ NULL);
+ break;
+ case ARG_COLUMN_WIDTH:
+ emvw->column_width = GTK_VALUE_INT (*arg);
+ if (emvw->emv) {
+ gtk_object_set (GTK_OBJECT(emvw->emv),
+ "column_width", (int) emvw->column_width,
+ NULL);
+ }
break;
}
}
@@ -197,6 +222,9 @@ e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_EDITABLE:
GTK_VALUE_BOOL (*arg) = emvw->editable;
break;
+ case ARG_COLUMN_WIDTH:
+ GTK_VALUE_INT (*arg) = emvw->column_width;
+ break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -232,15 +260,17 @@ e_minicard_view_widget_realize (GtkWidget *widget)
e_minicard_view_get_type(),
"height", (double) 100,
"minimum_width", (double) 100,
+ "adapter", view->adapter,
+ "column_width", (int) view->column_width,
+ "editable", view->editable,
NULL );
- gtk_object_set(GTK_OBJECT(view->emv),
- "adapter", view->adapter,
- NULL);
-
gtk_signal_connect (GTK_OBJECT (E_REFLOW(view->emv)->selection),
"selection_changed",
selection_change, view);
+ gtk_signal_connect (GTK_OBJECT (view->emv),
+ "column_width_changed",
+ column_width_changed, view);
if (GTK_WIDGET_CLASS(parent_class)->realize)
GTK_WIDGET_CLASS(parent_class)->realize (widget);
@@ -290,7 +320,14 @@ static void
selection_change (ESelectionModel *esm, EMinicardViewWidget *widget)
{
gtk_signal_emit (GTK_OBJECT(widget),
- e_minicard_view_widget_signals [SELECTION_CHANGE], widget);
+ e_minicard_view_widget_signals [SELECTION_CHANGE]);
+}
+
+static void
+column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget)
+{
+ gtk_signal_emit (GTK_OBJECT(widget),
+ e_minicard_view_widget_signals [COLUMN_WIDTH_CHANGED], width);
}
gint
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index 4cf3a72d93..7df63c26e4 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -51,12 +51,15 @@ struct _EMinicardViewWidget
EBook *book;
char *query;
guint editable : 1;
+
+ double column_width;
};
struct _EMinicardViewWidgetClass
{
ECanvasClass parent_class;
- void (*selection_change) (EMinicardViewWidget*);
+ void (*selection_change) (EMinicardViewWidget *emvw);
+ void (*column_width_changed) (EMinicardViewWidget *emvw, double width);
};
GtkType e_minicard_view_widget_get_type (void);
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
index e4ebff2019..b3162e51d1 100644
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ b/addressbook/gui/widgets/gal-view-minicard.c
@@ -116,8 +116,8 @@ gal_view_minicard_init (GalViewMinicard *gvm)
gvm->title = NULL;
gvm->column_width = 150.0;
- gvm->emv = NULL;
- gvm->emv_column_width_changed_id = 0;
+ gvm->emvw = NULL;
+ gvm->emvw_column_width_changed_id = 0;
}
/**
@@ -189,33 +189,33 @@ column_width_changed (ETable *table, double width, GalViewMinicard *view)
}
void
-gal_view_minicard_attach (GalViewMinicard *view, EMinicardView *emv)
+gal_view_minicard_attach (GalViewMinicard *view, EMinicardViewWidget *emvw)
{
gal_view_minicard_detach (view);
- view->emv = emv;
+ view->emvw = emvw;
- gtk_object_ref (GTK_OBJECT (view->emv));
+ gtk_object_ref (GTK_OBJECT (view->emvw));
- gtk_object_set (GTK_OBJECT (view->emv),
+ gtk_object_set (GTK_OBJECT (view->emvw),
"column_width", (int) view->column_width,
NULL);
- view->emv_column_width_changed_id =
- gtk_signal_connect(GTK_OBJECT(view->emv), "column_width_changed",
+ view->emvw_column_width_changed_id =
+ gtk_signal_connect(GTK_OBJECT(view->emvw), "column_width_changed",
GTK_SIGNAL_FUNC (column_width_changed), view);
}
void
gal_view_minicard_detach (GalViewMinicard *view)
{
- if (view->emv == NULL)
+ if (view->emvw == NULL)
return;
- if (view->emv_column_width_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (view->emv),
- view->emv_column_width_changed_id);
- view->emv_column_width_changed_id = 0;
+ if (view->emvw_column_width_changed_id) {
+ gtk_signal_disconnect (GTK_OBJECT (view->emvw),
+ view->emvw_column_width_changed_id);
+ view->emvw_column_width_changed_id = 0;
}
- gtk_object_unref (GTK_OBJECT (view->emv));
- view->emv = NULL;
+ gtk_object_unref (GTK_OBJECT (view->emvw));
+ view->emvw = NULL;
}
diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h
index 1228a4af8c..31a28c56d9 100644
--- a/addressbook/gui/widgets/gal-view-minicard.h
+++ b/addressbook/gui/widgets/gal-view-minicard.h
@@ -12,7 +12,7 @@
#include <gtk/gtkobject.h>
#include <gal/menus/gal-view.h>
-#include <e-minicard-view.h>
+#include <e-minicard-view-widget.h>
#define GAL_VIEW_MINICARD_TYPE (gal_view_minicard_get_type ())
#define GAL_VIEW_MINICARD(o) (GTK_CHECK_CAST ((o), GAL_VIEW_MINICARD_TYPE, GalViewMinicard))
@@ -21,13 +21,13 @@
#define GAL_IS_VIEW_MINICARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_MINICARD_TYPE))
typedef struct {
- GalView base;
+ GalView base;
- char *title;
- double column_width;
+ char *title;
+ double column_width;
- EMinicardView *emv;
- guint emv_column_width_changed_id;
+ EMinicardViewWidget *emvw;
+ guint emvw_column_width_changed_id;
} GalViewMinicard;
typedef struct {
@@ -36,11 +36,11 @@ typedef struct {
/* Standard functions */
GtkType gal_view_minicard_get_type (void);
-GalView *gal_view_minicard_new (const gchar *title);
-GalView *gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title);
-void gal_view_minicard_attach (GalViewMinicard *view,
- EMinicardView *emv);
-void gal_view_minicard_detach (GalViewMinicard *view);
+GalView *gal_view_minicard_new (const gchar *title);
+GalView *gal_view_minicard_construct (GalViewMinicard *view,
+ const gchar *title);
+void gal_view_minicard_attach (GalViewMinicard *view,
+ EMinicardViewWidget *emvw);
+void gal_view_minicard_detach (GalViewMinicard *view);
#endif /* _GAL_VIEW_MINICARD_H_ */