[goffice] Compilation: Avoid G_OBJECT casts for g_object_ref and g_object_unref.



commit d752a1f7b839a50a2adebd9789564ab572b3e4c1
Author: Morten Welinder <terra gnome org>
Date:   Sat Feb 23 18:24:08 2013 -0500

    Compilation: Avoid G_OBJECT casts for g_object_ref and g_object_unref.

 ChangeLog                              |    4 ++++
 goffice/app/file.c                     |    8 ++++----
 goffice/app/io-context.c               |    4 ++--
 goffice/canvas/goc-canvas.c            |    2 +-
 goffice/component/go-component.c       |    2 +-
 goffice/graph/gog-axis.c               |    2 +-
 goffice/graph/gog-chart.c              |    2 +-
 goffice/graph/gog-color-scale.c        |    2 +-
 goffice/graph/gog-guru.c               |    4 ++--
 goffice/graph/gog-object.c             |   10 +++++-----
 goffice/graph/gog-plot.c               |    2 +-
 goffice/graph/gog-theme.c              |    2 +-
 goffice/gtk/go-3d-rotation-sel.c       |    2 +-
 goffice/gtk/go-color-group.c           |    2 +-
 goffice/gtk/go-color-palette.c         |    2 +-
 goffice/gtk/go-font-sel.c              |    2 +-
 goffice/gtk/go-format-sel.c            |    2 +-
 goffice/gtk/go-graph-widget.c          |    2 +-
 goffice/gtk/go-rotation-sel.c          |    2 +-
 goffice/gtk/goffice-gtk.c              |    6 +++---
 goffice/utils/go-emf.c                 |    4 ++--
 goffice/utils/go-glib-extras.c         |    2 --
 goffice/utils/go-style.c               |    4 ++--
 plugins/plot_pie/gog-pie-prefs.c       |    4 ++--
 plugins/plot_pie/gog-pie.c             |    6 +++---
 plugins/plot_surface/gog-xyz-surface.c |    2 +-
 plugins/plot_xy/gog-xy.c               |    2 +-
 27 files changed, 45 insertions(+), 43 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7c7b05e..cab3b2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-23  Morten Welinder  <terra gnome org>
+
+       * */*.c: Avoid G_OBJECT casts for g_object_ref and g_object_unref.
+
 2013-02-21  Morten Welinder  <terra gnome org>
 
        * goffice/app/go-plugin-service.c
diff --git a/goffice/app/file.c b/goffice/app/file.c
index 59d1253..62cea0b 100644
--- a/goffice/app/file.c
+++ b/goffice/app/file.c
@@ -880,7 +880,7 @@ go_file_opener_register (GOFileOpener *fo, gint priority)
                file_opener_priority_list,
                GINT_TO_POINTER (priority), pos);
        file_opener_list = g_list_insert (file_opener_list, fo, pos);
-       g_object_ref (G_OBJECT (fo));
+       g_object_ref (fo);
 
        id = go_file_opener_get_id (fo);
        if (id != NULL) {
@@ -925,7 +925,7 @@ go_file_opener_unregister (GOFileOpener *fo)
                }
        }
 
-       g_object_unref (G_OBJECT (fo));
+       g_object_unref (fo);
 }
 
 static gint
@@ -951,7 +951,7 @@ go_file_saver_register (GOFileSaver *fs)
        g_return_if_fail (GO_IS_FILE_SAVER (fs));
 
        file_saver_list = g_list_prepend (file_saver_list, fs);
-       g_object_ref (G_OBJECT (fs));
+       g_object_ref (fs);
 
        id = go_file_saver_get_id (fs);
        if (id != NULL) {
@@ -1030,7 +1030,7 @@ go_file_saver_unregister (GOFileSaver *fs)
                }
        }
 
-       g_object_unref (G_OBJECT (fs));
+       g_object_unref (fs);
 }
 
 /**
diff --git a/goffice/app/io-context.c b/goffice/app/io-context.c
index af62864..cfb26c4 100644
--- a/goffice/app/io-context.c
+++ b/goffice/app/io-context.c
@@ -74,7 +74,7 @@ ioc_finalize (GObject *obj)
        if (ioc->impl) {
                go_cmd_context_progress_set (ioc->impl, 0.0);
                go_cmd_context_progress_message_set (ioc->impl, NULL);
-               g_object_unref (G_OBJECT (ioc->impl));
+               g_object_unref (ioc->impl);
        }
 
        G_OBJECT_CLASS (g_type_class_peek (G_TYPE_OBJECT))->finalize (obj);
@@ -185,7 +185,7 @@ go_io_context_new (GOCmdContext *cc)
        ioc = g_object_new (GO_TYPE_IO_CONTEXT, NULL);
        /* The cc is optional for subclasses, but mandatory in this class. */
        ioc->impl = cc;
-       g_object_ref (G_OBJECT (ioc->impl));
+       g_object_ref (ioc->impl);
 
        return ioc;
 }
diff --git a/goffice/canvas/goc-canvas.c b/goffice/canvas/goc-canvas.c
index 5a8dc3d..d6ed50d 100644
--- a/goffice/canvas/goc-canvas.c
+++ b/goffice/canvas/goc-canvas.c
@@ -256,7 +256,7 @@ static void
 goc_canvas_finalize (GObject *obj)
 {
        GocCanvas *canvas = GOC_CANVAS (obj);
-       g_object_unref (G_OBJECT (canvas->root));
+       g_object_unref (canvas->root);
        parent_klass->finalize (obj);
 }
 
diff --git a/goffice/component/go-component.c b/goffice/component/go-component.c
index e0ff3b8..be0a72e 100644
--- a/goffice/component/go-component.c
+++ b/goffice/component/go-component.c
@@ -326,7 +326,7 @@ go_component_shapshot_finalize (GObject *obj)
        GOComponentSnapshot *snapshot = (GOComponentSnapshot *) obj;
 
        if (G_IS_OBJECT (snapshot->image))
-               g_object_unref (G_OBJECT (snapshot->image));
+               g_object_unref (snapshot->image);
 
        (*snapshot_parent_klass->finalize) (obj);
 }
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 49c6d60..e3e5c3e 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -2818,7 +2818,7 @@ gog_axis_populate_editor (GogObject *gobj,
        state->axis = axis;
        state->cc = cc;
        state->gui = gui;
-       g_object_ref (G_OBJECT (axis));
+       g_object_ref (axis);
 
        /* Bounds Page */
        grid = GTK_GRID (gtk_builder_get_object (gui, "bound-grid"));
diff --git a/goffice/graph/gog-chart.c b/goffice/graph/gog-chart.c
index accaa89..57c6dec 100644
--- a/goffice/graph/gog-chart.c
+++ b/goffice/graph/gog-chart.c
@@ -328,7 +328,7 @@ gog_chart_populate_editor (GogObject *gobj,
        state->chart = chart;
        state->gui = gui;
 
-       g_object_ref (G_OBJECT (chart));
+       g_object_ref (chart);
        is_plot_area_manual = gog_chart_get_plot_area (chart, &plot_area);
 
        state->x_spin = go_gtk_builder_get_widget (gui, "x_spin");
diff --git a/goffice/graph/gog-color-scale.c b/goffice/graph/gog-color-scale.c
index b1f24ed..c62ba1a 100644
--- a/goffice/graph/gog-color-scale.c
+++ b/goffice/graph/gog-color-scale.c
@@ -112,7 +112,7 @@ gog_color_scale_finalize (GObject *obj)
 {
        GogColorScale *scale = GOG_COLOR_SCALE (obj);
 
-       g_object_unref (G_OBJECT (scale->axis));
+       g_object_unref (scale->axis);
 
        parent_klass->finalize (obj);
 }
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index 37234f7..286e9e8 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -1012,7 +1012,7 @@ graph_guru_init_format_page (GraphGuruState *s)
        g_object_get (G_OBJECT (rend), "view", &(s->graph_view), NULL);
        s->selection_changed_handler = g_signal_connect (G_OBJECT (s->graph_view), "selection-changed",
                                                         G_CALLBACK (cb_graph_selection_changed), s);
-       g_object_unref (G_OBJECT (rend));
+       g_object_unref (rend);
 
        w = go_gtk_builder_get_widget (s->gui, "prop_alignment");
        s->prop_container = GTK_CONTAINER (w);
@@ -1268,7 +1268,7 @@ graph_guru_type_selector_new (GraphGuruState *s)
        g_object_set_data_full (G_OBJECT (selector),
                "state", typesel, (GDestroyNotify) g_free);
 
-       g_object_unref (G_OBJECT (gui));
+       g_object_unref (gui);
 
        return selector;
 }
diff --git a/goffice/graph/gog-object.c b/goffice/graph/gog-object.c
index dbf4ce7..28e7e0a 100644
--- a/goffice/graph/gog-object.c
+++ b/goffice/graph/gog-object.c
@@ -578,7 +578,7 @@ gog_object_populate_editor (GogObject *gobj,
        state->h_spin = NULL;
        state->position_notebook = go_gtk_builder_get_widget (gui, "position_notebook");
 
-       g_object_ref (G_OBJECT (gobj));
+       g_object_ref (gobj);
 
        widget_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -620,8 +620,8 @@ gog_object_populate_editor (GogObject *gobj,
        if (!(allowable_positions & GOG_POSITION_COMPASS))
                gtk_notebook_set_current_page (GTK_NOTEBOOK (state->position_notebook), 1);
 
-       g_object_unref (G_OBJECT (widget_size_group));
-       g_object_unref (G_OBJECT (label_size_group));
+       g_object_unref (widget_size_group);
+       g_object_unref (label_size_group);
 
        widget_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -725,8 +725,8 @@ gog_object_populate_editor (GogObject *gobj,
                                  G_CALLBACK (cb_chart_position_changed), state);
        }
 
-       g_object_unref (G_OBJECT (widget_size_group));
-       g_object_unref (G_OBJECT (label_size_group));
+       g_object_unref (widget_size_group);
+       g_object_unref (label_size_group);
 
        if ((allowable_positions & GOG_POSITION_MANUAL) &&
            ((allowable_positions & (GOG_POSITION_COMPASS | GOG_POSITION_ALIGNMENT)) ||
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index aaadae6..255d4c8 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -300,7 +300,7 @@ gog_plot_populate_editor (GogObject *obj,
                        go_editor_add_page (editor, grid, _("Axes"));
                }
                else
-                       g_object_unref (G_OBJECT (grid));
+                       g_object_unref (grid);
        }
 
        (GOG_OBJECT_CLASS(plot_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
diff --git a/goffice/graph/gog-theme.c b/goffice/graph/gog-theme.c
index d6ff5d5..f568e5b 100644
--- a/goffice/graph/gog-theme.c
+++ b/goffice/graph/gog-theme.c
@@ -1869,7 +1869,7 @@ gog_theme_edit (GogTheme *theme, GOCmdContext *cc)
        if (gtk_dialog_run (GTK_DIALOG (w))) {
        }
        gtk_widget_destroy (w);
-       g_object_unref (G_OBJECT (state.gui));
+       g_object_unref (state.gui);
        return NULL;
 }
 
diff --git a/goffice/gtk/go-3d-rotation-sel.c b/goffice/gtk/go-3d-rotation-sel.c
index c6c258b..cf5b44b 100644
--- a/goffice/gtk/go-3d-rotation-sel.c
+++ b/goffice/gtk/go-3d-rotation-sel.c
@@ -375,7 +375,7 @@ g3d_finalize (GObject *obj)
        GO3DRotationSel *g3d = GO_3D_ROTATION_SEL (obj);
 
        if (g3d->gui) {
-               g_object_unref (G_OBJECT (g3d->gui));
+               g_object_unref (g3d->gui);
                g3d->gui = NULL;
        }
 
diff --git a/goffice/gtk/go-color-group.c b/goffice/gtk/go-color-group.c
index 555c0d6..466e791 100644
--- a/goffice/gtk/go-color-group.c
+++ b/goffice/gtk/go-color-group.c
@@ -174,7 +174,7 @@ go_color_group_fetch (char const *name, gpointer context)
                cg = go_color_group_find (new_name, context);
        if (cg != NULL) {
                g_free (new_name);
-               g_object_ref (G_OBJECT (cg));
+               g_object_ref (cg);
                return cg;
        }
        }
diff --git a/goffice/gtk/go-color-palette.c b/goffice/gtk/go-color-palette.c
index c639e4a..778f176 100644
--- a/goffice/gtk/go-color-palette.c
+++ b/goffice/gtk/go-color-palette.c
@@ -418,7 +418,7 @@ go_color_palette_set_group (GOColorPalette *p, GOColorGroup *cg)
                g_signal_handlers_disconnect_by_func (
                        G_OBJECT (p->group),
                        G_CALLBACK (cb_history_changed), p);
-               g_object_unref (G_OBJECT (p->group));
+               g_object_unref (p->group);
                p->group = NULL;
        }
        if (cg != NULL) {
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index 54d5f04..86db01d 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -397,7 +397,7 @@ gfs_destroy (GtkWidget *widget)
        GOFontSel *gfs = GO_FONT_SEL (widget);
 
        if (gfs->gui) {
-               g_object_unref (G_OBJECT (gfs->gui));
+               g_object_unref (gfs->gui);
                gfs->gui = NULL;
        }
        if (gfs->base != NULL) {
diff --git a/goffice/gtk/go-format-sel.c b/goffice/gtk/go-format-sel.c
index ecade1b..97994e2 100644
--- a/goffice/gtk/go-format-sel.c
+++ b/goffice/gtk/go-format-sel.c
@@ -1719,7 +1719,7 @@ go_format_sel_finalize (GObject *obj)
        }
 
        if (gfs->gui) {
-               g_object_unref (G_OBJECT (gfs->gui));
+               g_object_unref (gfs->gui);
                gfs->gui = NULL;
        }
 
diff --git a/goffice/gtk/go-graph-widget.c b/goffice/gtk/go-graph-widget.c
index 302fc3a..9cda609 100644
--- a/goffice/gtk/go-graph-widget.c
+++ b/goffice/gtk/go-graph-widget.c
@@ -463,7 +463,7 @@ go_graph_widget_new (GogGraph *graph)
        go_graph_widget_set_size_mode (GO_GRAPH_WIDGET (ret), GO_GRAPH_WIDGET_SIZE_MODE_FIT, -1, -1);
 
        if (self_owned)
-               g_object_unref (G_OBJECT (graph));
+               g_object_unref (graph);
 
        return ret;
 }
diff --git a/goffice/gtk/go-rotation-sel.c b/goffice/gtk/go-rotation-sel.c
index fd8fb87..933ec6a 100644
--- a/goffice/gtk/go-rotation-sel.c
+++ b/goffice/gtk/go-rotation-sel.c
@@ -246,7 +246,7 @@ grs_finalize (GObject *obj)
        GORotationSel *grs = GO_ROTATION_SEL (obj);
 
        if (grs->gui) {
-               g_object_unref (G_OBJECT (grs->gui));
+               g_object_unref (grs->gui);
                grs->gui = NULL;
        }
 
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index 1a95e6d..e4eccd2 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -995,7 +995,7 @@ go_gui_get_image_save_info (GtkWindow *toplevel, GSList *supported_formats,
                                          G_CALLBACK (cb_format_combo_changed), resolution_grid);
                }
 
-               g_object_unref (G_OBJECT (gui));
+               g_object_unref (gui);
        }
 
        if (state->uri != NULL) {
@@ -1151,10 +1151,10 @@ go_help_display (CBHelpPaths const *paths, GdkScreen *screen)
                                g_hash_table_insert (context_help_map, g_strdup (topic),
                                        (gpointer)id);
                        }
-                       g_object_unref (G_OBJECT (textline));
+                       g_object_unref (textline);
                }
                if (input)
-                       g_object_unref (G_OBJECT (input));
+                       g_object_unref (input);
                g_free (path);
        }
 
diff --git a/goffice/utils/go-emf.c b/goffice/utils/go-emf.c
index 2b0db4a..1fb57a2 100644
--- a/goffice/utils/go-emf.c
+++ b/goffice/utils/go-emf.c
@@ -67,8 +67,8 @@ static void load_wmf_as_pixbuf (GOImage *image, guint8 const *data, size_t lengt
                if (ret)
                        image->pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
                if (image->pixbuf)
-                       g_object_ref (G_OBJECT (image->pixbuf));
-               g_object_unref (G_OBJECT (loader));
+                       g_object_ref (image->pixbuf);
+               g_object_unref (loader);
                image->width = gdk_pixbuf_get_width (image->pixbuf);
                image->height = gdk_pixbuf_get_height (image->pixbuf);
        }
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index d9d22c8..b06e987 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -40,8 +40,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <fcntl.h>
-#include <errno.h>
 
 static void
 cb_hash_collect_keys (gpointer key, gpointer value, GSList **accum)
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 924a4ff..e6d73a5 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -1816,7 +1816,7 @@ go_style_force_auto (GOStyle *style)
        g_return_if_fail (GO_IS_STYLE (style));
 
        if (style->marker.mark != NULL)
-               g_object_unref (G_OBJECT (style->marker.mark));
+               g_object_unref (style->marker.mark);
        style->marker.mark = go_marker_new ();
        style->marker.auto_shape =
        style->marker.auto_outline_color =
@@ -1849,7 +1849,7 @@ go_style_clear_auto       (GOStyle *style)
        g_return_if_fail (GO_IS_STYLE (style));
 
        if (style->marker.mark != NULL)
-               g_object_unref (G_OBJECT (style->marker.mark));
+               g_object_unref (style->marker.mark);
        style->marker.mark = go_marker_new ();
        style->marker.auto_shape =
        style->marker.auto_outline_color =
diff --git a/plugins/plot_pie/gog-pie-prefs.c b/plugins/plot_pie/gog-pie-prefs.c
index b2dc162..79de058 100644
--- a/plugins/plot_pie/gog-pie-prefs.c
+++ b/plugins/plot_pie/gog-pie-prefs.c
@@ -161,7 +161,7 @@ gog_pie_plot_pref (GogPiePlot *pie, GOCmdContext *cc)
        state = g_new0 (PiePrefState, 1);
        state->gobj = GOG_OBJECT (pie);
        state->separation_spinner = go_gtk_builder_get_widget (gui, "separation_spinner");
-       g_object_ref (G_OBJECT (pie));
+       g_object_ref (pie);
 
        gog_pie_plot_pref_signal_connect (pie, gui);
 
@@ -202,7 +202,7 @@ gog_ring_plot_pref (GogRingPlot *ring, GOCmdContext *cc)
        state = g_new0 (PiePrefState, 1);
        state->gobj = GOG_OBJECT (ring);
        state->separation_spinner = go_gtk_builder_get_widget (gui, "separation_spinner");
-       g_object_ref (G_OBJECT (ring));
+       g_object_ref (ring);
 
        gog_pie_plot_pref_signal_connect (GOG_PIE_PLOT (ring), gui);
 
diff --git a/plugins/plot_pie/gog-pie.c b/plugins/plot_pie/gog-pie.c
index f52003c..cf16962 100644
--- a/plugins/plot_pie/gog-pie.c
+++ b/plugins/plot_pie/gog-pie.c
@@ -89,7 +89,7 @@ gog_pie_series_element_populate_editor (GogObject *gobj,
 {
        GtkWidget *widget = gog_pie_series_element_pref (GOG_PIE_SERIES_ELEMENT (gobj), cc);
        go_editor_add_page (editor, widget, _("Settings"));
-       g_object_unref (G_OBJECT (widget));
+       g_object_unref (widget);
        return widget;
 }
 #endif
@@ -273,7 +273,7 @@ gog_pie_plot_populate_editor (GogObject *item,
        go_editor_add_page (editor,
                             widget,
                             _("Properties"));
-       g_object_unref (G_OBJECT (widget));
+       g_object_unref (widget);
 
        (GOG_OBJECT_CLASS(pie_parent_klass)->populate_editor) (item, editor, dalloc, cc);
 }
@@ -436,7 +436,7 @@ gog_ring_plot_populate_editor (GogObject *item,
        go_editor_add_page (editor,
                             widget,
                             _("Properties"));
-       g_object_unref (G_OBJECT (widget));
+       g_object_unref (widget);
 }
 #endif
 
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 7ad3fd1..04a3834 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -313,7 +313,7 @@ gog_xyz_surface_plot_populate_editor (GogObject *item,
                                plot_xyz_surface_parent_klass;
        GtkWidget *w = gog_xyz_surface_plot_pref (GOG_XYZ_PLOT (item), dalloc, cc);
        go_editor_add_page (editor, w, _("Properties"));
-       g_object_unref (G_OBJECT (w));
+       g_object_unref (w);
 
        (GOG_OBJECT_CLASS (klass)->populate_editor) (item, editor, dalloc, cc);
 }
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 6d00546..b859751 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -461,7 +461,7 @@ gog_bubble_plot_populate_editor (GogObject *obj,
 {
        GtkWidget *w = gog_bubble_plot_pref (GOG_BUBBLE_PLOT (obj), cc);
        go_editor_add_page (editor, w, _("Properties"));
-       g_object_unref (G_OBJECT (w));
+       g_object_unref (w);
 
        (GOG_OBJECT_CLASS(bubble_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
 }


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