]> www.fi.muni.cz Git - evince.git/commitdiff
[shell] Use G_DEFINE_INTERFACE and remove our own macro
authorCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 7 May 2010 11:19:56 +0000 (13:19 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 7 May 2010 11:19:56 +0000 (13:19 +0200)
libdocument/ev-document.h
shell/ev-sidebar-attachments.c
shell/ev-sidebar-layers.c
shell/ev-sidebar-links.c
shell/ev-sidebar-page.c
shell/ev-sidebar-page.h
shell/ev-sidebar-thumbnails.c

index 09c97aa2f617c38c78b012ee593f891d6ec73eaa..1064f16ac848bec45c8a2dea01f3c6dba656fceb 100644 (file)
@@ -271,37 +271,6 @@ type_name##_get_type (void)
        return g_define_type_id__volatile;                                            \
 }
 
        return g_define_type_id__volatile;                                            \
 }
 
-/* A convenience macro for GTypeInterface definitions, which declares
- * a default vtable initialization function and defines a *_get_type()
- * function.
- *
- * The macro expects the interface initialization function to have the
- * name <literal>t_n ## _default_init</literal>, and the interface
- * structure to have the name <literal>TN ## Interface</literal>.
- */
-#define EV_DEFINE_INTERFACE(TypeName, type_name, TYPE_PREREQ)                               \
-static void     type_name##_class_init        (TypeName##Iface *klass);                      \
-                                                                                             \
-GType                                                                                        \
-type_name##_get_type (void)                                                                  \
-{                                                                                            \
-        static volatile gsize g_define_type_id__volatile = 0;                                \
-       if (g_once_init_enter (&g_define_type_id__volatile)) {                               \
-               GType g_define_type_id =                                                     \
-                   g_type_register_static_simple (G_TYPE_INTERFACE,                         \
-                                                  g_intern_static_string (#TypeName),       \
-                                                  sizeof (TypeName##Iface),                 \
-                                                  (GClassInitFunc)type_name##_class_init,   \
-                                                  0,                                        \
-                                                  (GInstanceInitFunc)NULL,                  \
-                                                  (GTypeFlags) 0);                          \
-               if (TYPE_PREREQ)                                                             \
-                       g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ);   \
-               g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);           \
-       }                                                                                    \
-       return g_define_type_id__volatile;                                                   \
-}
-
 /*
  * A convenience macro for boxed type implementations, which defines a
  * type_name_get_type() function registering the boxed type.
 /*
  * A convenience macro for boxed type implementations, which defines a
  * type_name_get_type() function registering the boxed type.
index 0b1aa8d16ab707144731260fb13944207dd0e2d3..3d2cce29b024f077dd71c475d10ddc56f75b72a5 100644 (file)
@@ -67,7 +67,7 @@ struct _EvSidebarAttachmentsPrivate {
        GHashTable     *icon_cache;
 };
 
        GHashTable     *icon_cache;
 };
 
-static void ev_sidebar_attachments_page_iface_init (EvSidebarPageIface *iface);
+static void ev_sidebar_attachments_page_iface_init (EvSidebarPageInterface *iface);
 
 G_DEFINE_TYPE_EXTENDED (EvSidebarAttachments,
                         ev_sidebar_attachments,
 
 G_DEFINE_TYPE_EXTENDED (EvSidebarAttachments,
                         ev_sidebar_attachments,
@@ -698,7 +698,7 @@ ev_sidebar_attachments_get_label (EvSidebarPage *sidebar_page)
 }
 
 static void
 }
 
 static void
-ev_sidebar_attachments_page_iface_init (EvSidebarPageIface *iface)
+ev_sidebar_attachments_page_iface_init (EvSidebarPageInterface *iface)
 {
        iface->support_document = ev_sidebar_attachments_support_document;
        iface->set_model = ev_sidebar_attachments_set_model;
 {
        iface->support_document = ev_sidebar_attachments_support_document;
        iface->set_model = ev_sidebar_attachments_set_model;
index 0095c14ccfccbf4d16a7fafb7ba0810104203349..938f457f492aabe75ca474202506237c6a7dc6b7 100644 (file)
@@ -47,9 +47,9 @@ enum {
        N_SIGNALS
 };
 
        N_SIGNALS
 };
 
-static void ev_sidebar_layers_page_iface_init (EvSidebarPageIface *iface);
-static void job_finished_callback             (EvJobLayers        *job,
-                                              EvSidebarLayers    *sidebar_layers);
+static void ev_sidebar_layers_page_iface_init (EvSidebarPageInterface *iface);
+static void job_finished_callback             (EvJobLayers            *job,
+                                              EvSidebarLayers        *sidebar_layers);
 
 static guint signals[N_SIGNALS];
 
 
 static guint signals[N_SIGNALS];
 
@@ -402,7 +402,7 @@ ev_sidebar_layers_get_label (EvSidebarPage *sidebar_page)
 }
 
 static void
 }
 
 static void
-ev_sidebar_layers_page_iface_init (EvSidebarPageIface *iface)
+ev_sidebar_layers_page_iface_init (EvSidebarPageInterface *iface)
 {
        iface->support_document = ev_sidebar_layers_support_document;
        iface->set_model = ev_sidebar_layers_set_model;
 {
        iface->support_document = ev_sidebar_layers_support_document;
        iface->set_model = ev_sidebar_layers_set_model;
index 335913a917bc1cf297fb04b772e1dfdff4833316..0d0ece839487ce4fb04fd93cdc283b8318f122c1 100644 (file)
@@ -73,7 +73,7 @@ static void job_finished_callback                     (EvJobLinks     *job,
                                                         EvSidebarLinks *sidebar_links);
 static void ev_sidebar_links_set_current_page           (EvSidebarLinks *sidebar_links,
                                                         gint            current_page);
                                                         EvSidebarLinks *sidebar_links);
 static void ev_sidebar_links_set_current_page           (EvSidebarLinks *sidebar_links,
                                                         gint            current_page);
-static void ev_sidebar_links_page_iface_init           (EvSidebarPageIface *iface);
+static void ev_sidebar_links_page_iface_init           (EvSidebarPageInterface *iface);
 static gboolean ev_sidebar_links_support_document      (EvSidebarPage  *sidebar_page,
                                                         EvDocument     *document);
 static const gchar* ev_sidebar_links_get_label                 (EvSidebarPage *sidebar_page);
 static gboolean ev_sidebar_links_support_document      (EvSidebarPage  *sidebar_page,
                                                         EvDocument     *document);
 static const gchar* ev_sidebar_links_get_label                 (EvSidebarPage *sidebar_page);
@@ -751,7 +751,7 @@ ev_sidebar_links_get_label (EvSidebarPage *sidebar_page)
 }
 
 static void
 }
 
 static void
-ev_sidebar_links_page_iface_init (EvSidebarPageIface *iface)
+ev_sidebar_links_page_iface_init (EvSidebarPageInterface *iface)
 {
        iface->support_document = ev_sidebar_links_support_document;
        iface->set_model = ev_sidebar_links_set_model;
 {
        iface->support_document = ev_sidebar_links_support_document;
        iface->set_model = ev_sidebar_links_set_model;
index 78e1a7fdae3a45f9b4b272a1bf877c3d6faeb062..fdb8d4afb2b0bdb034557b0bde25402c8de31ff1 100644 (file)
 
 #include "ev-sidebar-page.h"
 
 
 #include "ev-sidebar-page.h"
 
-EV_DEFINE_INTERFACE (EvSidebarPage, ev_sidebar_page, 0)
+G_DEFINE_INTERFACE (EvSidebarPage, ev_sidebar_page, 0)
 
 gboolean 
 ev_sidebar_page_support_document (EvSidebarPage *sidebar_page,
                                  EvDocument    *document)
 {
 
 gboolean 
 ev_sidebar_page_support_document (EvSidebarPage *sidebar_page,
                                  EvDocument    *document)
 {
-        EvSidebarPageIface *iface;
+        EvSidebarPageInterface *iface;
 
        g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE);
         g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
 
        g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE);
         g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE);
@@ -48,7 +48,7 @@ void
 ev_sidebar_page_set_model (EvSidebarPage   *sidebar_page,
                           EvDocumentModel *model)
 {
 ev_sidebar_page_set_model (EvSidebarPage   *sidebar_page,
                           EvDocumentModel *model)
 {
-       EvSidebarPageIface *iface;
+       EvSidebarPageInterface *iface;
 
         g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page));
        g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
 
         g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page));
        g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
@@ -63,7 +63,7 @@ ev_sidebar_page_set_model (EvSidebarPage   *sidebar_page,
 const gchar *
 ev_sidebar_page_get_label (EvSidebarPage *sidebar_page)
 {
 const gchar *
 ev_sidebar_page_get_label (EvSidebarPage *sidebar_page)
 {
-       EvSidebarPageIface *iface;
+       EvSidebarPageInterface *iface;
 
         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL);
 
 
         g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL);
 
@@ -76,7 +76,7 @@ ev_sidebar_page_get_label (EvSidebarPage *sidebar_page)
 
 
 static void
 
 
 static void
-ev_sidebar_page_class_init (EvSidebarPageIface *iface)
+ev_sidebar_page_default_init (EvSidebarPageInterface *iface)
 {
        static gboolean initialized = FALSE;
  
 {
        static gboolean initialized = FALSE;
  
index 5cd6fec411c77223541805e8bdd30f25675180d1..21ef92cfcf489dc8b107d2715cda2c9ccf3d838c 100644 (file)
@@ -31,15 +31,15 @@ G_BEGIN_DECLS
 
 #define EV_TYPE_SIDEBAR_PAGE           (ev_sidebar_page_get_type ())
 #define EV_SIDEBAR_PAGE(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_SIDEBAR_PAGE, EvSidebarPage))
 
 #define EV_TYPE_SIDEBAR_PAGE           (ev_sidebar_page_get_type ())
 #define EV_SIDEBAR_PAGE(o)             (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_SIDEBAR_PAGE, EvSidebarPage))
-#define EV_SIDEBAR_PAGE_IFACE(k)       (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageIface))
+#define EV_SIDEBAR_PAGE_IFACE(k)       (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageInterface))
 #define EV_IS_SIDEBAR_PAGE(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_SIDEBAR_PAGE))
 #define EV_IS_SIDEBAR_PAGE_IFACE(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_SIDEBAR_PAGE))
 #define EV_IS_SIDEBAR_PAGE(o)          (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_SIDEBAR_PAGE))
 #define EV_IS_SIDEBAR_PAGE_IFACE(k)    (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_SIDEBAR_PAGE))
-#define EV_SIDEBAR_PAGE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageIface))
+#define EV_SIDEBAR_PAGE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageInterface))
 
 
-typedef struct _EvSidebarPage    EvSidebarPage;
-typedef struct _EvSidebarPageIface   EvSidebarPageIface;
+typedef struct _EvSidebarPage           EvSidebarPage;
+typedef struct _EvSidebarPageInterface   EvSidebarPageInterface;
 
 
-struct _EvSidebarPageIface
+struct _EvSidebarPageInterface
 {
        GTypeInterface base_iface;
 
 {
        GTypeInterface base_iface;
 
index 7b593f376cc8fed29230ef843f0c4f96710f669d..4aaeebab191409a8b5cc404b8527859b6fb64c9a 100644 (file)
@@ -91,14 +91,14 @@ enum {
        PROP_WIDGET,
 };
 
        PROP_WIDGET,
 };
 
-static void         ev_sidebar_thumbnails_clear_model      (EvSidebarThumbnails *sidebar);
-static gboolean     ev_sidebar_thumbnails_support_document (EvSidebarPage       *sidebar_page,
-                                                           EvDocument          *document);
-static void         ev_sidebar_thumbnails_page_iface_init  (EvSidebarPageIface  *iface);
-static const gchar* ev_sidebar_thumbnails_get_label        (EvSidebarPage       *sidebar_page);
-static void         thumbnail_job_completed_callback       (EvJobThumbnail      *job,
-                                                           EvSidebarThumbnails *sidebar_thumbnails);
-static void         adjustment_changed_cb                  (EvSidebarThumbnails *sidebar_thumbnails);
+static void         ev_sidebar_thumbnails_clear_model      (EvSidebarThumbnails     *sidebar);
+static gboolean     ev_sidebar_thumbnails_support_document (EvSidebarPage           *sidebar_page,
+                                                           EvDocument              *document);
+static void         ev_sidebar_thumbnails_page_iface_init  (EvSidebarPageInterface  *iface);
+static const gchar* ev_sidebar_thumbnails_get_label        (EvSidebarPage           *sidebar_page);
+static void         thumbnail_job_completed_callback       (EvJobThumbnail          *job,
+                                                           EvSidebarThumbnails     *sidebar_thumbnails);
+static void         adjustment_changed_cb                  (EvSidebarThumbnails     *sidebar_thumbnails);
 
 G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, 
                         ev_sidebar_thumbnails, 
 
 G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, 
                         ev_sidebar_thumbnails, 
@@ -966,7 +966,7 @@ ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page)
 }
 
 static void
 }
 
 static void
-ev_sidebar_thumbnails_page_iface_init (EvSidebarPageIface *iface)
+ev_sidebar_thumbnails_page_iface_init (EvSidebarPageInterface *iface)
 {
        iface->support_document = ev_sidebar_thumbnails_support_document;
        iface->set_model = ev_sidebar_thumbnails_set_model;
 {
        iface->support_document = ev_sidebar_thumbnails_support_document;
        iface->set_model = ev_sidebar_thumbnails_set_model;