aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-04-04 06:34:55 +0800
committerChris Toshok <toshok@src.gnome.org>2003-04-04 06:34:55 +0800
commit660514490cade113a6f4627ef138c38cddea8d8e (patch)
treea42cc11b385e863d521db9d7033dcaa18697951e /addressbook/gui
parent0b48a811d04d7fb29e60bb1e3168f9479992d3b7 (diff)
downloadgsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar.gz
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar.bz2
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar.lz
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar.xz
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.tar.zst
gsoc2013-evolution-660514490cade113a6f4627ef138c38cddea8d8e.zip
[ fixes bug #40715 ] add this callback, to unref the book/free the closure
2003-04-03 Chris Toshok <toshok@ximian.com> [ fixes bug #40715 ] * gui/merging/e-card-merging.c (final_id_cb): add this callback, to unref the book/free the closure after calling the user's callback. (final_cb): same. (doit): use final{_id}_cb (cancelit): same. (response): don't free the lookup struct here. (match_query_callback): same. (e_card_merging_book_add_card): ref the book. (e_card_merging_book_commit_card): same. * gui/component/e-address-popup.c (card_picker_init): make sure to set the "text" attribute on the cell renderer so the text actually shows up. also, g_object_connect -> g_signal_connect *sigh*. Lastly, get rid of the scrolled window and just make the window size to show the text. * gui/widgets/e-minicard.c (e_minicard_style_set): only call set_selected if we're realized (we create all the canvas objects that set_selected manipulates in our realize method.) svn path=/trunk/; revision=20662
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/e-address-popup.c15
-rw-r--r--addressbook/gui/merging/e-card-merging.c41
-rw-r--r--addressbook/gui/widgets/e-minicard.c3
3 files changed, 39 insertions, 20 deletions
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
index 1cb080bf62..7ccacd1769 100644
--- a/addressbook/gui/component/e-address-popup.c
+++ b/addressbook/gui/component/e-address-popup.c
@@ -590,7 +590,7 @@ card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, co
{
CardPicker *pick;
gchar *str;
- GtkWidget *w, *swin;
+ GtkWidget *w;
GtkTreeIter iter;
pick = g_new (CardPicker, 1);
@@ -607,6 +607,7 @@ card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, co
COLUMN_ACTION,
_("Select an Action"),
gtk_cell_renderer_text_new (),
+ "text", COLUMN_ACTION,
NULL);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)),
@@ -652,8 +653,8 @@ card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, co
wiz->ok_cb = card_picker_ok_cb;
wiz->cleanup_cb = card_picker_cleanup_cb;
- g_object_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)),
- "changed", card_picker_selection_changed,
+ g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)),
+ "changed", G_CALLBACK (card_picker_selection_changed),
wiz);
/* Build our widget */
@@ -661,13 +662,7 @@ card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, co
w = gtk_label_new (new_email);
gtk_box_pack_start (GTK_BOX (pick->body), w, FALSE, TRUE, 3);
- swin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swin), pick->list);
-
- gtk_box_pack_start (GTK_BOX (pick->body), swin, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (pick->body), pick->list, TRUE, TRUE, 2);
gtk_widget_show_all (pick->body);
diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c
index 1b3da3e063..3de0a02a6d 100644
--- a/addressbook/gui/merging/e-card-merging.c
+++ b/addressbook/gui/merging/e-card-merging.c
@@ -31,12 +31,38 @@ typedef struct {
} ECardMergingLookup;
static void
+final_id_cb (EBook *book, EBookStatus status, const char *id, gpointer closure)
+{
+ ECardMergingLookup *lookup = closure;
+
+ if (lookup->id_cb)
+ lookup->id_cb (lookup->book, status, id, lookup->closure);
+
+ g_object_unref (lookup->book);
+
+ g_free (lookup);
+}
+
+static void
+final_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ ECardMergingLookup *lookup = closure;
+
+ if (lookup->cb)
+ lookup->cb (lookup->book, status, lookup->closure);
+
+ g_object_unref (lookup->book);
+
+ g_free (lookup);
+}
+
+static void
doit (ECardMergingLookup *lookup)
{
if (lookup->op == E_CARD_MERGING_ADD)
- e_book_add_card (lookup->book, lookup->card, lookup->id_cb, lookup->closure);
+ e_book_add_card (lookup->book, lookup->card, final_id_cb, lookup);
else if (lookup->op == E_CARD_MERGING_COMMIT)
- e_book_commit_card (lookup->book, lookup->card, lookup->cb, lookup->closure);
+ e_book_commit_card (lookup->book, lookup->card, final_cb, lookup);
}
static void
@@ -44,10 +70,10 @@ cancelit (ECardMergingLookup *lookup)
{
if (lookup->op == E_CARD_MERGING_ADD) {
if (lookup->id_cb)
- lookup->id_cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure);
+ final_id_cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup);
} else if (lookup->op == E_CARD_MERGING_COMMIT) {
if (lookup->cb)
- lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, lookup->closure);
+ final_cb (lookup->book, E_BOOK_STATUS_CANCELLED, lookup);
}
}
@@ -64,7 +90,6 @@ response (GtkWidget *dialog, int response, ECardMergingLookup *lookup)
cancelit (lookup);
break;
}
- g_free (lookup);
}
static void
@@ -74,7 +99,6 @@ match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer c
if ((gint) type <= (gint) E_CARD_MATCH_VAGUE) {
doit (lookup);
- g_free (lookup);
} else {
GladeXML *ui;
@@ -86,7 +110,6 @@ match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer c
ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-merging-book-commit-duplicate-detected.glade", NULL, NULL);
else {
doit (lookup);
- g_free (lookup);
return;
}
@@ -120,7 +143,7 @@ e_card_merging_book_add_card (EBook *book,
lookup = g_new (ECardMergingLookup, 1);
lookup->op = E_CARD_MERGING_ADD;
- lookup->book = book;
+ lookup->book = g_object_ref (book);
lookup->card = card;
lookup->id_cb = cb;
lookup->closure = closure;
@@ -142,7 +165,7 @@ e_card_merging_book_commit_card (EBook *book,
lookup = g_new (ECardMergingLookup, 1);
lookup->op = E_CARD_MERGING_COMMIT;
- lookup->book = book;
+ lookup->book = g_object_ref (book);
lookup->card = card;
lookup->cb = cb;
lookup->closure = closure;
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 15ecbf05f3..bb9234083d 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -448,7 +448,8 @@ e_minicard_finalize (GObject *object)
static void
e_minicard_style_set (EMinicard *minicard, GtkStyle *previous_style)
{
- set_selected (minicard, minicard->selected);
+ if ( (GTK_OBJECT_FLAGS( minicard ) & GNOME_CANVAS_ITEM_REALIZED) )
+ set_selected (minicard, minicard->selected);
}
static void