aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-15 10:54:26 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-15 10:54:26 +0800
commit4f5907874da6c128db8276713751a1b0313522b0 (patch)
treeb59d0bb60625b0a53823c49a92e8bbd778510225 /addressbook
parentf60cb1f5371ad819960d43585cdd4b28eb465e59 (diff)
downloadgsoc2013-evolution-4f5907874da6c128db8276713751a1b0313522b0.tar.gz
gsoc2013-evolution-4f5907874da6c128db8276713751a1b0313522b0.tar.zst
gsoc2013-evolution-4f5907874da6c128db8276713751a1b0313522b0.zip
clean this up a tad.
2002-11-14 Chris Toshok <toshok@ximian.com> * gui/widgets/gal-view-factory-minicard.c: clean this up a tad. * gui/widgets/e-addressbook-view.c (init_collection): re-enable this. (setup_menus): same. * gui/widgets/gal-view-minicard.[ch]: more GObject work. svn path=/trunk/; revision=18776
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog10
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c27
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c81
-rw-r--r--addressbook/gui/widgets/gal-view-factory-minicard.c42
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c10
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.h1
6 files changed, 38 insertions, 133 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index a824465777..7664d92f7a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,13 @@
+2002-11-14 Chris Toshok <toshok@ximian.com>
+
+ * gui/widgets/gal-view-factory-minicard.c: clean this up a tad.
+
+ * gui/widgets/e-addressbook-view.c (init_collection): re-enable
+ this.
+ (setup_menus): same.
+
+ * gui/widgets/gal-view-minicard.[ch]: more GObject work.
+
2002-11-12 Chris Toshok <toshok@ximian.com>
* gui/contact-editor/e-contact-editor.c (_popup_position): push_in
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 5b1d4e74e7..3c2bb20386 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -51,18 +51,27 @@ unlink_model(EAddressbookReflowAdapter *adapter)
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- g_signal_handler_disconnect (priv->model,
- priv->create_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->remove_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->modify_card_id);
+ if (priv->model && priv->create_card_id)
+ g_signal_handler_disconnect (priv->model,
+ priv->create_card_id);
+ if (priv->model && priv->remove_card_id)
+ g_signal_handler_disconnect (priv->model,
+ priv->remove_card_id);
+ if (priv->model && priv->modify_card_id)
+ g_signal_handler_disconnect (priv->model,
+ priv->modify_card_id);
+
+ if (priv->model && priv->model_changed_id)
+ g_signal_handler_disconnect (priv->model,
+ priv->model_changed_id);
priv->create_card_id = 0;
priv->remove_card_id = 0;
priv->modify_card_id = 0;
+ priv->model_changed_id = 0;
- g_object_unref (priv->model);
+ if (priv->model)
+ g_object_unref (priv->model);
priv->model = NULL;
}
@@ -94,7 +103,7 @@ text_height (GnomeCanvas *canvas, const gchar *text)
}
static void
-addressbook_finalize(GObject *object)
+addressbook_dispose(GObject *object)
{
EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
@@ -343,7 +352,7 @@ e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
object_class->set_property = addressbook_set_property;
object_class->get_property = addressbook_get_property;
- object_class->finalize = addressbook_finalize;
+ object_class->dispose = addressbook_dispose;
g_object_class_install_property (object_class, PROP_BOOK,
g_param_spec_object ("book",
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 5c4cd58ac3..d85df8a35d 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -370,7 +370,6 @@ writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
static void
init_collection (void)
{
-#ifdef PENDING_PORT_WORK
GalViewFactory *factory;
ETableSpecification *spec;
char *galview;
@@ -401,7 +400,6 @@ init_collection (void)
gal_view_collection_load(collection);
}
-#endif
}
static void
@@ -413,7 +411,7 @@ display_view(GalViewInstance *instance,
if (GAL_IS_VIEW_ETABLE(view)) {
change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE);
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))*/ {
+ } else if (GAL_IS_VIEW_MINICARD(view)) {
change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW_WIDGET (address_view->object));
}
@@ -423,7 +421,6 @@ display_view(GalViewInstance *instance,
static void
setup_menus (EAddressbookView *view)
{
-#if PENDING_PORT_WORK
if (view->book && view->view_instance == NULL) {
init_collection ();
view->view_instance = gal_view_instance_new (collection, e_book_get_uri (view->book));
@@ -438,7 +435,6 @@ setup_menus (EAddressbookView *view)
g_signal_connect(view->view_instance, "display_view",
G_CALLBACK (display_view), view);
}
-#endif
}
static void
@@ -1745,81 +1741,6 @@ get_selected_cards (EAddressbookView *view)
return list;
}
-#if 0
-void
-e_addressbook_view_save_state (EAddressbookView *view, const char *filename)
-{
- xmlDoc *doc;
- xmlNode *node;
-
- doc = xmlNewDoc ("1.0");
- node = xmlNewDocNode (doc, NULL, "addressbook-view", NULL);
- xmlDocSetRootElement (doc, node);
-
- switch (view->view_type) {
- case E_ADDRESSBOOK_VIEW_MINICARD: {
- int column_width;
- e_xml_set_string_prop_by_name (node, "style", "minicard");
- g_object_get (view->object,
- "column_width", &column_width,
- NULL);
- e_xml_set_integer_prop_by_name (node, "column-width", column_width);
- break;
- }
- case E_ADDRESSBOOK_VIEW_TABLE: {
- ETableState *state;
- state = e_table_get_state_object (E_TABLE (view->widget));
-
- e_xml_set_string_prop_by_name (node, "style", "table");
- e_table_state_save_to_node (state, node);
- g_object_unref (state);
- break;
- }
- default:
- xmlFreeDoc(doc);
- return;
- }
- xmlSaveFile (filename, doc);
- xmlFreeDoc(doc);
-}
-
-void
-e_addressbook_view_load_state (EAddressbookView *view, const char *filename)
-{
- xmlDoc *doc;
-
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *node;
- char *type;
-
- node = xmlDocGetRootElement (doc);
- type = e_xml_get_string_prop_by_name (node, "style");
-
- if (!strcmp (type, "minicard")) {
- int column_width;
-
- change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD);
-
- column_width = e_xml_get_integer_prop_by_name (node, "column-width");
- g_object_set (view->object,
- "column_width", column_width,
- NULL);
- } else if (!strcmp (type, "table")) {
- ETableState *state;
-
- change_view_type (view, E_ADDRESSBOOK_VIEW_TABLE);
-
- state = e_table_state_new();
- e_table_state_load_from_node (state, node->xmlChildrenNode);
- e_table_set_state_object (E_TABLE (view->widget), state);
- g_object_unref (state);
- }
- xmlFreeDoc(doc);
- }
-}
-#endif
-
void
e_addressbook_view_save_as (EAddressbookView *view)
{
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.c b/addressbook/gui/widgets/gal-view-factory-minicard.c
index e6cac225ce..9fbff1f774 100644
--- a/addressbook/gui/widgets/gal-view-factory-minicard.c
+++ b/addressbook/gui/widgets/gal-view-factory-minicard.c
@@ -13,9 +13,7 @@
#include "gal-view-factory-minicard.h"
#include "gal-view-minicard.h"
-#define GVFE_CLASS(e) ((GalViewFactoryMinicardClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gal_view_factory_get_type ()
+#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE
static GalViewFactoryClass *gal_view_factory_minicard_parent_class;
@@ -39,24 +37,14 @@ gal_view_factory_minicard_get_type_code (GalViewFactory *factory)
}
static void
-gal_view_factory_minicard_destroy (GtkObject *object)
-{
-#if 0
- GalViewFactoryMinicard *factory = GAL_VIEW_FACTORY_MINICARD(object);
-#endif
-}
-
-static void
-gal_view_factory_minicard_class_init (GtkObjectClass *object_class)
+gal_view_factory_minicard_class_init (GObjectClass *object_class)
{
GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_minicard_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_factory_minicard_parent_class = g_type_class_ref (PARENT_TYPE);
view_factory_class->get_title = gal_view_factory_minicard_get_title;
view_factory_class->new_view = gal_view_factory_minicard_new_view;
view_factory_class->get_type_code = gal_view_factory_minicard_get_type_code;
-
- object_class->destroy = gal_view_factory_minicard_destroy;
}
static void
@@ -93,26 +81,4 @@ gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory)
return GAL_VIEW_FACTORY(factory);
}
-GType
-gal_view_factory_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (GalViewFactoryMinicardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gal_view_factory_minicard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GalViewFactoryMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_factory_minicard_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalViewFactoryMinicard", &info, 0);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_view_factory_minicard, "GalViewFactoryMinicard", GalViewFactoryMinicard, gal_view_factory_minicard_class_init, gal_view_factory_minicard_init, PARENT_TYPE)
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
index 44e4e9c86c..95a81c7607 100644
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ b/addressbook/gui/widgets/gal-view-minicard.c
@@ -78,7 +78,7 @@ gal_view_minicard_clone (GalView *view)
gvm = GAL_VIEW_MINICARD(view);
- new = gtk_type_new (gal_view_minicard_get_type ());
+ new = g_object_new (GAL_TYPE_VIEW_MINICARD, NULL);
new->title = g_strdup (gvm->title);
new->column_width = gvm->column_width;
@@ -86,7 +86,7 @@ gal_view_minicard_clone (GalView *view)
}
static void
-gal_view_minicard_destroy (GtkObject *object)
+gal_view_minicard_dispose (GObject *object)
{
GalViewMinicard *view = GAL_VIEW_MINICARD(object);
gal_view_minicard_detach (view);
@@ -94,10 +94,10 @@ gal_view_minicard_destroy (GtkObject *object)
}
static void
-gal_view_minicard_class_init (GtkObjectClass *object_class)
+gal_view_minicard_class_init (GObjectClass *object_class)
{
GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_minicard_parent_class = gtk_type_class (PARENT_TYPE);
+ gal_view_minicard_parent_class = g_type_class_ref (PARENT_TYPE);
gal_view_class->edit = gal_view_minicard_edit ;
gal_view_class->load = gal_view_minicard_load ;
@@ -107,7 +107,7 @@ gal_view_minicard_class_init (GtkObjectClass *object_class)
gal_view_class->get_type_code = gal_view_minicard_get_type_code;
gal_view_class->clone = gal_view_minicard_clone ;
- object_class->destroy = gal_view_minicard_destroy ;
+ object_class->dispose = gal_view_minicard_dispose ;
}
static void
diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h
index 2d267d71d0..e586012f73 100644
--- a/addressbook/gui/widgets/gal-view-minicard.h
+++ b/addressbook/gui/widgets/gal-view-minicard.h
@@ -10,7 +10,6 @@
#ifndef _GAL_VIEW_MINICARD_H_
#define _GAL_VIEW_MINICARD_H_
-#include <gtk/gtkobject.h>
#include <gal/menus/gal-view.h>
#include <e-minicard-view-widget.h>