aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-09 11:26:48 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-09 11:26:48 +0800
commit93e3a5b7a26de02fd34045c4b127e3349d89add4 (patch)
tree6055965377649723fbc292c16213e4522ee7300c
parent0b1546202c75992262a3da84bcf8adf2c216022a (diff)
downloadgsoc2013-evolution-93e3a5b7a26de02fd34045c4b127e3349d89add4.tar.gz
gsoc2013-evolution-93e3a5b7a26de02fd34045c4b127e3349d89add4.tar.zst
gsoc2013-evolution-93e3a5b7a26de02fd34045c4b127e3349d89add4.zip
port work.
2002-11-08 Chris Toshok <toshok@ximian.com> * gui/widgets/test-reflow.c: port work. * gui/widgets/test-minicard-view.c: port work. * gui/widgets/e-minicard.[ch]: port work. * gui/widgets/e-minicard-widget.c: port work. * gui/widgets/e-minicard-view.c: port work. * gui/widgets/e-minicard-view-widget.c (e_minicard_view_widget_size_allocate): gtk_->g_ change i missed. (e_minicard_view_widget_reflow): same. * gui/widgets/e-minicard-label.c: port work. * gui/widgets/e-minicard-control.c (get_prop): gtk_->g_ change i missed. * gui/widgets/e-addressbook-view.c (setup_menus): ifdef this PENDING_PORT_WORK for now. (has_email_address_1): gtk_->g_ change i missed. (print): remove the PENDING_PORT_WORK from here, as the print_* symbols now resolve. (delete): gtk_->g_ changes. (new_card): same. (new_list): same. (sources): same. (create_minicard_view): same. (table_double_click): same. (create_table_view): same. (e_contact_print_destroy): same. (e_contact_print_button): same. (e_addressbook_view_print): same, and remove the PENDING_PORT_WORK ifdef. (e_addressbook_view_print_preview): same. (do_remove): gtk_->g_ changes. (e_addressbook_view_save_state): same. (view_transfer_cards): same. * gui/widgets/e-addressbook-view.h (struct _EAddressbookView): GtkObject -> GObject. * gui/widgets/e-addressbook-util.c (e_addressbook_error_dialog): GnomeDialog -> GtkDialog. * gui/widgets/e-addressbook-table-adapter.c (addressbook_set_value_at): a gtk_->g_ change i missed. (e_addressbook_table_adapter_class_init): gtk_type_class -> g_type_class_peek_parent. * gui/widgets/e-addressbook-reflow-adapter.c (addressbook_get_property): use g_object_get_property for aggregated properties. (e_addressbook_reflow_adapter_class_init): gtk_type_class -> g_type_class_peek_parent. * gui/merging/e-card-merging.c (match_query_callback): some misc gtk_->g_ changes i missed. svn path=/trunk/; revision=18682
-rw-r--r--addressbook/ChangeLog62
-rw-r--r--addressbook/gui/merging/e-card-merging.c16
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c23
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c8
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.c3
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c94
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-control.c4
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c229
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c12
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c167
-rw-r--r--addressbook/gui/widgets/e-minicard-widget.c84
-rw-r--r--addressbook/gui/widgets/e-minicard.c91
-rw-r--r--addressbook/gui/widgets/e-minicard.h2
-rw-r--r--addressbook/gui/widgets/test-minicard-view.c18
-rw-r--r--addressbook/gui/widgets/test-reflow.c12
16 files changed, 480 insertions, 347 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7fc97721e8..19690a432c 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,67 @@
2002-11-08 Chris Toshok <toshok@ximian.com>
+ * gui/widgets/test-reflow.c: port work.
+
+ * gui/widgets/test-minicard-view.c: port work.
+
+ * gui/widgets/e-minicard.[ch]: port work.
+
+ * gui/widgets/e-minicard-widget.c: port work.
+
+ * gui/widgets/e-minicard-view.c: port work.
+
+ * gui/widgets/e-minicard-view-widget.c
+ (e_minicard_view_widget_size_allocate): gtk_->g_ change i missed.
+ (e_minicard_view_widget_reflow): same.
+
+ * gui/widgets/e-minicard-label.c: port work.
+
+ * gui/widgets/e-minicard-control.c (get_prop): gtk_->g_ change i
+ missed.
+
+ * gui/widgets/e-addressbook-view.c (setup_menus): ifdef this
+ PENDING_PORT_WORK for now.
+ (has_email_address_1): gtk_->g_ change i missed.
+ (print): remove the PENDING_PORT_WORK from here, as the print_*
+ symbols now resolve.
+ (delete): gtk_->g_ changes.
+ (new_card): same.
+ (new_list): same.
+ (sources): same.
+ (create_minicard_view): same.
+ (table_double_click): same.
+ (create_table_view): same.
+ (e_contact_print_destroy): same.
+ (e_contact_print_button): same.
+ (e_addressbook_view_print): same, and remove the PENDING_PORT_WORK
+ ifdef.
+ (e_addressbook_view_print_preview): same.
+ (do_remove): gtk_->g_ changes.
+ (e_addressbook_view_save_state): same.
+ (view_transfer_cards): same.
+
+ * gui/widgets/e-addressbook-view.h (struct _EAddressbookView):
+ GtkObject -> GObject.
+
+ * gui/widgets/e-addressbook-util.c (e_addressbook_error_dialog):
+ GnomeDialog -> GtkDialog.
+
+ * gui/widgets/e-addressbook-table-adapter.c
+ (addressbook_set_value_at): a gtk_->g_ change i missed.
+ (e_addressbook_table_adapter_class_init): gtk_type_class ->
+ g_type_class_peek_parent.
+
+ * gui/widgets/e-addressbook-reflow-adapter.c
+ (addressbook_get_property): use g_object_get_property for
+ aggregated properties.
+ (e_addressbook_reflow_adapter_class_init): gtk_type_class ->
+ g_type_class_peek_parent.
+
+ * gui/merging/e-card-merging.c (match_query_callback): some misc
+ gtk_->g_ changes i missed.
+
+2002-11-08 Chris Toshok <toshok@ximian.com>
+
* gui/component/select-names/e-select-names-model.h: parent class
is GObjectClass.
diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c
index e46164e92a..28357f2f58 100644
--- a/addressbook/gui/merging/e-card-merging.c
+++ b/addressbook/gui/merging/e-card-merging.c
@@ -91,19 +91,19 @@ match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer c
}
widget = glade_xml_get_widget (ui, "custom-old-card");
- gtk_object_set (GTK_OBJECT (widget),
- "card", match,
- NULL);
+ g_object_set (widget,
+ "card", match,
+ NULL);
widget = glade_xml_get_widget (ui, "custom-new-card");
- gtk_object_set (GTK_OBJECT (widget),
- "card", card,
- NULL);
+ g_object_set (widget,
+ "card", card,
+ NULL);
widget = glade_xml_get_widget (ui, "dialog-duplicate-contact");
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- GTK_SIGNAL_FUNC (clicked), lookup);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (clicked), lookup);
}
}
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 1310442471..01e1eb120b 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -310,28 +310,19 @@ addressbook_get_property (GObject *object, guint prop_id, GValue *value, GParamS
switch (prop_id) {
case PROP_BOOK: {
- EBook *book;
- g_object_get (GTK_OBJECT (priv->model),
- "book", &book,
- NULL);
-
- g_value_set_object (value, book);
+ g_object_get_property (priv->model,
+ "book", value);
break;
}
case PROP_QUERY: {
char *query;
- g_object_get (priv->model,
- "query", &query,
- NULL);
- g_value_set_string (value, query);
+ g_object_get_property (priv->model,
+ "query", value);
break;
}
case PROP_EDITABLE: {
- gboolean editable;
- g_object_get (priv->model,
- "editable", &editable,
- NULL);
- g_value_set_boolean (value, editable);
+ g_object_get_property (priv->model,
+ "editable", value);
break;
}
case PROP_MODEL:
@@ -348,7 +339,7 @@ e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
{
EReflowModelClass *model_class = (EReflowModelClass *) object_class;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (object_class);
object_class->set_property = addressbook_set_property;
object_class->get_property = addressbook_get_property;
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index eecb6248fd..5f09727ee0 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -157,9 +157,9 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
e_card_simple_set(priv->simples[row],
col,
val);
- gtk_object_get(GTK_OBJECT(priv->simples[row]),
- "card", &card,
- NULL);
+ g_object_get(priv->simples[row],
+ "card", &card,
+ NULL);
e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model),
card, card_modified_cb, NULL);
@@ -251,7 +251,7 @@ e_addressbook_table_adapter_class_init (GtkObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (object_class);
object_class->destroy = addressbook_destroy;
diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c
index d9c336c648..93727b7e1b 100644
--- a/addressbook/gui/widgets/e-addressbook-util.c
+++ b/addressbook/gui/widgets/e-addressbook-util.c
@@ -50,7 +50,8 @@ e_addressbook_error_dialog (const gchar *msg, EBookStatus status)
error_msg = g_strdup_printf ("%s: %s", msg, _(status_to_string [status]));
- gtk_widget_show (gnome_error_dialog (error_msg));
+ gtk_widget_show (gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ error_msg));
g_free (error_msg);
}
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 46019b2f94..0651ddd152 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -370,6 +370,7 @@ writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
static void
init_collection (void)
{
+#ifdef PENDING_PORT_WORK
GalViewFactory *factory;
ETableSpecification *spec;
char *galview;
@@ -400,6 +401,7 @@ init_collection (void)
gal_view_collection_load(collection);
}
+#endif
}
static void
@@ -612,9 +614,9 @@ has_email_address_1(gint model_row,
card = e_addressbook_model_peek_card(view->model, model_row);
- gtk_object_get (GTK_OBJECT (card),
- "email", &email,
- NULL);
+ g_object_get (G_OBJECT (card),
+ "email", &email,
+ NULL);
if (e_list_length (email) > 0)
*has_email = TRUE;
@@ -671,7 +673,6 @@ send_to (GtkWidget *widget, CardAndBook *card_and_book)
static void
print (GtkWidget *widget, CardAndBook *card_and_book)
{
-#ifdef PENDING_PORT_WORK
GList *cards = get_card_list (card_and_book);
if (cards) {
if (cards->next)
@@ -680,7 +681,6 @@ print (GtkWidget *widget, CardAndBook *card_and_book)
gtk_widget_show(e_contact_print_card_dialog_new(cards->data));
e_free_object_list(cards);
}
-#endif
}
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
@@ -722,9 +722,9 @@ delete (GtkWidget *widget, CardAndBook *card_and_book)
GList *list = get_card_list(card_and_book);
GList *iterator;
- gtk_object_get(GTK_OBJECT(card_and_book->view->model),
- "book", &book,
- NULL);
+ g_object_get(card_and_book->view->model,
+ "book", &book,
+ NULL);
for (iterator = list; iterator; iterator = iterator->next) {
ECard *card = iterator->data;
@@ -761,9 +761,9 @@ new_card (GtkWidget *widget, CardAndBook *card_and_book)
{
EBook *book;
- gtk_object_get(GTK_OBJECT(card_and_book->view->model),
- "book", &book,
- NULL);
+ g_object_get(card_and_book->view->model,
+ "book", &book,
+ NULL);
e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, TRUE);
}
@@ -772,9 +772,9 @@ new_list (GtkWidget *widget, CardAndBook *card_and_book)
{
EBook *book;
- gtk_object_get(GTK_OBJECT(card_and_book->view->model),
- "book", &book,
- NULL);
+ g_object_get(card_and_book->view->model,
+ "book", &book,
+ NULL);
e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE);
}
@@ -786,7 +786,7 @@ sources (GtkWidget *widget, CardAndBook *card_and_book)
GNOME_Evolution_ShellView shell_view;
CORBA_Environment ev;
- control = gtk_object_get_data (GTK_OBJECT (gcal), "control");
+ control = g_object_get_data (G_OBJECT (gcal), "control");
if (control == NULL)
return;
@@ -1132,7 +1132,7 @@ create_minicard_view (EAddressbookView *view)
G_CALLBACK(minicard_right_click), view);
- view->object = GTK_OBJECT(minicard_view);
+ view->object = G_OBJECT(minicard_view);
view->widget = minicard_hbox;
scrollframe = e_scroll_frame_new (NULL, NULL);
@@ -1177,9 +1177,9 @@ table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, E
ECard *card = e_addressbook_model_get_card(model, row);
EBook *book;
- gtk_object_get(GTK_OBJECT(model),
- "book", &book,
- NULL);
+ g_object_get(model,
+ "book", &book,
+ NULL);
g_assert (E_IS_BOOK (book));
@@ -1333,7 +1333,7 @@ create_table_view (EAddressbookView *view)
initial layout. It does the rest. */
table = e_table_scrolled_new_from_spec_file (adapter, NULL, EVOLUTION_ETSPECDIR "/e-addressbook-view.etspec", NULL);
- view->object = GTK_OBJECT(adapter);
+ view->object = G_OBJECT(adapter);
view->widget = table;
g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "double_click",
@@ -1398,8 +1398,8 @@ change_view_type (EAddressbookView *view, EAddressbookViewType view_type)
static void
e_contact_print_destroy(GnomeDialog *dialog, gpointer data)
{
- ETableScrolled *table = gtk_object_get_data(GTK_OBJECT(dialog), "table");
- EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable");
+ ETableScrolled *table = g_object_get_data(G_OBJECT(dialog), "table");
+ EPrintable *printable = g_object_get_data(G_OBJECT(dialog), "printable");
g_object_unref (printable);
g_object_unref (table);
}
@@ -1409,7 +1409,7 @@ e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data)
{
GnomePrintMaster *master;
GnomePrintContext *pc;
- EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable");
+ EPrintable *printable = g_object_get_data(G_OBJECT(dialog), "printable");
GtkWidget *preview;
switch( button ) {
case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
@@ -1516,16 +1516,15 @@ e_addressbook_view_discard_menus (EAddressbookView *view)
void
e_addressbook_view_print(EAddressbookView *view)
{
-#ifdef PENDING_PORT_WORK
if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
char *query;
EBook *book;
GtkWidget *print;
- gtk_object_get (GTK_OBJECT(view->model),
- "query", &query,
- "book", &book,
- NULL);
+ g_object_get (view->model,
+ "query", &query,
+ "book", &book,
+ NULL);
print = e_contact_print_dialog_new(book, query);
g_free(query);
gtk_widget_show_all(print);
@@ -1538,7 +1537,7 @@ e_addressbook_view_print(EAddressbookView *view)
gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
NULL, NULL, NULL);
- gtk_object_get(GTK_OBJECT(view->widget), "table", &etable, NULL);
+ g_object_get(view->widget, "table", &etable, NULL);
printable = e_table_get_printable(etable);
g_object_ref (view->widget);
@@ -1550,23 +1549,21 @@ e_addressbook_view_print(EAddressbookView *view)
"clicked", G_CALLBACK(e_contact_print_button), NULL);
g_signal_connect(dialog,
"destroy", G_CALLBACK(e_contact_print_destroy), NULL);
- g_widget_show(dialog);
+ gtk_widget_show(dialog);
}
-#endif
}
void
e_addressbook_view_print_preview(EAddressbookView *view)
{
-#ifdef PENDING_PORT_WORK
if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
char *query;
EBook *book;
- gtk_object_get (GTK_OBJECT(view->model),
- "query", &query,
- "book", &book,
- NULL);
+ g_object_get (view->model,
+ "query", &query,
+ "book", &book,
+ NULL);
e_contact_print_preview(book, query);
g_free(query);
} else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) {
@@ -1574,13 +1571,15 @@ e_addressbook_view_print_preview(EAddressbookView *view)
ETable *etable;
GnomePrintMaster *master;
GnomePrintContext *pc;
+ GnomePrintConfig *config;
GtkWidget *preview;
- gtk_object_get(GTK_OBJECT(view->widget), "table", &etable, NULL);
+ g_object_get(view->widget, "table", &etable, NULL);
printable = e_table_get_printable(etable);
master = gnome_print_master_new();
- gnome_print_master_set_copies (master, 1, FALSE);
+ config = gnome_print_master_get_config (master);
+ gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1);
pc = gnome_print_master_get_context( master );
e_printable_reset(printable);
while (e_printable_data_left(printable)) {
@@ -1604,7 +1603,6 @@ e_addressbook_view_print_preview(EAddressbookView *view)
g_object_unref (master);
g_object_unref (printable);
}
-#endif
}
static void
@@ -1622,9 +1620,9 @@ do_remove (int i, gpointer user_data)
ECard *card;
EAddressbookView *view = user_data;
- gtk_object_get (GTK_OBJECT(view->model),
- "book", &book,
- NULL);
+ g_object_get (view->model,
+ "book", &book,
+ NULL);
card = e_addressbook_model_get_card (view->model, i);
@@ -1748,9 +1746,9 @@ e_addressbook_view_save_state (EAddressbookView *view, const char *filename)
case E_ADDRESSBOOK_VIEW_MINICARD: {
int column_width;
e_xml_set_string_prop_by_name (node, "style", "minicard");
- gtk_object_get (GTK_OBJECT (view->object),
- "column_width", &column_width,
- NULL);
+ g_object_get (view->object,
+ "column_width", &column_width,
+ NULL);
e_xml_set_integer_prop_by_name (node, "column-width", column_width);
break;
}
@@ -1898,9 +1896,9 @@ view_transfer_cards (EAddressbookView *view, gboolean delete_from_source)
GList *cards;
GtkWindow *parent_window;
- gtk_object_get(GTK_OBJECT(view->model),
- "book", &book,
- NULL);
+ g_object_get(view->model,
+ "book", &book,
+ NULL);
cards = get_selected_cards (view);
parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index bf7b987b75..0ec5cfabe8 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -72,7 +72,7 @@ struct _EAddressbookView
char *query;
guint editable : 1;
- GtkObject *object;
+ GObject *object;
GtkWidget *widget;
GtkWidget *current_alphabet_widget;
diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c
index 782e384029..c5256f6c3e 100644
--- a/addressbook/gui/widgets/e-minicard-control.c
+++ b/addressbook/gui/widgets/e-minicard-control.c
@@ -49,13 +49,13 @@ get_prop (BonoboPropertyBag *bag,
CORBA_Environment *ev,
gpointer user_data)
{
- GtkObject *clock = user_data;
+ GObject *clock = user_data;
switch (arg_id) {
case PROP_RUNNING:
{
- gboolean b = GPOINTER_TO_UINT (gtk_object_get_data (clock, RUNNING_KEY));
+ gboolean b = GPOINTER_TO_UINT (g_object_get_data (clock, RUNNING_KEY));
BONOBO_ARG_SET_BOOLEAN (arg, b);
break;
}
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index 22ec585c96..7fef48a63b 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -25,6 +25,7 @@
#include <gtk/gtksignal.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
+#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas.h>
@@ -33,8 +34,8 @@
static void e_minicard_label_init (EMinicardLabel *card);
static void e_minicard_label_class_init (EMinicardLabelClass *klass);
-static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
static void e_minicard_label_realize (GnomeCanvasItem *item);
static void e_minicard_label_unrealize (GnomeCanvasItem *item);
@@ -46,15 +47,15 @@ static GnomeCanvasGroupClass *parent_class = NULL;
/* The arguments we take */
enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_HAS_FOCUS,
- ARG_FIELD,
- ARG_FIELDNAME,
- ARG_TEXT_MODEL,
- ARG_MAX_FIELD_NAME_WIDTH,
- ARG_EDITABLE
+ PROP_0,
+ PROP_WIDTH,
+ PROP_HEIGHT,
+ PROP_HAS_FOCUS,
+ PROP_FIELD,
+ PROP_FIELDNAME,
+ PROP_TEXT_MODEL,
+ PROP_MAX_FIELD_NAME_WIDTH,
+ PROP_EDITABLE
};
GType
@@ -84,39 +85,78 @@ e_minicard_label_get_type (void)
static void
e_minicard_label_class_init (EMinicardLabelClass *klass)
{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELD);
- gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELDNAME);
- gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_TEXT_MODEL);
- gtk_object_add_arg_type ("EMinicardLabel::max_field_name_length", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MAX_FIELD_NAME_WIDTH);
- gtk_object_add_arg_type ("EMinicardLabel::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- object_class->set_arg = e_minicard_label_set_arg;
- object_class->get_arg = e_minicard_label_get_arg;
- /* object_class->destroy = e_minicard_label_destroy; */
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_label_realize;
- item_class->unrealize = e_minicard_label_unrealize;
- item_class->event = e_minicard_label_event;
+ GObjectClass *object_class;
+ GnomeCanvasItemClass *item_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ item_class = (GnomeCanvasItemClass *) klass;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->set_property = e_minicard_label_set_property;
+ object_class->get_property = e_minicard_label_get_property;
+ /* object_class->destroy = e_minicard_label_destroy; */
+
+ g_object_class_install_property (object_class, PROP_WIDTH,
+ g_param_spec_double ("width",
+ _("Width"),
+ /*_( */"XXX blurb" /*)*/,
+ 0.0, G_MAXDOUBLE, 10.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_HEIGHT,
+ g_param_spec_double ("height",
+ _("Height"),
+ /*_( */"XXX blurb" /*)*/,
+ 0.0, G_MAXDOUBLE, 10.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_HAS_FOCUS,
+ g_param_spec_boolean ("has_focus",
+ _("Has Focus"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FIELD,
+ g_param_spec_string ("field",
+ _("Field"),
+ /*_( */"XXX blurb" /*)*/,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FIELDNAME,
+ g_param_spec_string ("fieldname",
+ _("Field Name"),
+ /*_( */"XXX blurb" /*)*/,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_TEXT_MODEL,
+ g_param_spec_object ("text_model",
+ _("Text Model"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_TEXT_MODEL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_MAX_FIELD_NAME_WIDTH,
+ g_param_spec_double ("max_field_name_length",
+ _("Max field name length"),
+ /*_( */"XXX blurb" /*)*/,
+ -1.0, G_MAXDOUBLE, -1.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _("Editable"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ /* GnomeCanvasItem method overrides */
+ item_class->realize = e_minicard_label_realize;
+ item_class->unrealize = e_minicard_label_unrealize;
+ item_class->event = e_minicard_label_event;
}
static void
@@ -134,82 +174,83 @@ e_minicard_label_init (EMinicardLabel *minicard_label)
}
static void
-e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
- GnomeCanvasItem *item;
EMinicardLabel *e_minicard_label;
+ GnomeCanvasItem *item;
- item = GNOME_CANVAS_ITEM (o);
- e_minicard_label = E_MINICARD_LABEL (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- e_minicard_label->width = GTK_VALUE_DOUBLE (*arg);
+ e_minicard_label = E_MINICARD_LABEL (object);
+ item = GNOME_CANVAS_ITEM (object);
+
+ switch (prop_id){
+ case PROP_WIDTH:
+ e_minicard_label->width = g_value_get_double (value);
e_minicard_label_resize_children(e_minicard_label);
e_canvas_item_request_reflow (item);
break;
- case ARG_HAS_FOCUS:
- if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE))
+ case PROP_HAS_FOCUS:
+ if (e_minicard_label->field && (g_value_get_boolean (value) != E_FOCUS_NONE))
e_canvas_item_grab_focus(e_minicard_label->field, FALSE);
break;
- case ARG_FIELD:
- gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL );
+ case PROP_FIELD:
+ gnome_canvas_item_set( e_minicard_label->field, "text", g_value_get_string (value), NULL );
break;
- case ARG_FIELDNAME:
- gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL );
+ case PROP_FIELDNAME:
+ gnome_canvas_item_set( e_minicard_label->fieldname, "text", g_value_get_string (value), NULL );
break;
- case ARG_TEXT_MODEL:
- gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL);
+ case PROP_TEXT_MODEL:
+ gnome_canvas_item_set( e_minicard_label->field, "model", g_value_get_object (value), NULL);
break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- e_minicard_label->max_field_name_length = GTK_VALUE_DOUBLE (*arg);
+ case PROP_MAX_FIELD_NAME_WIDTH:
+ e_minicard_label->max_field_name_length = g_value_get_double (value);
break;
- case ARG_EDITABLE:
- e_minicard_label->editable = GTK_VALUE_BOOL (*arg);
+ case PROP_EDITABLE:
+ e_minicard_label->editable = g_value_get_boolean (value);
g_object_set (e_minicard_label->field, "editable", e_minicard_label->editable, NULL);
break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
EMinicardLabel *e_minicard_label;
- char *temp;
- ETextModel *tempmodel;
e_minicard_label = E_MINICARD_LABEL (object);
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width;
+ switch (prop_id) {
+ case PROP_WIDTH:
+ g_value_set_double (value, e_minicard_label->width);
break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height;
+ case PROP_HEIGHT:
+ g_value_set_double (value, e_minicard_label->height);
break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
+ case PROP_HAS_FOCUS:
+ g_value_set_boolean (value, e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE);
break;
- case ARG_FIELD:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
+ case PROP_FIELD:
+ g_object_get_property (G_OBJECT (e_minicard_label->field),
+ "text", value);
break;
- case ARG_FIELDNAME:
- gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
+ case PROP_FIELDNAME:
+ g_object_get_property (G_OBJECT (e_minicard_label->fieldname),
+ "text", value);
break;
- case ARG_TEXT_MODEL:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL );
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel);
+ case PROP_TEXT_MODEL:
+ g_object_get_property (G_OBJECT (e_minicard_label->field),
+ "model", value);
break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->max_field_name_length;
+ case PROP_MAX_FIELD_NAME_WIDTH:
+ g_value_set_double (value, e_minicard_label->max_field_name_length);
break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = e_minicard_label->editable;
+ case PROP_EDITABLE:
+ g_value_set_boolean (value, e_minicard_label->editable);
break;
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -428,16 +469,16 @@ e_minicard_label_reflow(GnomeCanvasItem *item, int flags)
old_height = e_minicard_label->height;
- gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname),
- "text_height", &text_height,
- NULL);
+ g_object_get(e_minicard_label->fieldname,
+ "text_height", &text_height,
+ NULL);
e_minicard_label->height = text_height;
- gtk_object_get(GTK_OBJECT(e_minicard_label->field),
- "text_height", &text_height,
- NULL);
+ g_object_get(e_minicard_label->field,
+ "text_height", &text_height,
+ NULL);
if (e_minicard_label->height < text_height)
e_minicard_label->height = text_height;
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 5a2d9c3e0e..3d484560bd 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -355,9 +355,9 @@ e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocatio
gnome_canvas_item_set( view->emv,
"minimum_width", (double) allocation->width,
NULL );
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
+ g_object_get(view->emv,
+ "width", &width,
+ NULL);
width = MAX(width, allocation->width);
gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1);
}
@@ -372,9 +372,9 @@ e_minicard_view_widget_reflow(ECanvas *canvas)
if (E_CANVAS_CLASS(parent_class)->reflow)
E_CANVAS_CLASS(parent_class)->reflow (canvas);
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
+ g_object_get(view->emv,
+ "width", &width,
+ NULL);
width = MAX(width, GTK_WIDGET(canvas)->allocation.width);
gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.height - 1);
}
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index afb08ef02f..661bf2753d 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -44,11 +44,11 @@ static EReflowClass *parent_class = NULL;
/* The arguments we take */
enum {
- ARG_0,
- ARG_ADAPTER,
- ARG_BOOK,
- ARG_QUERY,
- ARG_EDITABLE
+ PROP_0,
+ PROP_ADAPTER,
+ PROP_BOOK,
+ PROP_QUERY,
+ PROP_EDITABLE
};
@@ -132,9 +132,9 @@ set_empty_message (EMinicardView *view)
gboolean editable = FALSE;
if (view->adapter) {
- gtk_object_get (GTK_OBJECT (view->adapter),
- "editable", &editable,
- NULL);
+ g_object_get (view->adapter,
+ "editable", &editable,
+ NULL);
}
if (editable)
@@ -164,22 +164,23 @@ adapter_changed (EMinicardView *view)
}
static void
-e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+e_minicard_view_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GnomeCanvasItem *item;
EMinicardView *view;
- item = GNOME_CANVAS_ITEM (o);
- view = E_MINICARD_VIEW (o);
+ view = E_MINICARD_VIEW (object);
- switch (arg_id){
- case ARG_ADAPTER:
+ switch (prop_id){
+ case PROP_ADAPTER:
if (view->adapter) {
if (view->writable_status_id) {
EAddressbookModel *model;
- gtk_object_get (GTK_OBJECT (view->adapter),
- "model", &model,
- NULL);
+ g_object_get (view->adapter,
+ "model", &model,
+ NULL);
if (model) {
g_signal_handler_disconnect (model, view->writable_status_id);
}
@@ -188,7 +189,7 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
g_object_unref (view->adapter);
}
view->writable_status_id = 0;
- view->adapter = GTK_VALUE_POINTER (*arg);
+ view->adapter = g_value_get_object (value);
g_object_ref (view->adapter);
adapter_changed (view);
g_object_set (view,
@@ -196,9 +197,9 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
NULL);
if (view->adapter) {
EAddressbookModel *model;
- gtk_object_get (GTK_OBJECT (view->adapter),
- "model", &model,
- NULL);
+ g_object_get (view->adapter,
+ "model", &model,
+ NULL);
if (model) {
view->writable_status_id =
g_signal_connect (model, "writable_status",
@@ -207,60 +208,63 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
break;
- case ARG_BOOK:
+ case PROP_BOOK:
g_object_set (view->adapter,
- "book", GTK_VALUE_OBJECT (*arg),
+ "book", g_value_get_object (value),
NULL);
set_empty_message (view);
break;
- case ARG_QUERY:
+ case PROP_QUERY:
g_object_set (view->adapter,
- "query", GTK_VALUE_STRING (*arg),
+ "query", g_value_get_string (value),
NULL);
break;
- case ARG_EDITABLE:
+ case PROP_EDITABLE:
g_object_set (view->adapter,
- "editable", GTK_VALUE_BOOL (*arg),
+ "editable", g_value_get_boolean (value),
NULL);
set_empty_message (view);
break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_minicard_view_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EMinicardView *view;
view = E_MINICARD_VIEW (object);
- switch (arg_id) {
- case ARG_ADAPTER:
- GTK_VALUE_POINTER (*arg) = view->adapter;
+ switch (prop_id) {
+ case PROP_ADAPTER:
+ g_value_set_object (value, view->adapter);
break;
- case ARG_BOOK:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "book", &GTK_VALUE_OBJECT (*arg),
- NULL);
+ case PROP_BOOK:
+ g_object_get_property (G_OBJECT (view->adapter),
+ "book", value);
break;
- case ARG_QUERY:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "query", &GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_QUERY:
+ g_object_get_property (G_OBJECT (view->adapter),
+ "query", value);
break;
- case ARG_EDITABLE:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "editable", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_EDITABLE:
+ g_object_get_property (G_OBJECT (view->adapter),
+ "editable", value);
break;
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-e_minicard_view_destroy (GtkObject *object)
+e_minicard_view_dispose (GObject *object)
{
EMinicardView *view = E_MINICARD_VIEW(object);
@@ -272,9 +276,9 @@ e_minicard_view_destroy (GtkObject *object)
if (view->adapter) {
if (view->writable_status_id) {
EAddressbookModel *model;
- gtk_object_get (GTK_OBJECT (view->adapter),
- "model", &model,
- NULL);
+ g_object_get (view->adapter,
+ "model", &model,
+ NULL);
if (model) {
g_signal_handler_disconnect (model, view->writable_status_id);
}
@@ -285,7 +289,7 @@ e_minicard_view_destroy (GtkObject *object)
view->writable_status_id = 0;
view->adapter = NULL;
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
+ G_OBJECT_CLASS(parent_class)->dispose (object);
}
static guint
@@ -309,11 +313,11 @@ e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
if (((GdkEventButton *)event)->button == 1) {
gboolean editable;
- gtk_object_get(GTK_OBJECT(view->adapter), "editable", &editable, NULL);
+ g_object_get(view->adapter, "editable", &editable, NULL);
if (editable) {
EBook *book;
- gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
+ g_object_get(view, "book", &book, NULL);
if (book && E_IS_BOOK (book))
e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, editable);
@@ -387,9 +391,9 @@ do_remove (int i, gpointer user_data)
EBookCallback cb = viewcbclosure->cb;
gpointer closure = viewcbclosure->closure;
- gtk_object_get (GTK_OBJECT(view->adapter),
- "book", &book,
- NULL);
+ g_object_get (view->adapter,
+ "book", &book,
+ NULL);
card = e_addressbook_reflow_adapter_get_card (view->adapter, i);
@@ -411,9 +415,9 @@ compare_to_utf_str (EMinicard *card, const char *utf_str)
if (card->card) {
char *file_as;
- gtk_object_get(GTK_OBJECT(card->card),
- "file_as", &file_as,
- NULL);
+ g_object_get(card->card,
+ "file_as", &file_as,
+ NULL);
if (file_as)
return g_utf8_strcasecmp (file_as, utf_str);
else
@@ -427,28 +431,47 @@ compare_to_utf_str (EMinicard *card, const char *utf_str)
static void
e_minicard_view_class_init (EMinicardViewClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
EReflowClass *reflow_class;
- object_class = (GtkObjectClass*) klass;
+ object_class = G_OBJECT_CLASS (klass);
item_class = (GnomeCanvasItemClass *) klass;
reflow_class = (EReflowClass *) klass;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_peek_parent (klass);
- object_class->set_arg = e_minicard_view_set_arg;
- object_class->get_arg = e_minicard_view_get_arg;
- object_class->destroy = e_minicard_view_destroy;
-
- gtk_object_add_arg_type ("EMinicardView::adapter", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_ADAPTER);
- gtk_object_add_arg_type ("EMinicardView::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EMinicardView::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
+ object_class->set_property = e_minicard_view_set_property;
+ object_class->get_property = e_minicard_view_get_property;
+ object_class->dispose = e_minicard_view_dispose;
+
+ g_object_class_install_property (object_class, PROP_ADAPTER,
+ g_param_spec_object ("adapter",
+ _("Adapter"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_BOOK,
+ g_param_spec_object ("book",
+ _("Book"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_BOOK,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_QUERY,
+ g_param_spec_string ("query",
+ _("Query"),
+ /*_( */"XXX blurb" /*)*/,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _("Editable"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
signals [RIGHT_CLICK] =
g_signal_new ("right_click",
diff --git a/addressbook/gui/widgets/e-minicard-widget.c b/addressbook/gui/widgets/e-minicard-widget.c
index a82dae4ca0..75ccfccc98 100644
--- a/addressbook/gui/widgets/e-minicard-widget.c
+++ b/addressbook/gui/widgets/e-minicard-widget.c
@@ -20,15 +20,16 @@
*/
#include <config.h>
+#include <libgnome/gnome-i18n.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.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_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void e_minicard_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void e_minicard_widget_dispose (GObject *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);
@@ -37,8 +38,8 @@ static ECanvasClass *parent_class = NULL;
/* The arguments we take */
enum {
- ARG_0,
- ARG_CARD,
+ PROP_0,
+ PROP_CARD,
};
GType
@@ -68,27 +69,31 @@ e_minicard_widget_get_type (void)
static void
e_minicard_widget_class_init (EMinicardWidgetClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
ECanvasClass *ecanvas_class;
- object_class = GTK_OBJECT_CLASS(klass);
+ object_class = G_OBJECT_CLASS(klass);
widget_class = GTK_WIDGET_CLASS(klass);
ecanvas_class = E_CANVAS_CLASS(klass);
- 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;
- object_class->destroy = e_minicard_widget_destroy;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->set_property = e_minicard_widget_set_property;
+ object_class->get_property = e_minicard_widget_get_property;
+ object_class->dispose = e_minicard_widget_dispose;
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);
+ g_object_class_install_property (object_class, PROP_CARD,
+ g_param_spec_object ("card",
+ _("Card"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_CARD,
+ G_PARAM_READWRITE));
}
static void
@@ -96,9 +101,9 @@ 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);
+ g_object_get(emw->item,
+ "height", &height,
+ NULL);
if (height <= 0)
height = 1;
widget->requisition.height = height;
@@ -115,9 +120,9 @@ e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
gnome_canvas_item_set( emw->item,
"width", (double) allocation->width,
NULL );
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
+ g_object_get(emw->item,
+ "height", &height,
+ NULL);
height = MAX(height, allocation->height);
gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1);
gnome_canvas_item_set( emw->rect,
@@ -132,9 +137,9 @@ 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);
+ g_object_get(emw->item,
+ "height", &height,
+ NULL);
height = MAX(height, GTK_WIDGET(emw)->allocation.height);
@@ -172,15 +177,15 @@ e_minicard_widget_init (EMinicardWidget *emw)
}
static void
-e_minicard_widget_destroy (GtkObject *object)
+e_minicard_widget_dispose (GObject *object)
{
EMinicardWidget *emw = E_MINICARD_WIDGET(object);
if (emw->card)
g_object_unref (emw->card);
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
+ if (G_OBJECT_CLASS(parent_class)->dispose)
+ G_OBJECT_CLASS(parent_class)->dispose(object);
}
GtkWidget*
@@ -191,35 +196,42 @@ e_minicard_widget_new (void)
}
static void
-e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_minicard_widget_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
EMinicardWidget *emw = E_MINICARD_WIDGET(object);
gpointer ptr;
- switch (arg_id){
- case ARG_CARD:
- ptr = GTK_VALUE_POINTER (*arg);
+ switch (prop_id){
+ case PROP_CARD:
+ ptr = g_value_get_object (value);
e_minicard_widget_set_card (emw, ptr ? E_CARD (ptr) : NULL);
break;
default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_minicard_widget_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EMinicardWidget *emw = E_MINICARD_WIDGET(object);
- switch (arg_id) {
- case ARG_CARD:
+ switch (prop_id) {
+ case PROP_CARD:
if (emw->card)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card);
+ g_value_set_object (value, emw->card);
else
- GTK_VALUE_OBJECT (*arg) = NULL;
+ g_value_set_object (value, NULL);
break;
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 28ae0d07e1..38e7b6d3c9 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -42,7 +42,7 @@ static void e_minicard_init (EMinicard *card);
static void e_minicard_class_init (EMinicardClass *klass);
static void e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_minicard_destroy (GtkObject *object);
+static void e_minicard_dispose (GObject *object);
static void e_minicard_finalize (GObject *object);
static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event);
static void e_minicard_realize (GnomeCanvasItem *item);
@@ -124,12 +124,11 @@ static void
e_minicard_class_init (EMinicardClass *klass)
{
GObjectClass *object_class = (GObjectClass*) klass;
- GtkObjectClass *gtkobject_class = (GtkObjectClass*) klass;
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) klass;
object_class->set_property = e_minicard_set_property;
object_class->get_property = e_minicard_get_property;
- gtkobject_class->destroy = e_minicard_destroy;
+ object_class->dispose = e_minicard_dispose;
object_class->finalize = e_minicard_finalize;
parent_class = gtk_type_class (gnome_canvas_group_get_type ());
@@ -138,15 +137,15 @@ e_minicard_class_init (EMinicardClass *klass)
g_param_spec_double ("width",
_("Width"),
/*_( */"XXX blurb" /*)*/,
- 10.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
+ 0.0, G_MAXDOUBLE, 10.0,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HEIGHT,
g_param_spec_double ("height",
_("Height"),
/*_( */"XXX blurb" /*)*/,
- 10.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
+ 0.0, G_MAXDOUBLE, 10.0,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HAS_FOCUS,
/* XXX should be _enum */
@@ -383,7 +382,7 @@ e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamS
}
static void
-e_minicard_destroy (GtkObject *object)
+e_minicard_dispose (GObject *object)
{
EMinicard *e_minicard;
@@ -392,13 +391,19 @@ e_minicard_destroy (GtkObject *object)
e_minicard = E_MINICARD (object);
- g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(e_minicard->fields);
+ if (e_minicard->fields) {
+ g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL);
+ g_list_free(e_minicard->fields);
+ e_minicard->fields = NULL;
+ }
- gdk_pixbuf_unref (e_minicard->list_icon_pixbuf);
+ if (e_minicard->list_icon_pixbuf) {
+ gdk_pixbuf_unref (e_minicard->list_icon_pixbuf);
+ e_minicard->list_icon_pixbuf = NULL;
+ }
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
@@ -547,9 +552,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) {
- gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent),
- "book", &book,
- NULL);
+ g_object_get(GNOME_CANVAS_ITEM(e_minicard)->parent,
+ "book", &book,
+ NULL);
}
@@ -635,21 +640,21 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
} else {
EBook *book = NULL;
if (E_IS_MINICARD_VIEW(item->parent)) {
- gtk_object_get(GTK_OBJECT(item->parent),
- "book", &book,
- NULL);
+ g_object_get(item->parent,
+ "book", &book,
+ NULL);
}
if (book != NULL) {
if (e_card_evolution_list (e_minicard->card)) {
EContactListEditor *editor = e_addressbook_show_contact_list_editor (book, e_minicard->card,
FALSE, e_minicard->editable);
- e_minicard->editor = GTK_OBJECT (editor);
+ e_minicard->editor = G_OBJECT (editor);
}
else {
EContactEditor *editor = e_addressbook_show_contact_editor (book, e_minicard->card,
FALSE, e_minicard->editable);
- e_minicard->editor = GTK_OBJECT (editor);
+ e_minicard->editor = G_OBJECT (editor);
}
g_object_ref (e_minicard->editor);
@@ -670,9 +675,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
EMinicardField *field = E_MINICARD_FIELD(list->data);
GnomeCanvasItem *item = field->label;
EFocus has_focus;
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
+ g_object_get(item,
+ "has_focus", &has_focus,
+ NULL);
if (has_focus != E_FOCUS_NONE) {
if (event->key.state & GDK_SHIFT_MASK)
list = list->prev;
@@ -731,11 +736,11 @@ field_changed (EText *text, EMinicard *e_minicard)
char *string;
type = GPOINTER_TO_INT
- (gtk_object_get_data(GTK_OBJECT(text),
- "EMinicard:field"));
- gtk_object_get(GTK_OBJECT(text),
- "text", &string,
- NULL);
+ (g_object_get_data(G_OBJECT(text),
+ "EMinicard:field"));
+ g_object_get(text,
+ "text", &string,
+ NULL);
e_card_simple_set(e_minicard->simple,
type,
string);
@@ -786,9 +791,9 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
"editable", e_minicard->editable,
NULL );
g_signal_connect(E_MINICARD_LABEL(new_item)->field,
- "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard);
+ "changed", G_CALLBACK (field_changed), e_minicard);
g_signal_connect(E_MINICARD_LABEL(new_item)->field,
- "activate", GTK_SIGNAL_FUNC(field_activated), e_minicard);
+ "activate", G_CALLBACK (field_activated), e_minicard);
g_object_set(E_MINICARD_LABEL(new_item)->field,
"allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field),
NULL);
@@ -921,9 +926,9 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags )
old_height = e_minicard->height;
- gtk_object_get( GTK_OBJECT( e_minicard->header_text ),
- "text_height", &text_height,
- NULL );
+ g_object_get( e_minicard->header_text,
+ "text_height", &text_height,
+ NULL );
e_minicard->height = text_height + 10.0;
@@ -934,9 +939,9 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags )
for(list = e_minicard->fields; list; list = g_list_next(list)) {
EMinicardField *field = E_MINICARD_FIELD(list->data);
GnomeCanvasItem *item = field->label;
- gtk_object_get (GTK_OBJECT(item),
- "height", &text_height,
- NULL);
+ g_object_get (item,
+ "height", &text_height,
+ NULL);
e_canvas_item_move_absolute(item, 2, e_minicard->height);
e_minicard->height += text_height;
}
@@ -982,12 +987,12 @@ e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
if (minicard1->card && minicard2->card) {
char *file_as1, *file_as2;
- gtk_object_get(GTK_OBJECT(minicard1->card),
- "file_as", &file_as1,
- NULL);
- gtk_object_get(GTK_OBJECT(minicard2->card),
- "file_as", &file_as2,
- NULL);
+ g_object_get(minicard1->card,
+ "file_as", &file_as1,
+ NULL);
+ g_object_get(minicard2->card,
+ "file_as", &file_as2,
+ NULL);
if (file_as1 && file_as2)
return g_utf8_collate(file_as1, file_as2);
if (file_as1)
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
index 99e2ccbf63..d0270e7013 100644
--- a/addressbook/gui/widgets/e-minicard.h
+++ b/addressbook/gui/widgets/e-minicard.h
@@ -73,7 +73,7 @@ struct _EMinicard
GdkPixbuf *list_icon_pixbuf;
double list_icon_size;
- GtkObject *editor;
+ GObject *editor;
GList *fields; /* Of type EMinicardField */
guint needs_remodeling : 1;
diff --git a/addressbook/gui/widgets/test-minicard-view.c b/addressbook/gui/widgets/test-minicard-view.c
index 4626d5e205..e14443b01e 100644
--- a/addressbook/gui/widgets/test-minicard-view.c
+++ b/addressbook/gui/widgets/test-minicard-view.c
@@ -63,9 +63,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi
gnome_canvas_item_set( reflow,
"minimum_width", (double) allocation->width,
NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
+ g_object_get(reflow,
+ "width", &width,
+ NULL);
width = MAX(width, allocation->width);
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height );
gnome_canvas_item_set( rect,
@@ -77,9 +77,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi
static void resize(GnomeCanvas *canvas, gpointer data)
{
double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
+ g_object_get(reflow,
+ "width", &width,
+ NULL);
width = MAX(width, last_alloc.width);
gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height );
gnome_canvas_item_set( rect,
@@ -117,8 +117,8 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
NULL);
}
-static guint
-ebook_create (void)
+static gboolean
+ebook_create (gpointer data)
{
EBook *book;
@@ -199,7 +199,7 @@ int main( int argc, char *argv[] )
gtk_widget_show_all( app );
gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
+ g_idle_add (ebook_create, NULL);
bonobo_main ();
diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c
index 79d00cdd82..7f4325f130 100644
--- a/addressbook/gui/widgets/test-reflow.c
+++ b/addressbook/gui/widgets/test-reflow.c
@@ -80,9 +80,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi
gnome_canvas_item_set( reflow,
"minimum_width", (double) allocation->width,
NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
+ g_object_get(reflow,
+ "width", &width,
+ NULL);
width = MAX(width, allocation->width);
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1);
gnome_canvas_item_set( rect,
@@ -94,9 +94,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi
static void resize(GnomeCanvas *canvas, gpointer data)
{
double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
+ g_object_get(reflow,
+ "width", &width,
+ NULL);
width = MAX(width, last_alloc.width);
gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1);
gnome_canvas_item_set( rect,