From ace402d9173fe24b4f9a753f7c155fa0605ed866 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 18 Dec 2002 22:11:28 +0000 Subject: drop use of "font" arg. (get_left_width): use pango to calculate this 2002-12-18 Chris Toshok * gui/widgets/e-minicard.c (e_minicard_realize): drop use of "font" arg. (get_left_width): use pango to calculate this instead of a GdkFont. * gui/widgets/e-minicard-view.c: drop include of e-unicode.h. * gui/widgets/e-minicard-label.c (e_minicard_label_construct): don't need to create the font anymore. * gui/search/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/search/e-addressbook-search-dialog.c (e_addressbook_search_dialog_new): use g_object_new instead of gtk_type_new. * gui/merging/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/contact-list-editor/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/contact-list-editor/e-contact-list-editor.c (is_named): strdup (or not, if we don't need to save the value) instead of using the e_utf8 functions. (fill_in_info): same. * gui/contact-editor/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/contact-editor/e-contact-save-as.c (e_contact_save_as): strdup (or not, if we don't need to save the value) instead of using the e_utf8 functions. (e_contact_list_save_as): same. * gui/contact-editor/e-contact-quick-add.c (clicked_cb): strdup (or not, if we don't need to save the value) instead of using the e_utf8 functions. (build_quick_add_dialog): same. * gui/contact-editor/e-contact-editor.c (phone_entry_changed): strdup (or not, if we don't need to save the value) instead of using the e_utf8 functions. (file_as_set_style): same. (name_entry_changed): same. (full_name_clicked): same. (categories_clicked): same. (set_field): same. (fill_in_field): same. (fill_in_single_field): same. (extract_field): same. (extract_single_field): same. * gui/contact-editor/e-contact-editor-fullname.c (extract_field): just strdup, it's already utf8. * gui/contact-editor/e-contact-editor-address.c (extract_field): they're all entries, use GTK_ENTRY foo here. * gui/component/select-names/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/component/select-names/e-select-names.c (e_select_names_add_section): remove the extra utf8_from_locale_string stuff. * gui/component/select-names/e-select-names-popup.c (set_uiinfo_label): gtk_container_children -> gtk_container_get_children, and remove the extra utf8 stuff. * gui/component/Makefile.am (INCLUDES): add -D*_DISABLE_DEPRECATED. * gui/component/addressbook-storage.c (addressbook_storage_init_source_uri): g_string_sprintfa -> g_string_append_printf. * gui/component/addressbook-config.c (focus_help): gtk_notebook_set_page -> gtk_notebook_set_current_page. (addressbook_source_dialog_set_source): same. (auth_optionmenu_activated): gtk_container_children -> gtk_container_get_children. (ssl_optionmenu_activated): same. (ssl_optionmenu_selected): same, and gtk_notebook_set_page -> gtk_notebook_set_current_page. (scope_optionmenu_activated): same. (set_advanced_button_state): same. (addressbook_ldap_init): hook "response" to gtk_widget_destroy to make the dialog go away when clicked. (addressbook_ldap_auth): same. (addressbook_root_dse_query): same. (do_ldap_root_dse_query): same. (addressbook_config_control_new): fix return type and cast. (main): remove call to gtk_widget_push_visual. * gui/component/addressbook-config.h: addressbook_config_control_new returns a BonoboObject, not a BonoboControl. * gui/component/addressbook.c: remove e-unicode.h include. * backend/pas/Makefile.am (INCLUDES): Add -DLIBGNOME_DISABLE_DEPRECATED. * backend/ebook/Makefile.am (INCLUDES): Add -DLIBGNOME_DISABLE_DEPRECATED. * backend/ebook/e-card.c (e_card_get_property): remove misleading comment. svn path=/trunk/; revision=19160 --- addressbook/gui/widgets/e-minicard-label.c | 3 --- addressbook/gui/widgets/e-minicard-view.c | 1 - addressbook/gui/widgets/e-minicard.c | 19 +++++++++---------- 3 files changed, 9 insertions(+), 14 deletions(-) (limited to 'addressbook/gui/widgets') diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c index 33016067fa..21ace85c60 100644 --- a/addressbook/gui/widgets/e-minicard-label.c +++ b/addressbook/gui/widgets/e-minicard-label.c @@ -273,9 +273,6 @@ e_minicard_label_construct (GnomeCanvasItem *item) { EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; - GdkFont *font; - - font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (item->canvas))); e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP( item ); diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index e4c8db0bd1..25d43fdd84 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -29,7 +29,6 @@ #include #include #include -#include #include static void e_minicard_view_drag_data_get(GtkWidget *widget, diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 4cd5bd67f9..a63f7604b5 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -468,9 +468,6 @@ e_minicard_realize (GnomeCanvasItem *item) "width", (double) MAX( e_minicard->width - 12, 0 ), "clip", TRUE, "use_ellipsis", TRUE, -#if 0 - "font", "fixed-bold-10", -#endif "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], "text", "", "draw_background", FALSE, @@ -811,24 +808,26 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) g_free(string); } -static gdouble +static int get_left_width(EMinicard *e_minicard) { gchar *name; ECardSimpleField field; - gdouble width = -1; + int width = -1; GdkFont *font; + PangoLayout *layout; - font = gtk_style_get_font (gtk_widget_get_style ((GtkWidget *) ((GnomeCanvasItem *) e_minicard)->canvas)); - + layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas), ""); for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - gdouble this_width; + int this_width; name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - this_width = gdk_text_width(font, name, strlen(name)); + pango_layout_set_text (layout, name, -1); + pango_layout_get_pixel_size (layout, &this_width, NULL); if (width < this_width) width = this_width; g_free(name); } + g_object_unref (layout); return width; } @@ -842,7 +841,7 @@ remodel( EMinicard *e_minicard ) ECardSimpleField field; GList *list; char *file_as; - gdouble left_width = -1; + int left_width = -1; if (e_minicard->header_text) { file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS); -- cgit v1.2.3