aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/minicard
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-18 18:29:52 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-18 18:29:52 +0800
commit5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1 (patch)
tree5cd2c94309b9e0de803a9abf0efd13311e5e354c /addressbook/gui/minicard
parentf4f267580923e9cee563b151edb18edd7996b45e (diff)
downloadgsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar.gz
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar.bz2
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar.lz
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar.xz
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.tar.zst
gsoc2013-evolution-5ec9ba9eea52cd24c7abcccc2ec2e99922570ef1.zip
Added gui/minicard/e-minicard-control.c,
2000-07-18 Christopher James Lahey <clahey@helixcode.com> * gui/minicard/Makefile.am: Added gui/minicard/e-minicard-control.c, gui/minicard/e-minicard-control.h, gui/minicard/e-minicard-widget.c, and gui/minicard/e-minicard-widget.h. * gui/minicard/e-minicard-control.c, gui/minicard/e-minicard-control.h, gui/minicard/e-minicard-widget.c, gui/minicard/e-minicard-widget.h: Got these to compile. * gui/minicard/e-minicard-control.gnorba, gui/minicard/e-minicard-control.oafinfo: Copied directly from bonobo-clock-control. These aren't done yet. svn path=/trunk/; revision=4211
Diffstat (limited to 'addressbook/gui/minicard')
-rw-r--r--addressbook/gui/minicard/Makefile.am8
-rw-r--r--addressbook/gui/minicard/e-minicard-control.c29
-rw-r--r--addressbook/gui/minicard/e-minicard-control.gnorba24
-rw-r--r--addressbook/gui/minicard/e-minicard-control.h2
-rw-r--r--addressbook/gui/minicard/e-minicard-control.oafinfo38
-rw-r--r--addressbook/gui/minicard/e-minicard-widget.c96
-rw-r--r--addressbook/gui/minicard/e-minicard-widget.h14
7 files changed, 151 insertions, 60 deletions
diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am
index d09d66fe31..1a288fa088 100644
--- a/addressbook/gui/minicard/Makefile.am
+++ b/addressbook/gui/minicard/Makefile.am
@@ -12,12 +12,16 @@ noinst_LIBRARIES = \
libeminicard.a
libeminicard_a_SOURCES = \
- e-minicard.c \
- e-minicard.h \
+ e-minicard-control.c \
+ e-minicard-control.h \
e-minicard-label.c \
e-minicard-label.h \
e-minicard-view.c \
e-minicard-view.h \
+ e-minicard-widget.c \
+ e-minicard-widget.h \
+ e-minicard.c \
+ e-minicard.h \
e-reflow-sorted.c \
e-reflow-sorted.h \
e-reflow.c \
diff --git a/addressbook/gui/minicard/e-minicard-control.c b/addressbook/gui/minicard/e-minicard-control.c
index 8cac2dc15e..3946618627 100644
--- a/addressbook/gui/minicard/e-minicard-control.c
+++ b/addressbook/gui/minicard/e-minicard-control.c
@@ -11,7 +11,9 @@
#include <gnome.h>
#include <bonobo.h>
-#include "e-minicard-factory.h"
+#include "e-minicard-control.h"
+#include "e-minicard-widget.h"
+#include "addressbook/backend/ebook/e-card.h"
#if 0
enum {
@@ -83,7 +85,7 @@ set_prop (BonoboPropertyBag *bag,
* save methods which allow data to be loaded into and out of the
* BonoboObject.
*/
-static int
+static char *
stream_read (Bonobo_Stream stream)
{
Bonobo_Stream_iobuf *buffer;
@@ -144,7 +146,7 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
return;
}
- if ((vcard = stream_read (stream, embeddable_data)) == NULL) {
+ if ((vcard = stream_read (stream)) == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Persist_FileNotFound, NULL);
return;
@@ -222,6 +224,7 @@ pstream_get_max_size (BonoboPersistStream *ps, void *data,
GtkWidget *minicard = data;
ECard *card;
char *vcard;
+ gint length;
gtk_object_get(GTK_OBJECT(minicard),
"card", &card,
@@ -241,7 +244,7 @@ pstream_get_content_types (BonoboPersistStream *ps, void *closure,
}
static BonoboObject *
-e_minicard_factory (BonoboGenericFactory *Factory, void *closure)
+e_minicard_control_factory (BonoboGenericFactory *Factory, void *closure)
{
#if 0
BonoboPropertyBag *pb;
@@ -283,25 +286,25 @@ e_minicard_factory (BonoboGenericFactory *Factory, void *closure)
}
void
-e_minicard_factory_init (void)
+e_minicard_control_factory_init (void)
{
- static BonoboGenericFactory *e_minicard_factory = NULL;
+ static BonoboGenericFactory *factory = NULL;
- if (e_minicard_factory != NULL)
+ if (factory != NULL)
return;
#if USING_OAF
- e_minicard_factory =
+ factory =
bonobo_generic_factory_new (
"OAFIID:e_minicard_factory:f9542709-fb31-4c6a-bc00-d462ba41e4b9",
- e_minicard_factory, NULL);
+ e_minicard_control_factory, NULL);
#else
- e_minicard_factory =
+ factory =
bonobo_generic_factory_new (
"control-factory:e-minicard",
- e_minicard_factory, NULL);
+ e_minicard_control_factory, NULL);
#endif
- if (e_minicard_factory == NULL)
- g_error ("I could not register a EMinicard factory.");
+ if (factory == NULL)
+ g_error ("I could not register a EMinicard control factory.");
}
diff --git a/addressbook/gui/minicard/e-minicard-control.gnorba b/addressbook/gui/minicard/e-minicard-control.gnorba
new file mode 100644
index 0000000000..73daffd203
--- /dev/null
+++ b/addressbook/gui/minicard/e-minicard-control.gnorba
@@ -0,0 +1,24 @@
+[control-factory:clock]
+type=exe
+repo_id=IDL:Bonobo/GenericFactory:1.0
+description=Factory for the sample BonoboClock control
+location_info=sample-control-factory
+
+[control:clock]
+type=factory
+repo_id=IDL:BonoboControl/clock-control:1.0 IDL:Bonobo/Control:1.0
+description=A sample Bonobo control which displays a clock.
+location_info=control-factory:clock
+
+[control-factory:entry]
+type=exe
+repo_id=IDL:Bonobo/GenericFactory:1.0
+description=Factory for the sample GtkEntry control
+location_info=sample-control-factory
+
+[control:entry]
+type=factory
+repo_id=IDL:BonoboControl/entry-control:1.0 IDL:Bonobo/Control:1.0
+description=A sample Bonbobo control wrapping a Gtk Entry widget.
+location_info=control-factory:entry
+
diff --git a/addressbook/gui/minicard/e-minicard-control.h b/addressbook/gui/minicard/e-minicard-control.h
index 3b69ec9080..4a0da88435 100644
--- a/addressbook/gui/minicard/e-minicard-control.h
+++ b/addressbook/gui/minicard/e-minicard-control.h
@@ -3,6 +3,6 @@
#include <bonobo/bonobo-control.h>
-void e_minicard_factory_init (void);
+void e_minicard_control_factory_init (void);
#endif /* __E_MINICARD_CONTROL_H__ */
diff --git a/addressbook/gui/minicard/e-minicard-control.oafinfo b/addressbook/gui/minicard/e-minicard-control.oafinfo
new file mode 100644
index 0000000000..9e74cf1344
--- /dev/null
+++ b/addressbook/gui/minicard/e-minicard-control.oafinfo
@@ -0,0 +1,38 @@
+<oaf_info>
+
+<oaf_server iid="OAFIID:bonobo_clock_factory:ec4961f3-7a16-4ace-9463-b112e4bc4186" type="exe" location="sample-control-factory">
+<oaf_attribute name="repo_ids" type="stringv">
+<item value="IDL:GNOME/GenericFactory:1.0"/>
+</oaf_attribute>
+<oaf_attribute name="name" type="string" value="Clock control factory"/>
+<oaf_attribute name="description" type="string" value="Factory for the sample BonoboClock control"/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:bonobo_clock:d42cc651-44ae-4f69-a10d-a0b6b2cc6ecc" type="factory" location="OAFIID:bonobo_clock_factory:ec4961f3-7a16-4ace-9463-b112e4bc4186">
+<oaf_attribute name="repo_ids" type="stringv">
+<item value="IDL:Bonobo/Unknown:1.0"/>
+<item value="IDL:Bonobo/Control:1.0"/>
+</oaf_attribute>
+<oaf_attribute name="name" type="string" value="Clock control"/>
+<oaf_attribute name="description" type="string" value="A sample Bonobo control which displays a clock."/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:bonobo_entry_factory:ef3e3c33-43e2-4f7c-9ca9-9479104608d6" type="exe" location="sample-control-factory">
+<oaf_attribute name="repo_ids" type="stringv">
+<item value="IDL:GNOME/GenericFactory:1.0"/>
+</oaf_attribute>
+<oaf_attribute name="name" type="string" value="Entry control factory"/>
+<oaf_attribute name="description" type="string" value="Factory for the sample GtkEntry control"/>
+</oaf_server>
+
+<oaf_server iid="OAFIID:bonobo_entry:04e49c0b-95e2-4305-88a7-9f6721ddfa51" type="factory" location="OAFIID:bonobo_entry_factory:ef3e3c33-43e2-4f7c-9ca9-9479104608d6">
+<oaf_attribute name="repo_ids" type="stringv">
+<item value="IDL:Bonobo/Unknown:1.0"/>
+<item value="IDL:Bonobo/Control:1.0"/>
+</oaf_attribute>
+<oaf_attribute name="name" type="string" value="Entry control"/>
+<oaf_attribute name="description" type="string" value="A sample Bonbobo control wrapping a Gtk Entry widget."/>
+</oaf_server>
+
+</oaf_info>
+
diff --git a/addressbook/gui/minicard/e-minicard-widget.c b/addressbook/gui/minicard/e-minicard-widget.c
index e3b61e9540..3f765425e4 100644
--- a/addressbook/gui/minicard/e-minicard-widget.c
+++ b/addressbook/gui/minicard/e-minicard-widget.c
@@ -22,16 +22,19 @@
#include <config.h>
#include <gnome.h>
-#include <e-table-field-chooser.h>
-#include <e-table-field-chooser-item.h>
+#include "e-minicard-widget.h"
+#include "e-minicard.h"
static void e_minicard_widget_init (EMinicardWidget *card);
static void e_minicard_widget_class_init (EMinicardWidgetClass *klass);
static void e_minicard_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_minicard_widget_destroy (GtkObject *object);
+static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition);
+static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
+static void e_minicard_widget_reflow (ECanvas *canvas);
-static ECanvas *parent_class = NULL;
+static ECanvasClass *parent_class = NULL;
/* The arguments we take */
enum {
@@ -42,11 +45,11 @@ enum {
GtkType
e_minicard_widget_get_type (void)
{
- static GtkType table_field_chooser_type = 0;
+ static GtkType type = 0;
- if (!table_field_chooser_type)
+ if (!type)
{
- static const GtkTypeInfo table_field_chooser_info =
+ static const GtkTypeInfo info =
{
"EMinicardWidget",
sizeof (EMinicardWidget),
@@ -58,10 +61,10 @@ e_minicard_widget_get_type (void)
(GtkClassInitFunc) NULL,
};
- table_field_chooser_type = gtk_type_unique (e_canvas_get_type (), &table_field_chooser_info);
+ type = gtk_type_unique (e_canvas_get_type (), &info);
}
- return table_field_chooser_type;
+ return type;
}
static void
@@ -69,11 +72,13 @@ e_minicard_widget_class_init (EMinicardWidgetClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ ECanvasClass *ecanvas_class;
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass *) klass;
+ object_class = GTK_OBJECT_CLASS(klass);
+ widget_class = GTK_WIDGET_CLASS(klass);
+ ecanvas_class = E_CANVAS_CLASS(klass);
- parent_class = gtk_type_class (gtk_vbox_get_type ());
+ parent_class = gtk_type_class (e_canvas_get_type ());
object_class->set_arg = e_minicard_widget_set_arg;
object_class->get_arg = e_minicard_widget_get_arg;
@@ -81,11 +86,30 @@ e_minicard_widget_class_init (EMinicardWidgetClass *klass)
widget_class->size_request = e_minicard_widget_size_request;
widget_class->size_allocate = e_minicard_widget_size_allocate;
+
+ ecanvas_class->reflow = e_minicard_widget_reflow;
+
gtk_object_add_arg_type ("EMinicardWidget::card", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_CARD);
}
static void
+e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
+{
+ double height;
+ EMinicardWidget *emw = E_MINICARD_WIDGET(widget);
+ gtk_object_get(GTK_OBJECT(emw->item),
+ "height", &height,
+ NULL);
+ if (height <= 0)
+ height = 1;
+ widget->requisition.height = height;
+ widget->requisition.width = 200;
+ requisition->height = height;
+ requisition->width = 200;
+}
+
+static void
e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
double height;
@@ -97,7 +121,7 @@ e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
"height", &height,
NULL);
height = MAX(height, allocation->height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( emw->canvas ), 0, 0, allocation->width - 1, height - 1);
+ gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1);
gnome_canvas_item_set( emw->rect,
"x2", (double) allocation->width,
"y2", (double) height,
@@ -106,26 +130,29 @@ e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation);
}
-static void resize(GnomeCanvas *canvas, EMinicardWidget *emw)
+static void e_minicard_widget_reflow(ECanvas *canvas)
{
double height;
+ EMinicardWidget *emw = E_MINICARD_WIDGET(canvas);
gtk_object_get(GTK_OBJECT(emw->item),
"height", &height,
NULL);
- height = MAX(height, emw->last_alloc.height);
+ height = MAX(height, GTK_WIDGET(emw)->allocation.height);
- gnome_canvas_set_scroll_region (GNOME_CANVAS(emw->canvas), 0, 0, emw->last_alloc.width - 1, height - 1);
+ gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1);
gnome_canvas_item_set( emw->rect,
- "x2", (double) emw->last_alloc.width,
+ "x2", (double) GTK_WIDGET(emw)->allocation.width,
"y2", (double) height,
NULL );
+
+ gtk_widget_queue_resize(GTK_WIDGET(canvas));
}
static void
e_minicard_widget_init (EMinicardWidget *emw)
{
- emw->rect = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS( emw->canvas ) ),
+ emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
gnome_canvas_rect_get_type(),
"x1", (double) 0,
"y1", (double) 0,
@@ -134,23 +161,16 @@ e_minicard_widget_init (EMinicardWidget *emw)
"fill_color", "white",
NULL );
- emw->item = gnome_canvas_item_new(gnome_canvas_root(emw->canvas),
- e_minicard_widget_item_get_type(),
+ emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
+ e_minicard_get_type(),
"width", (double) 100,
NULL );
- gtk_signal_connect( GTK_OBJECT( emw->canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- emw);
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw->canvas ),
+ gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ),
0, 0,
100, 100 );
-
- /* Connect the signals */
- gtk_signal_connect (GTK_OBJECT (emw->canvas), "size_allocate",
- GTK_SIGNAL_FUNC (allocate_callback),
- emw);
+
+ emw->card = NULL;
}
static void
@@ -158,12 +178,11 @@ e_minicard_widget_destroy (GtkObject *object)
{
EMinicardWidget *emw = E_MINICARD_WIDGET(object);
- g_free(emw->dnd_code);
- if (emw->full_header)
- gtk_object_unref(GTK_OBJECT(emw->full_header));
-
- if (emw->gui)
- gtk_object_unref(GTK_OBJECT(emw->gui));
+ if (emw->card)
+ gtk_object_unref(GTK_OBJECT(emw->card));
+
+ if (GTK_OBJECT_CLASS(parent_class)->destroy)
+ GTK_OBJECT_CLASS(parent_class)->destroy(object);
}
GtkWidget*
@@ -180,7 +199,7 @@ e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_CARD:
- if (emw->full_header)
+ if (emw->card)
gtk_object_unref(GTK_OBJECT(emw->card));
if (GTK_VALUE_OBJECT(*arg)) {
emw->card = E_CARD(GTK_VALUE_OBJECT(*arg));
@@ -205,7 +224,10 @@ e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_CARD:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card);
+ if (emw->card)
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card);
+ else
+ GTK_VALUE_OBJECT (*arg) = NULL;
break;
default:
arg->type = GTK_TYPE_INVALID;
diff --git a/addressbook/gui/minicard/e-minicard-widget.h b/addressbook/gui/minicard/e-minicard-widget.h
index 9656e41693..8a3ec0ae16 100644
--- a/addressbook/gui/minicard/e-minicard-widget.h
+++ b/addressbook/gui/minicard/e-minicard-widget.h
@@ -22,8 +22,8 @@
#define __E_MINICARD_WIDGET_H__
#include <gnome.h>
-#include <glade/glade.h>
-#include "e-table-header.h"
+#include "addressbook/backend/ebook/e-card.h"
+#include "e-util/e-canvas.h"
#ifdef __cplusplus
extern "C" {
@@ -40,13 +40,13 @@ extern "C" {
#define E_MINICARD_WIDGET_TYPE (e_minicard_widget_get_type ())
#define E_MINICARD_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_WIDGET_TYPE, EMinicardWidget))
-#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, ETableFieldChooserClass))
-#define E_IS_TABLE_FIELD_CHOOSER(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
+#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, EMinicardWidgetClass))
+#define E_IS_MINICARD_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
+#define E_IS_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
typedef struct _EMinicardWidget EMinicardWidget;
-typedef struct _ETableFieldChooserClass ETableFieldChooserClass;
+typedef struct _EMinicardWidgetClass EMinicardWidgetClass;
struct _EMinicardWidget
{
@@ -59,7 +59,7 @@ struct _EMinicardWidget
ECard *card;
};
-struct _ETableFieldChooserClass
+struct _EMinicardWidgetClass
{
ECanvasClass parent_class;
};