[gedit] The King is Dead for the file browser



commit 5af28c20a7bb1d1cf451e865c56adb69314b5724
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Jul 29 17:50:44 2013 +0200

    The King is Dead for the file browser
    
    The King is now Dead everywhere the composite widget templates are used
    (normally), to avoid segfaults.

 configure.ac                                     |    2 +-
 plugins/filebrowser/gedit-file-bookmarks-store.c |   21 ++++++---------------
 plugins/filebrowser/gedit-file-browser-plugin.c  |    8 ++------
 plugins/filebrowser/gedit-file-browser-store.c   |   10 ++--------
 plugins/filebrowser/gedit-file-browser-view.c    |   15 ++++++---------
 plugins/filebrowser/gedit-file-browser-widget.c  |   15 ++++++---------
 6 files changed, 23 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0bcf8fa..c1a55d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,7 +323,7 @@ dnl ================================================================
 
 PKG_CHECK_MODULES(GEDIT, [
        libxml-2.0 >= 2.5.0
-       glib-2.0 >= 2.28.0
+       glib-2.0 >= 2.37.5
        gio-2.0 >= 2.37.0
        gtk+-3.0 >= 3.9.9
        gtksourceview-3.0 >= 3.9.4
diff --git a/plugins/filebrowser/gedit-file-bookmarks-store.c 
b/plugins/filebrowser/gedit-file-bookmarks-store.c
index 7cb71a0..49badf2 100644
--- a/plugins/filebrowser/gedit-file-bookmarks-store.c
+++ b/plugins/filebrowser/gedit-file-bookmarks-store.c
@@ -27,10 +27,6 @@
 #include "gedit-file-bookmarks-store.h"
 #include "gedit-file-browser-utils.h"
 
-#define GEDIT_FILE_BOOKMARKS_STORE_GET_PRIVATE(object)( \
-               G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_FILE_BOOKMARKS_STORE, \
-               GeditFileBookmarksStorePrivate))
-
 struct _GeditFileBookmarksStorePrivate
 {
        GVolumeMonitor *volume_monitor;
@@ -55,7 +51,11 @@ static gboolean find_with_flags       (GtkTreeModel            *model,
                                        guint                    flags,
                                        guint                    notflags);
 
-G_DEFINE_DYNAMIC_TYPE (GeditFileBookmarksStore, gedit_file_bookmarks_store, GTK_TYPE_TREE_STORE)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBookmarksStore,
+                               gedit_file_bookmarks_store,
+                               GTK_TYPE_TREE_STORE,
+                               0,
+                               G_ADD_PRIVATE_DYNAMIC (GeditFileBookmarksStore))
 
 static void
 gedit_file_bookmarks_store_dispose (GObject *object)
@@ -78,20 +78,11 @@ gedit_file_bookmarks_store_dispose (GObject *object)
 }
 
 static void
-gedit_file_bookmarks_store_finalize (GObject *object)
-{
-       G_OBJECT_CLASS (gedit_file_bookmarks_store_parent_class)->finalize (object);
-}
-
-static void
 gedit_file_bookmarks_store_class_init (GeditFileBookmarksStoreClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
        object_class->dispose = gedit_file_bookmarks_store_dispose;
-       object_class->finalize = gedit_file_bookmarks_store_finalize;
-
-       g_type_class_add_private (object_class, sizeof (GeditFileBookmarksStorePrivate));
 }
 
 static void
@@ -102,7 +93,7 @@ gedit_file_bookmarks_store_class_finalize (GeditFileBookmarksStoreClass *klass)
 static void
 gedit_file_bookmarks_store_init (GeditFileBookmarksStore *obj)
 {
-       obj->priv = GEDIT_FILE_BOOKMARKS_STORE_GET_PRIVATE (obj);
+       obj->priv = gedit_file_bookmarks_store_get_instance_private (obj);
 }
 
 /* Private */
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 3061eb3..65292ae 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -59,8 +59,6 @@
 #define TERMINAL_BASE_SETTINGS         "org.gnome.desktop.default-applications.terminal"
 #define TERMINAL_EXEC_KEY              "exec"
 
-#define GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE(object)  (G_TYPE_INSTANCE_GET_PRIVATE ((object), 
GEDIT_TYPE_FILE_BROWSER_PLUGIN, GeditFileBrowserPluginPrivate))
-
 struct _GeditFileBrowserPluginPrivate
 {
        GSettings              *settings;
@@ -119,6 +117,7 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserPlugin,
                                gedit_file_browser_plugin,
                                G_TYPE_OBJECT,
                                0,
+                               G_ADD_PRIVATE_DYNAMIC (GeditFileBrowserPlugin)
                                G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_WINDOW_ACTIVATABLE,
                                                               gedit_window_activatable_iface_init)     \
                                                                                                        \
@@ -157,7 +156,7 @@ settings_try_new (const gchar *schema)
 static void
 gedit_file_browser_plugin_init (GeditFileBrowserPlugin *plugin)
 {
-       plugin->priv = GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
+       plugin->priv = gedit_file_browser_plugin_get_instance_private (plugin);
 
        plugin->priv->settings = g_settings_new (FILEBROWSER_BASE_SETTINGS);
        plugin->priv->terminal_settings = g_settings_new (TERMINAL_BASE_SETTINGS);
@@ -633,9 +632,6 @@ gedit_file_browser_plugin_class_init (GeditFileBrowserPluginClass *klass)
        object_class->get_property = gedit_file_browser_plugin_get_property;
 
        g_object_class_override_property (object_class, PROP_WINDOW, "window");
-
-       g_type_class_add_private (object_class,
-                                 sizeof (GeditFileBrowserPluginPrivate));
 }
 
 static void
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index dc17f57..8faba2c 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -34,10 +34,6 @@
 #include "gedit-file-browser-error.h"
 #include "gedit-file-browser-utils.h"
 
-#define GEDIT_FILE_BROWSER_STORE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
-                                                    GEDIT_TYPE_FILE_BROWSER_STORE, \
-                                                    GeditFileBrowserStorePrivate))
-
 #define NODE_IS_DIR(node)              (FILE_IS_DIR((node)->flags))
 #define NODE_IS_HIDDEN(node)           (FILE_IS_HIDDEN((node)->flags))
 #define NODE_IS_TEXT(node)             (FILE_IS_TEXT((node)->flags))
@@ -204,6 +200,7 @@ static void delete_files                                    (AsyncData
 G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserStore, gedit_file_browser_store,
                                G_TYPE_OBJECT,
                                0,
+                               G_ADD_PRIVATE_DYNAMIC (GeditFileBrowserStore)
                                G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_MODEL,
                                                               gedit_file_browser_store_iface_init)
                                G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_TREE_DRAG_SOURCE,
@@ -449,9 +446,6 @@ gedit_file_browser_store_class_init (GeditFileBrowserStoreClass *klass)
                          g_cclosure_marshal_VOID__OBJECT,
                          G_TYPE_NONE, 1,
                          G_TYPE_FILE);
-
-       g_type_class_add_private (object_class,
-                                 sizeof (GeditFileBrowserStorePrivate));
 }
 
 static void
@@ -488,7 +482,7 @@ gedit_file_browser_store_drag_source_init (GtkTreeDragSourceIface *iface)
 static void
 gedit_file_browser_store_init (GeditFileBrowserStore *obj)
 {
-       obj->priv = GEDIT_FILE_BROWSER_STORE_GET_PRIVATE (obj);
+       obj->priv = gedit_file_browser_store_get_instance_private (obj);
 
        obj->priv->column_types[GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION] = G_TYPE_FILE;
        obj->priv->column_types[GEDIT_FILE_BROWSER_STORE_COLUMN_MARKUP] = G_TYPE_STRING;
diff --git a/plugins/filebrowser/gedit-file-browser-view.c b/plugins/filebrowser/gedit-file-browser-view.c
index 58d3031..30b1a10 100644
--- a/plugins/filebrowser/gedit-file-browser-view.c
+++ b/plugins/filebrowser/gedit-file-browser-view.c
@@ -31,10 +31,6 @@
 #include "gedit-file-browser-marshal.h"
 #include "gedit-file-browser-enum-types.h"
 
-#define GEDIT_FILE_BROWSER_VIEW_GET_PRIVATE(object)( \
-               G_TYPE_INSTANCE_GET_PRIVATE((object), \
-               GEDIT_TYPE_FILE_BROWSER_VIEW, GeditFileBrowserViewPrivate))
-
 struct _GeditFileBrowserViewPrivate
 {
        GtkTreeViewColumn *column;
@@ -88,7 +84,11 @@ static const GtkTargetEntry drag_source_targets[] = {
        { "text/uri-list", 0, 0 }
 };
 
-G_DEFINE_DYNAMIC_TYPE (GeditFileBrowserView, gedit_file_browser_view, GTK_TYPE_TREE_VIEW)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserView,
+                               gedit_file_browser_view,
+                               GTK_TYPE_TREE_VIEW,
+                               0,
+                               G_ADD_PRIVATE_DYNAMIC (GeditFileBrowserView))
 
 static void on_cell_edited             (GtkCellRendererText    *cell,
                                         gchar                  *path,
@@ -970,9 +970,6 @@ gedit_file_browser_view_class_init (GeditFileBrowserViewClass *klass)
                                           bookmark_activated), NULL, NULL,
                          g_cclosure_marshal_VOID__BOXED,
                          G_TYPE_NONE, 1, GTK_TYPE_TREE_ITER);
-
-       g_type_class_add_private (object_class,
-                                 sizeof (GeditFileBrowserViewPrivate));
 }
 
 static void
@@ -1015,7 +1012,7 @@ cell_data_cb (GtkTreeViewColumn    *tree_column,
 static void
 gedit_file_browser_view_init (GeditFileBrowserView *obj)
 {
-       obj->priv = GEDIT_FILE_BROWSER_VIEW_GET_PRIVATE (obj);
+       obj->priv = gedit_file_browser_view_get_instance_private (obj);
 
        obj->priv->column = gtk_tree_view_column_new ();
 
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index ec4bcd1..99068db 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -40,10 +40,6 @@
 #include "gedit-file-browser-marshal.h"
 #include "gedit-file-browser-enum-types.h"
 
-#define GEDIT_FILE_BROWSER_WIDGET_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), \
-                                                     GEDIT_TYPE_FILE_BROWSER_WIDGET, \
-                                                     GeditFileBrowserWidgetPrivate))
-
 #define LOCATION_DATA_KEY "gedit-file-browser-widget-location"
 
 enum
@@ -266,7 +262,11 @@ static void set_active_root_activated          (GSimpleAction          *action,
                                                 GVariant               *parameter,
                                                 gpointer                user_data);
 
-G_DEFINE_DYNAMIC_TYPE (GeditFileBrowserWidget, gedit_file_browser_widget, GTK_TYPE_GRID)
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserWidget,
+                               gedit_file_browser_widget,
+                               GTK_TYPE_GRID,
+                               0,
+                               G_ADD_PRIVATE_DYNAMIC (GeditFileBrowserWidget))
 
 static void
 free_name_icon (gpointer data)
@@ -565,9 +565,6 @@ gedit_file_browser_widget_class_init (GeditFileBrowserWidgetClass *klass)
        gtk_widget_class_bind_template_child_private (widget_class, GeditFileBrowserWidget, filter_entry);
        gtk_widget_class_bind_template_child_private (widget_class, GeditFileBrowserWidget, 
location_previous_menu);
        gtk_widget_class_bind_template_child_private (widget_class, GeditFileBrowserWidget, 
location_next_menu);
-
-       g_type_class_add_private (object_class,
-                                 sizeof (GeditFileBrowserWidgetPrivate));
 }
 
 static void
@@ -954,7 +951,7 @@ gedit_file_browser_widget_init (GeditFileBrowserWidget *obj)
        GAction *action;
        GError *error = NULL;
 
-       obj->priv = GEDIT_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
+       obj->priv = gedit_file_browser_widget_get_instance_private (obj);
 
        obj->priv->filter_pattern_str = g_strdup ("");
        obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,


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