From: Carlos Garcia Campos Date: Sat, 24 Jan 2009 18:10:43 +0000 (+0000) Subject: Use EV_DEFINE_INTERFACE to define EvSidebarPage interface. See bug X-Git-Tag: EVINCE_2_25_90~27 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=b2c387604ca233c9c70a0595a24d381ddfafd1d4;p=evince.git Use EV_DEFINE_INTERFACE to define EvSidebarPage interface. See bug 2009-01-24 Carlos Garcia Campos * shell/ev-sidebar-page.c: Use EV_DEFINE_INTERFACE to define EvSidebarPage interface. See bug #568228. svn path=/trunk/; revision=3380 --- diff --git a/ChangeLog b/ChangeLog index 6edefe13..61e46ea3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-24 Carlos Garcia Campos + + * shell/ev-sidebar-page.c: + + Use EV_DEFINE_INTERFACE to define EvSidebarPage interface. See bug + #568228. + 2009-01-24 Carlos Garcia Campos * libdocument/ev-document.h: diff --git a/shell/ev-sidebar-page.c b/shell/ev-sidebar-page.c index 6043ec5c..14bb847c 100644 --- a/shell/ev-sidebar-page.c +++ b/shell/ev-sidebar-page.c @@ -26,35 +26,11 @@ #include "ev-sidebar-page.h" -static void ev_sidebar_page_iface_init (gpointer iface); - -GType -ev_sidebar_page_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - const GTypeInfo sidebar_page_info = - { - sizeof (EvSidebarPageIface), - NULL, - NULL, - (GClassInitFunc)ev_sidebar_page_iface_init, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "EvSidebarPage", - &sidebar_page_info, (GTypeFlags)0); - } - - return type; -} - +EV_DEFINE_INTERFACE (EvSidebarPage, ev_sidebar_page, 0) gboolean -ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, - EvDocument *document) +ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, + EvDocument *document) { EvSidebarPageIface *iface; @@ -69,8 +45,8 @@ ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, } void -ev_sidebar_page_set_document (EvSidebarPage *sidebar_page, - EvDocument *document) +ev_sidebar_page_set_document (EvSidebarPage *sidebar_page, + EvDocument *document) { EvSidebarPageIface *iface; @@ -79,15 +55,13 @@ ev_sidebar_page_set_document (EvSidebarPage *sidebar_page, iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); - g_return_if_fail (iface->set_document); + g_assert (iface->set_document); iface->set_document (sidebar_page, document); - - return; } -const gchar* -ev_sidebar_page_get_label (EvSidebarPage *sidebar_page) +const gchar * +ev_sidebar_page_get_label (EvSidebarPage *sidebar_page) { EvSidebarPageIface *iface; @@ -95,18 +69,24 @@ ev_sidebar_page_get_label (EvSidebarPage *sidebar_page) iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); - g_return_val_if_fail (iface->get_label, NULL); + g_assert (iface->get_label); return iface->get_label (sidebar_page); } -static void ev_sidebar_page_iface_init (gpointer iface) +static void +ev_sidebar_page_class_init (EvSidebarPageIface *iface) { - g_object_interface_install_property (iface, - g_param_spec_object ("main-widget", - "Main Widget", - "Main page widget, used to handle focus", - GTK_TYPE_WIDGET, - G_PARAM_READABLE)); + static gboolean initialized = FALSE; + + if (!initialized) { + g_object_interface_install_property (iface, + g_param_spec_object ("main-widget", + "Main Widget", + "Main page widget, used to handle focus", + GTK_TYPE_WIDGET, + G_PARAM_READABLE)); + initialized = TRUE; + } }