[evince] libview: Make class EvDocumentModel final



commit a44431678d11d29b397cf170c552437ea4668ba6
Author: astian <astian eclipso at>
Date:   Wed Jul 12 13:08:50 2017 +0000

    libview: Make class EvDocumentModel final
    
    This patch makes use of standard GObject macros to declare class
    EvDocumentModel.  GObject macros take care of defining a few useful
    functions/variables, so the corresponding (so far hand-coded) macros
    were removed.  Since the class is not derived from, it is marked "final"
    (this restriction can always be lifted at a later date, if needed).  For
    that reason GObject will also take care of defining the class structure,
    therefore the hand-coded definition was also removed.
    
    That last point also means that an unused class-scoped function pointer
    meant to serve as a signal handler (a so-called "class closure") for
    signal "page-changed" was removed.  Notice that the signal itself still
    exists.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784914

 libview/ev-document-model.c |   12 +-----------
 libview/ev-document-model.h |   11 ++---------
 2 files changed, 3 insertions(+), 20 deletions(-)
---
diff --git a/libview/ev-document-model.c b/libview/ev-document-model.c
index 85be89f..0576f6f 100644
--- a/libview/ev-document-model.c
+++ b/libview/ev-document-model.c
@@ -46,16 +46,6 @@ struct _EvDocumentModel
        gdouble min_scale;
 };
 
-struct _EvDocumentModelClass
-{
-       GObjectClass base_class;
-
-       /* Signals  */
-       void (* page_changed) (EvDocumentModel *model,
-                              gint             old_page,
-                              gint             new_page);
-};
-
 enum {
        PROP_0,
        PROP_DOCUMENT,
@@ -327,7 +317,7 @@ ev_document_model_class_init (EvDocumentModelClass *klass)
                g_signal_new ("page-changed",
                              EV_TYPE_DOCUMENT_MODEL,
                              G_SIGNAL_RUN_LAST,
-                             G_STRUCT_OFFSET (EvDocumentModelClass, page_changed),
+                             0,
                              NULL, NULL,
                              ev_view_marshal_VOID__INT_INT,
                              G_TYPE_NONE, 2,
diff --git a/libview/ev-document-model.h b/libview/ev-document-model.h
index a0085a7..784e27d 100644
--- a/libview/ev-document-model.h
+++ b/libview/ev-document-model.h
@@ -29,12 +29,8 @@
 
 G_BEGIN_DECLS
 
-#define EV_TYPE_DOCUMENT_MODEL            (ev_document_model_get_type ())
-#define EV_DOCUMENT_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_DOCUMENT_MODEL, 
EvDocumentModel))
-#define EV_IS_DOCUMENT_MODEL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_DOCUMENT_MODEL))
-#define EV_DOCUMENT_MODEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_DOCUMENT_MODEL, 
EvDocumentModelClass))
-#define EV_IS_DOCUMENT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_DOCUMENT_MODEL))
-#define EV_DOCUMENT_MODEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_DOCUMENT_MODEL, 
EvDocumentModelClass))
+#define EV_TYPE_DOCUMENT_MODEL (ev_document_model_get_type ())
+G_DECLARE_FINAL_TYPE(EvDocumentModel, ev_document_model, EV, DOCUMENT_MODEL, GObject)
 
 /**
  * EvSizingMode:
@@ -58,9 +54,6 @@ typedef enum {
        EV_PAGE_LAYOUT_AUTOMATIC
 } EvPageLayout;
 
-typedef struct _EvDocumentModel        EvDocumentModel;
-typedef struct _EvDocumentModelClass   EvDocumentModelClass;
-
 GType            ev_document_model_get_type          (void) G_GNUC_CONST;
 EvDocumentModel *ev_document_model_new               (void);
 EvDocumentModel *ev_document_model_new_with_document (EvDocument      *document);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]