[gnome-builder] builder: modernize remaining GObjects.Use G_DECLARE_FINAL_TYPE() and G_DECLARE_DERIVABLE_TYPE()



commit b5f133eb73f9e7ec7c36b50a8e6664c3af97e1e4
Author: Dimitris Zenios <dimitris zenios gmail com>
Date:   Tue May 19 23:50:54 2015 +0300

    builder: modernize remaining GObjects.Use G_DECLARE_FINAL_TYPE() and G_DECLARE_DERIVABLE_TYPE()
    
    The only class that is left is IdeGitRemoteCallbacks because
    GgitRemoteCallbacks (parent class) does not support AUTOPTR_CLEANUP_FUNC yet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749033

 libide/ide-buffer.h                           |   20 +++-----------------
 libide/ide-line-change-gutter-renderer.c      |   20 ++++++++------------
 libide/ide-line-change-gutter-renderer.h      |   14 +++-----------
 libide/ide-line-diagnostics-gutter-renderer.c |    5 +++++
 libide/ide-line-diagnostics-gutter-renderer.h |   24 +++---------------------
 libide/ide-source-view.h                      |   19 ++-----------------
 6 files changed, 24 insertions(+), 78 deletions(-)
---
diff --git a/libide/ide-buffer.h b/libide/ide-buffer.h
index bfe1b82..cd59bcf 100644
--- a/libide/ide-buffer.h
+++ b/libide/ide-buffer.h
@@ -19,24 +19,18 @@
 #ifndef IDE_BUFFER_H
 #define IDE_BUFFER_H
 
-#include <gtksourceview/gtksourcebuffer.h>
+#include <gtksourceview/gtksource.h>
 
 #include "ide-types.h"
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_BUFFER             (ide_buffer_get_type ())
-#define IDE_BUFFER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_BUFFER, IdeBuffer))
-#define IDE_BUFFER_CONST(obj)       (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_BUFFER, IdeBuffer const))
-#define IDE_BUFFER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),  IDE_TYPE_BUFFER, IdeBufferClass))
-#define IDE_IS_BUFFER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_BUFFER))
-#define IDE_IS_BUFFER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass),  IDE_TYPE_BUFFER))
-#define IDE_BUFFER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),  IDE_TYPE_BUFFER, IdeBufferClass))
+#define IDE_TYPE_BUFFER (ide_buffer_get_type ())
 
 #define IDE_BUFFER_LINE_FLAGS_DIAGNOSTICS_MASK \
   ((IDE_BUFFER_LINE_FLAGS_ERROR | IDE_BUFFER_LINE_FLAGS_WARNING | IDE_BUFFER_LINE_FLAGS_NOTE))
 
-typedef struct _IdeBufferClass IdeBufferClass;
+G_DECLARE_DERIVABLE_TYPE (IdeBuffer, ide_buffer, IDE, BUFFER, GtkSourceBuffer)
 
 typedef enum
 {
@@ -56,13 +50,6 @@ struct _IdeBufferClass
                         const GtkTextIter *location);
 };
 
-struct _IdeBuffer
-{
-  GtkSourceBuffer parent_instance;
-};
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeBuffer, g_object_unref)
-
 gboolean            ide_buffer_get_changed_on_volume         (IdeBuffer            *self);
 GBytes             *ide_buffer_get_content                   (IdeBuffer            *self);
 IdeContext         *ide_buffer_get_context                   (IdeBuffer            *self);
@@ -75,7 +62,6 @@ gboolean            ide_buffer_get_read_only                 (IdeBuffer
 gboolean            ide_buffer_get_highlight_diagnostics     (IdeBuffer            *self);
 const gchar        *ide_buffer_get_style_scheme_name         (IdeBuffer            *self);
 const gchar        *ide_buffer_get_title                     (IdeBuffer            *self);
-GType               ide_buffer_get_type                      (void);
 void                ide_buffer_set_file                      (IdeBuffer            *self,
                                                               IdeFile              *file);
 void                ide_buffer_set_highlight_diagnostics     (IdeBuffer            *self,
diff --git a/libide/ide-line-change-gutter-renderer.c b/libide/ide-line-change-gutter-renderer.c
index 6ca7bab..d35f765 100644
--- a/libide/ide-line-change-gutter-renderer.c
+++ b/libide/ide-line-change-gutter-renderer.c
@@ -26,23 +26,19 @@ struct _IdeLineChangeGutterRenderer
 {
   GtkSourceGutterRenderer parent_instance;
 
-  GtkTextView   *text_view;
-  gulong         text_view_notify_buffer;
+  GtkTextView            *text_view;
+  gulong                  text_view_notify_buffer;
 
-  GtkTextBuffer *buffer;
-  gulong         buffer_notify_style_scheme;
+  GtkTextBuffer          *buffer;
+  gulong                  buffer_notify_style_scheme;
 
-  GdkRGBA rgba_added;
-  GdkRGBA rgba_changed;
+  GdkRGBA                 rgba_added;
+  GdkRGBA                 rgba_changed;
 
-  guint rgba_added_set : 1;
-  guint rgba_changed_set : 1;
+  guint                   rgba_added_set : 1;
+  guint                   rgba_changed_set : 1;
 };
 
-struct _IdeLineChangeGutterRendererClass
-{
-  GtkSourceGutterRendererClass parent;
-};
 
 G_DEFINE_TYPE (IdeLineChangeGutterRenderer,
                ide_line_change_gutter_renderer,
diff --git a/libide/ide-line-change-gutter-renderer.h b/libide/ide-line-change-gutter-renderer.h
index f071364..45dd171 100644
--- a/libide/ide-line-change-gutter-renderer.h
+++ b/libide/ide-line-change-gutter-renderer.h
@@ -23,18 +23,10 @@
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER            (ide_line_change_gutter_renderer_get_type())
-#define IDE_LINE_CHANGE_GUTTER_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER, IdeLineChangeGutterRenderer))
-#define IDE_LINE_CHANGE_GUTTER_RENDERER_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER, IdeLineChangeGutterRenderer const))
-#define IDE_LINE_CHANGE_GUTTER_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER, IdeLineChangeGutterRendererClass))
-#define IDE_IS_LINE_CHANGE_GUTTER_RENDERER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER))
-#define IDE_IS_LINE_CHANGE_GUTTER_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER))
-#define IDE_LINE_CHANGE_GUTTER_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER, IdeLineChangeGutterRendererClass))
+#define IDE_TYPE_LINE_CHANGE_GUTTER_RENDERER (ide_line_change_gutter_renderer_get_type())
 
-typedef struct _IdeLineChangeGutterRenderer      IdeLineChangeGutterRenderer;
-typedef struct _IdeLineChangeGutterRendererClass IdeLineChangeGutterRendererClass;
-
-GType ide_line_change_gutter_renderer_get_type (void);
+G_DECLARE_FINAL_TYPE (IdeLineChangeGutterRenderer, ide_line_change_gutter_renderer,
+                      IDE, LINE_CHANGE_GUTTER_RENDERER, GtkSourceGutterRenderer);
 
 G_END_DECLS
 
diff --git a/libide/ide-line-diagnostics-gutter-renderer.c b/libide/ide-line-diagnostics-gutter-renderer.c
index d11611f..3e0426e 100644
--- a/libide/ide-line-diagnostics-gutter-renderer.c
+++ b/libide/ide-line-diagnostics-gutter-renderer.c
@@ -19,6 +19,11 @@
 #include "ide-buffer.h"
 #include "ide-line-diagnostics-gutter-renderer.h"
 
+struct _IdeLineDiagnosticsGutterRenderer
+{
+  GtkSourceGutterRendererPixbuf parent_instance;
+};
+
 G_DEFINE_TYPE (IdeLineDiagnosticsGutterRenderer,
                ide_line_diagnostics_gutter_renderer,
                GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF)
diff --git a/libide/ide-line-diagnostics-gutter-renderer.h b/libide/ide-line-diagnostics-gutter-renderer.h
index 18d71be..d89f1ac 100644
--- a/libide/ide-line-diagnostics-gutter-renderer.h
+++ b/libide/ide-line-diagnostics-gutter-renderer.h
@@ -23,28 +23,10 @@
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER            
(ide_line_diagnostics_gutter_renderer_get_type())
-#define IDE_LINE_DIAGNOSTICS_GUTTER_RENDERER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER, IdeLineDiagnosticsGutterRenderer))
-#define IDE_LINE_DIAGNOSTICS_GUTTER_RENDERER_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER, IdeLineDiagnosticsGutterRenderer const))
-#define IDE_LINE_DIAGNOSTICS_GUTTER_RENDERER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER, IdeLineDiagnosticsGutterRendererClass))
-#define IDE_IS_LINE_DIAGNOSTICS_GUTTER_RENDERER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER))
-#define IDE_IS_LINE_DIAGNOSTICS_GUTTER_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER))
-#define IDE_LINE_DIAGNOSTICS_GUTTER_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER, IdeLineDiagnosticsGutterRendererClass))
+#define IDE_TYPE_LINE_DIAGNOSTICS_GUTTER_RENDERER (ide_line_diagnostics_gutter_renderer_get_type())
 
-typedef struct _IdeLineDiagnosticsGutterRenderer      IdeLineDiagnosticsGutterRenderer;
-typedef struct _IdeLineDiagnosticsGutterRendererClass IdeLineDiagnosticsGutterRendererClass;
-
-struct _IdeLineDiagnosticsGutterRenderer
-{
-  GtkSourceGutterRendererPixbuf parent;
-};
-
-struct _IdeLineDiagnosticsGutterRendererClass
-{
-  GtkSourceGutterRendererPixbufClass parent_class;
-};
-
-GType ide_line_diagnostics_gutter_renderer_get_type (void);
+G_DECLARE_FINAL_TYPE (IdeLineDiagnosticsGutterRenderer, ide_line_diagnostics_gutter_renderer,
+                      IDE, LINE_DIAGNOSTICS_GUTTER_RENDERER, GtkSourceGutterRendererPixbuf)
 
 G_END_DECLS
 
diff --git a/libide/ide-source-view.h b/libide/ide-source-view.h
index d9413bc..f71f348 100644
--- a/libide/ide-source-view.h
+++ b/libide/ide-source-view.h
@@ -25,16 +25,9 @@
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_SOURCE_VIEW            (ide_source_view_get_type())
-#define IDE_SOURCE_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_SOURCE_VIEW, 
IdeSourceView))
-#define IDE_SOURCE_VIEW_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_SOURCE_VIEW, 
IdeSourceView const))
-#define IDE_SOURCE_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  IDE_TYPE_SOURCE_VIEW, 
IdeSourceViewClass))
-#define IDE_IS_SOURCE_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_SOURCE_VIEW))
-#define IDE_IS_SOURCE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  IDE_TYPE_SOURCE_VIEW))
-#define IDE_SOURCE_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  IDE_TYPE_SOURCE_VIEW, 
IdeSourceViewClass))
+#define IDE_TYPE_SOURCE_VIEW  (ide_source_view_get_type())
 
-typedef struct _IdeSourceView      IdeSourceView;
-typedef struct _IdeSourceViewClass IdeSourceViewClass;
+G_DECLARE_DERIVABLE_TYPE (IdeSourceView, ide_source_view, IDE, SOURCE_VIEW, GtkSourceView)
 
 /**
  * IdeSourceViewModeType:
@@ -191,13 +184,6 @@ typedef enum
   IDE_SOURCE_VIEW_MOVEMENT_PREVIOUS_MATCH_MODIFIER,
 } IdeSourceViewMovement;
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeSourceView, g_object_unref)
-
-struct _IdeSourceView
-{
-  GtkSourceView parent;
-};
-
 struct _IdeSourceViewClass
 {
   GtkSourceViewClass parent_class;
@@ -301,7 +287,6 @@ gboolean                    ide_source_view_get_show_search_bubbles   (IdeSource
 gboolean                    ide_source_view_get_show_search_shadow    (IdeSourceView              *self);
 gboolean                    ide_source_view_get_smart_backspace       (IdeSourceView              *self);
 gboolean                    ide_source_view_get_snippet_completion    (IdeSourceView              *self);
-GType                       ide_source_view_get_type                  (void);
 void                        ide_source_view_get_visible_rect          (IdeSourceView              *self,
                                                                        GdkRectangle               
*visible_rect);
 void                        ide_source_view_jump                      (IdeSourceView              *self,


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