diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-autocompletion.c | 14 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 22 | ||||
-rw-r--r-- | lib/ephy-dialog.h | 15 | ||||
-rw-r--r-- | lib/ephy-node-db.c | 16 | ||||
-rw-r--r-- | lib/ephy-node-filter.c | 15 | ||||
-rw-r--r-- | lib/widgets/ephy-arrow-toolbutton.c | 11 | ||||
-rw-r--r-- | lib/widgets/ephy-arrow-toolbutton.h | 14 | ||||
-rw-r--r-- | lib/widgets/ephy-autocompletion-window.c | 15 | ||||
-rw-r--r-- | lib/widgets/ephy-location-entry.c | 11 | ||||
-rw-r--r-- | lib/widgets/ephy-node-view.c | 19 | ||||
-rw-r--r-- | lib/widgets/ephy-search-entry.c | 29 | ||||
-rw-r--r-- | lib/widgets/ephy-spinner.c | 23 | ||||
-rw-r--r-- | lib/widgets/ephy-spinner.h | 13 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-node.c | 18 | ||||
-rw-r--r-- | lib/widgets/ephy-tree-model-sort.c | 14 | ||||
-rw-r--r-- | lib/widgets/ephy-zoom-action.c | 23 | ||||
-rw-r--r-- | lib/widgets/ephy-zoom-control.c | 12 |
17 files changed, 136 insertions, 148 deletions
diff --git a/lib/ephy-autocompletion.c b/lib/ephy-autocompletion.c index 17fc052b7..6c28eaf78 100644 --- a/lib/ephy-autocompletion.c +++ b/lib/ephy-autocompletion.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * */ #include <string.h> @@ -45,6 +44,8 @@ typedef struct { #define ACMA_BASE_SIZE 10240 +#define EPHY_AUTOCOMPLETION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_AUTOCOMPLETION, EphyAutocompletionPrivate)) + struct _EphyAutocompletionPrivate { GSList *sources; @@ -125,9 +126,12 @@ ephy_autocompletion_get_type (void) static void ephy_autocompletion_class_init (EphyAutocompletionClass *klass) { - G_OBJECT_CLASS (klass)->finalize = ephy_autocompletion_finalize_impl; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + g_object_class = g_type_class_peek_parent (klass); + object_class->finalize = ephy_autocompletion_finalize_impl; + EphyAutocompletionSignals[EPHY_AUTOCOMPLETION_SOURCES_CHANGED] = g_signal_new ( "sources-changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP, @@ -135,12 +139,14 @@ ephy_autocompletion_class_init (EphyAutocompletionClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyAutocompletionPrivate)); } static void ephy_autocompletion_init (EphyAutocompletion *ac) { - EphyAutocompletionPrivate *p = g_new0 (EphyAutocompletionPrivate, 1); + EphyAutocompletionPrivate *p = EPHY_AUTOCOMPLETION_GET_PRIVATE (ac); ac->priv = p; p->sources = NULL; acma_init (&p->matches); @@ -184,8 +190,6 @@ ephy_autocompletion_finalize_impl (GObject *o) g_strfreev (p->prefixes); g_free (p->prefix_lengths); - g_free (p); - G_OBJECT_CLASS (g_object_class)->finalize (o); } diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 79b70c257..973aca87a 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include "ephy-dialog.h" @@ -94,6 +96,8 @@ typedef struct GList *string_enum; } PropertyInfo; +#define EPHY_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DIALOG, EphyDialogPrivate)) + struct EphyDialogPrivate { GtkWidget *parent; @@ -188,6 +192,8 @@ ephy_dialog_class_init (EphyDialogClass *klass) "Modal dialog", FALSE, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyDialogPrivate)); } static void @@ -798,7 +804,7 @@ prefs_connect_signals (EphyDialog *dialog) static void ephy_dialog_init (EphyDialog *dialog) { - dialog->priv = g_new0 (EphyDialogPrivate, 1); + dialog->priv = EPHY_DIALOG_GET_PRIVATE (dialog); dialog->priv->parent = NULL; dialog->priv->dialog = NULL; @@ -939,20 +945,12 @@ free_props (PropertyInfo *properties) static void ephy_dialog_finalize (GObject *object) { - EphyDialog *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EPHY_DIALOG (object)); - - dialog = EPHY_DIALOG (object); - - g_return_if_fail (dialog->priv != NULL); + EphyDialog *dialog = EPHY_DIALOG (object); free_props (dialog->priv->props); g_free (dialog->priv->name); g_free (dialog->priv->props); - g_free (dialog->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1011,13 +1009,13 @@ ephy_dialog_set_parent (EphyDialog *dialog, EphyDialog * ephy_dialog_new (void) { - return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE, NULL)); + return EPHY_DIALOG (g_object_new (EPHY_TYPE_DIALOG, NULL)); } EphyDialog * ephy_dialog_new_with_parent (GtkWidget *parent_window) { - return EPHY_DIALOG (g_object_new (EPHY_DIALOG_TYPE, + return EPHY_DIALOG (g_object_new (EPHY_TYPE_DIALOG, "ParentWindow", parent_window, NULL)); } diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h index 646c146fc..572280dc7 100644 --- a/lib/ephy-dialog.h +++ b/lib/ephy-dialog.h @@ -25,15 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyDialogClass EphyDialogClass; - -#define EPHY_DIALOG_TYPE (ephy_dialog_get_type ()) -#define EPHY_DIALOG(obj) (GTK_CHECK_CAST ((obj), EPHY_DIALOG_TYPE, EphyDialog)) -#define EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_DIALOG_TYPE, EphyDialogClass)) -#define IS_EPHY_DIALOG(obj) (GTK_CHECK_TYPE ((obj), EPHY_DIALOG_TYPE)) -#define IS_EPHY_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_DIALOG)) -#define EPHY_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EPHY_DIALOG_TYPE, EphyDialogClass)) +#define EPHY_TYPE_DIALOG (ephy_dialog_get_type ()) +#define EPHY_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_DIALOG, EphyDialog)) +#define EPHY_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_DIALOG, EphyDialogClass)) +#define EPHY_IS_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_DIALOG)) +#define EPHY_IS_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_DIALOG)) +#define EPHY_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_DIALOG, EphyDialogClass)) +typedef struct EphyDialogClass EphyDialogClass; typedef struct EphyDialog EphyDialog; typedef struct EphyDialogPrivate EphyDialogPrivate; diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c index 86913d93c..c6d084bed 100644 --- a/lib/ephy-node-db.c +++ b/lib/ephy-node-db.c @@ -33,6 +33,8 @@ enum PROP_NAME }; +#define EPHY_NODE_DB_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_DB, EphyNodeDbPrivate)) + struct EphyNodeDbPrivate { char *name; @@ -142,12 +144,14 @@ ephy_node_db_class_init (EphyNodeDbClass *klass) "Name", NULL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyNodeDbPrivate)); } static void ephy_node_db_init (EphyNodeDb *db) { - db->priv = g_new0 (EphyNodeDbPrivate, 1); + db->priv = EPHY_NODE_DB_GET_PRIVATE (db); db->priv->name = NULL; @@ -165,13 +169,7 @@ ephy_node_db_init (EphyNodeDb *db) static void ephy_node_db_finalize (GObject *object) { - EphyNodeDb *db; - - g_return_if_fail (object != NULL); - - db = EPHY_NODE_DB (object); - - g_return_if_fail (db->priv != NULL); + EphyNodeDb *db = EPHY_NODE_DB (object); g_hash_table_remove (ephy_node_databases, db->priv->name); if (g_hash_table_size (ephy_node_databases) == 0) @@ -187,8 +185,6 @@ ephy_node_db_finalize (GObject *object) g_free (db->priv->name); - g_free (db->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/ephy-node-filter.c b/lib/ephy-node-filter.c index 8f0bddbc0..93e2fb902 100644 --- a/lib/ephy-node-filter.c +++ b/lib/ephy-node-filter.c @@ -37,6 +37,8 @@ enum LAST_SIGNAL }; +#define EPHY_NODE_FILTER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_FILTER, EphyNodeFilterPrivate)) + struct EphyNodeFilterPrivate { GPtrArray *levels; @@ -118,12 +120,14 @@ ephy_node_filter_class_init (EphyNodeFilterClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyNodeFilterPrivate)); } static void ephy_node_filter_init (EphyNodeFilter *filter) { - filter->priv = g_new0 (EphyNodeFilterPrivate, 1); + filter->priv = EPHY_NODE_FILTER_GET_PRIVATE (filter); filter->priv->levels = g_ptr_array_new (); } @@ -131,14 +135,7 @@ ephy_node_filter_init (EphyNodeFilter *filter) static void ephy_node_filter_finalize (GObject *object) { - EphyNodeFilter *filter; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_NODE_FILTER (object)); - - filter = EPHY_NODE_FILTER (object); - - g_return_if_fail (filter->priv != NULL); + EphyNodeFilter *filter = EPHY_NODE_FILTER (object); ephy_node_filter_empty (filter); diff --git a/lib/widgets/ephy-arrow-toolbutton.c b/lib/widgets/ephy-arrow-toolbutton.c index e40237f5f..147c7d80b 100644 --- a/lib/widgets/ephy-arrow-toolbutton.c +++ b/lib/widgets/ephy-arrow-toolbutton.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * */ #include "ephy-arrow-toolbutton.h" @@ -30,6 +29,8 @@ #include <gtk/gtkmenu.h> #include <gtk/gtkmain.h> +#define EPHY_ARROW_TOOLBUTTON_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonPrivate)) + struct EphyArrowToolButtonPrivate { GtkWidget *arrow_widget; @@ -88,7 +89,7 @@ ephy_arrow_toolbutton_set_tooltip (GtkToolItem *tool_item, { EphyArrowToolButton *button = EPHY_ARROW_TOOLBUTTON (tool_item); - g_return_val_if_fail (IS_EPHY_ARROW_TOOLBUTTON (button), FALSE); + g_return_val_if_fail (EPHY_IS_ARROW_TOOLBUTTON (button), FALSE); gtk_tooltips_set_tip (tooltips, button->priv->button, tip_text, tip_private); @@ -115,6 +116,8 @@ ephy_arrow_toolbutton_class_init (EphyArrowToolButtonClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyArrowToolButtonPrivate)); } static void @@ -202,7 +205,7 @@ ephy_arrow_toolbutton_init (EphyArrowToolButton *arrowtb) GtkWidget *arrow_button; GtkWidget *real_button; - arrowtb->priv = g_new (EphyArrowToolButtonPrivate, 1); + arrowtb->priv = EPHY_ARROW_TOOLBUTTON_GET_PRIVATE (arrowtb); gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (arrowtb), FALSE); @@ -256,8 +259,6 @@ ephy_arrow_toolbutton_finalize (GObject *object) gtk_widget_destroy (GTK_WIDGET (arrow_toolbutton->priv->menu)); - g_free (arrow_toolbutton->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-arrow-toolbutton.h b/lib/widgets/ephy-arrow-toolbutton.h index f1452f585..2e2164592 100644 --- a/lib/widgets/ephy-arrow-toolbutton.h +++ b/lib/widgets/ephy-arrow-toolbutton.h @@ -25,14 +25,14 @@ G_BEGIN_DECLS -typedef struct EphyArrowToolButtonClass EphyArrowToolButtonClass; - -#define EPHY_ARROW_TOOLBUTTON_TYPE (ephy_arrow_toolbutton_get_type ()) -#define EPHY_ARROW_TOOLBUTTON(obj) (GTK_CHECK_CAST ((obj), EPHY_ARROW_TOOLBUTTON_TYPE, EphyArrowToolButton)) -#define EPHY_ARROW_TOOLBUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_ARROW_TOOLBUTTON_TYPE, EphyArrowToolButtonClass)) -#define IS_EPHY_ARROW_TOOLBUTTON(obj) (GTK_CHECK_TYPE ((obj), EPHY_ARROW_TOOLBUTTON_TYPE)) -#define IS_EPHY_ARROW_TOOLBUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_ARROW_TOOLBUTTON)) +#define EPHY_TYPE_ARROW_TOOLBUTTON (ephy_arrow_toolbutton_get_type ()) +#define EPHY_ARROW_TOOLBUTTON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButton)) +#define EPHY_ARROW_TOOLBUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonClass)) +#define EPHY_IS_ARROW_TOOLBUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_ARROW_TOOLBUTTON)) +#define EPHY_IS_ARROW_TOOLBUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_ARROW_TOOLBUTTON)) +#define EPHY_ARROW_TOOLBUTTON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_ARROW_TOOLBUTTON, EphyArrowToolButtonClass)) +typedef struct EphyArrowToolButtonClass EphyArrowToolButtonClass; typedef struct EphyArrowToolButton EphyArrowToolButton; typedef struct EphyArrowToolButtonPrivate EphyArrowToolButtonPrivate; diff --git a/lib/widgets/ephy-autocompletion-window.c b/lib/widgets/ephy-autocompletion-window.c index 56cbb31ee..39bd9d77e 100644 --- a/lib/widgets/ephy-autocompletion-window.c +++ b/lib/widgets/ephy-autocompletion-window.c @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include <gtk/gtkcellrenderertext.h> @@ -46,6 +48,9 @@ /** * Private data */ + +#define EPHY_AUTOCOMPLETION_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_AUTOCOMPLETION_WINDOW, EphyAutocompletionWindowPrivate)) + struct _EphyAutocompletionWindowPrivate { EphyAutocompletion *autocompletion; GtkWidget *parent; @@ -130,9 +135,12 @@ ephy_autocompletion_window_get_type (void) static void ephy_autocompletion_window_class_init (EphyAutocompletionWindowClass *klass) { - G_OBJECT_CLASS (klass)->finalize = ephy_autocompletion_window_finalize_impl; + GObjectClass *object_class = G_OBJECT_CLASS (klass); + g_object_class = g_type_class_peek_parent (klass); + object_class->finalize = ephy_autocompletion_window_finalize_impl; + EphyAutocompletionWindowSignals[ACTIVATED] = g_signal_new ( "activated", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP, @@ -162,12 +170,14 @@ ephy_autocompletion_window_class_init (EphyAutocompletionWindowClass *klass) NULL, NULL, ephy_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyAutocompletionWindowPrivate)); } static void ephy_autocompletion_window_init (EphyAutocompletionWindow *aw) { - EphyAutocompletionWindowPrivate *p = g_new0 (EphyAutocompletionWindowPrivate, 1); + EphyAutocompletionWindowPrivate *p = EPHY_AUTOCOMPLETION_WINDOW_GET_PRIVATE (aw); GtkTreeSelection *s; aw->priv = p; @@ -207,7 +217,6 @@ ephy_autocompletion_window_finalize_impl (GObject *o) } g_free (p->selected); - g_free (p); gdk_pointer_ungrab (GDK_CURRENT_TIME); gdk_keyboard_ungrab (GDK_CURRENT_TIME); diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c index 1d9d2172f..3c1c6ce52 100644 --- a/lib/widgets/ephy-location-entry.c +++ b/lib/widgets/ephy-location-entry.c @@ -15,6 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #include "ephy-location-entry.h" @@ -37,6 +39,9 @@ /** * Private data */ + +#define EPHY_LOCATION_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LOCATION_ENTRY, EphyLocationEntryPrivate)) + struct _EphyLocationEntryPrivate { GtkWidget *combo; GtkWidget *entry; @@ -198,6 +203,8 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass) G_TYPE_NONE, 0, G_TYPE_NONE); + + g_type_class_add_private (object_class, sizeof (EphyLocationEntryPrivate)); } static gboolean @@ -215,8 +222,9 @@ ephy_location_entry_init (EphyLocationEntry *w) LOG ("EphyLocationEntry initialising %p", w) - p = g_new0 (EphyLocationEntryPrivate, 1); + p = EPHY_LOCATION_ENTRY_GET_PRIVATE (w); w->priv = p; + p->last_action_target = NULL; p->before_completion = NULL; p->user_changed = TRUE; @@ -255,7 +263,6 @@ ephy_location_entry_finalize_impl (GObject *o) g_free (p->before_completion); g_free (p->autocompletion_key); - g_free (p); G_OBJECT_CLASS (parent_class)->finalize (o); } diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c index 9677d8384..9c40f8f06 100644 --- a/lib/widgets/ephy-node-view.c +++ b/lib/widgets/ephy-node-view.c @@ -46,6 +46,9 @@ static void ephy_node_view_get_property (GObject *object, GValue *value, GParamSpec *pspec); + +#define EPHY_NODE_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NODE_VIEW, EphyNodeViewPrivate)) + struct EphyNodeViewPrivate { EphyNode *root; @@ -197,19 +200,14 @@ ephy_node_view_class_init (EphyNodeViewClass *klass) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + g_type_class_add_private (object_class, sizeof (EphyNodeViewPrivate)); } static void ephy_node_view_finalize (GObject *object) { - EphyNodeView *view; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_NODE_VIEW (object)); - - view = EPHY_NODE_VIEW (object); - - g_return_if_fail (view->priv != NULL); + EphyNodeView *view = EPHY_NODE_VIEW (object); g_object_unref (G_OBJECT (view->priv->sortmodel)); g_object_unref (G_OBJECT (view->priv->filtermodel)); @@ -220,8 +218,6 @@ ephy_node_view_finalize (GObject *object) gtk_target_list_unref (view->priv->source_target_list); } - g_free (view->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1304,7 +1300,8 @@ ephy_node_view_add_column (EphyNodeView *view, static void ephy_node_view_init (EphyNodeView *view) { - view->priv = g_new0 (EphyNodeViewPrivate, 1); + view->priv = EPHY_NODE_VIEW_GET_PRIVATE (view); + view->priv->editable_renderer = NULL; view->priv->editing = TRUE; view->priv->searchable_data_column = -1; diff --git a/lib/widgets/ephy-search-entry.c b/lib/widgets/ephy-search-entry.c index e1b106594..1e8a9e096 100644 --- a/lib/widgets/ephy-search-entry.c +++ b/lib/widgets/ephy-search-entry.c @@ -27,7 +27,8 @@ static void ephy_search_entry_class_init (EphySearchEntryClass *klass); static void ephy_search_entry_init (EphySearchEntry *entry); -static void ephy_search_entry_finalize (GObject *object); + +#define EPHY_SEARCH_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryPrivate)) struct EphySearchEntryPrivate { @@ -81,8 +82,6 @@ ephy_search_entry_class_init (EphySearchEntryClass *klass) parent_class = g_type_class_peek_parent (klass); - object_class->finalize = ephy_search_entry_finalize; - ephy_search_entry_signals[SEARCH] = g_signal_new ("search", G_OBJECT_CLASS_TYPE (object_class), @@ -93,6 +92,8 @@ ephy_search_entry_class_init (EphySearchEntryClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); + + g_type_class_add_private (object_class, sizeof (EphySearchEntryPrivate)); } static gboolean @@ -139,7 +140,10 @@ ephy_search_entry_destroy_cb (GtkEditable *editable, static void ephy_search_entry_init (EphySearchEntry *entry) { - entry->priv = g_new0 (EphySearchEntryPrivate, 1); + entry->priv = EPHY_SEARCH_ENTRY_GET_PRIVATE (entry); + + entry->priv->clearing = FALSE; + entry->priv->timeout = 0; g_signal_connect (G_OBJECT (entry), "destroy", @@ -151,23 +155,6 @@ ephy_search_entry_init (EphySearchEntry *entry) entry); } -static void -ephy_search_entry_finalize (GObject *object) -{ - EphySearchEntry *entry; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_SEARCH_ENTRY (object)); - - entry = EPHY_SEARCH_ENTRY (object); - - g_return_if_fail (entry->priv != NULL); - - g_free (entry->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - GtkWidget * ephy_search_entry_new (void) { diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c index abd38984e..09c0c8529 100644 --- a/lib/widgets/ephy-spinner.c +++ b/lib/widgets/ephy-spinner.c @@ -41,6 +41,8 @@ #define spinner_DEFAULT_TIMEOUT 100 /* Milliseconds Per Frame */ +#define EPHY_SPINNER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER, EphySpinnerDetails)) + struct EphySpinnerDetails { GList *image_list; GdkPixbuf *quiescent_pixbuf; @@ -108,7 +110,7 @@ ephy_spinner_new (void) { GtkWidget *s; - s = GTK_WIDGET (g_object_new (EPHY_SPINNER_TYPE, NULL)); + s = GTK_WIDGET (g_object_new (EPHY_TYPE_SPINNER, NULL)); return s; } @@ -173,7 +175,7 @@ ephy_spinner_init (EphySpinner *spinner) | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - spinner->details = g_new0 (EphySpinnerDetails, 1); + spinner->details = EPHY_SPINNER_GET_PRIVATE (spinner); spinner->details->delay = spinner_DEFAULT_TIMEOUT; spinner->details->icon_theme = gnome_icon_theme_new (); @@ -231,7 +233,7 @@ ephy_spinner_expose (GtkWidget *widget, GdkEventExpose *event) int x_offset, y_offset, width, height; GdkRectangle pix_area, dest; - g_return_val_if_fail (IS_EPHY_SPINNER (widget), FALSE); + g_return_val_if_fail (EPHY_IS_SPINNER (widget), FALSE); spinner = EPHY_SPINNER (widget); @@ -506,30 +508,31 @@ ephy_spinner_size_request (GtkWidget *widget, GtkRequisition *requisition) static void ephy_spinner_finalize (GObject *object) { - EphySpinner *spinner; - - spinner = EPHY_SPINNER (object); + EphySpinner *spinner = EPHY_SPINNER (object); ephy_spinner_remove_update_callback (spinner); ephy_spinner_unload_images (spinner); g_object_unref (spinner->details->icon_theme); - g_free (spinner->details); - G_OBJECT_CLASS (parent_class)->finalize (object); } static void ephy_spinner_class_init (EphySpinnerClass *class) { + GObjectClass *object_class; GtkWidgetClass *widget_class; - parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); - G_OBJECT_CLASS (class)->finalize = ephy_spinner_finalize; + parent_class = g_type_class_peek_parent (class); + + object_class->finalize = ephy_spinner_finalize; widget_class->expose_event = ephy_spinner_expose; widget_class->size_request = ephy_spinner_size_request; + + g_type_class_add_private (object_class, sizeof (EphySpinnerDetails)); } diff --git a/lib/widgets/ephy-spinner.h b/lib/widgets/ephy-spinner.h index 3070d0473..c573488e6 100644 --- a/lib/widgets/ephy-spinner.h +++ b/lib/widgets/ephy-spinner.h @@ -32,13 +32,12 @@ G_BEGIN_DECLS -#define EPHY_SPINNER_TYPE (ephy_spinner_get_type ()) -#define EPHY_SPINNER(obj) (GTK_CHECK_CAST ((obj), EPHY_SPINNER_TYPE, EphySpinner)) -#define EPHY_SPINNER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EPHY_SPINNER_TYPE, EphySpinnerClass)) -#define IS_EPHY_SPINNER(obj) (GTK_CHECK_TYPE ((obj), EPHY_SPINNER_TYPE)) -#define IS_EPHY_SPINNER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), EPHY_SPINNER_TYPE)) - -typedef struct EphySpinnerInfo EphySpinnerInfo; +#define EPHY_TYPE_SPINNER (ephy_spinner_get_type ()) +#define EPHY_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SPINNER, EphySpinner)) +#define EPHY_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SPINNER, EphySpinnerClass)) +#define EPHY_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SPINNER)) +#define EPHY_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SPINNER)) +#define EPHY_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SPINNER, EphySpinnerClass)) typedef struct EphySpinner EphySpinner; typedef struct EphySpinnerClass EphySpinnerClass; diff --git a/lib/widgets/ephy-tree-model-node.c b/lib/widgets/ephy-tree-model-node.c index 563853016..2f1acb5a1 100644 --- a/lib/widgets/ephy-tree-model-node.c +++ b/lib/widgets/ephy-tree-model-node.c @@ -85,6 +85,8 @@ static void root_destroy_cb (EphyNode *node, static inline GtkTreePath *get_path_real (EphyTreeModelNode *model, EphyNode *node); +#define EPHY_TREE_MODEL_NODE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TREE_MODEL_NODE, EphyTreeModelNodePrivate)) + struct EphyTreeModelNodePrivate { EphyNode *root; @@ -176,6 +178,8 @@ ephy_tree_model_node_class_init (EphyTreeModelNodeClass *klass) "Filter object", EPHY_TYPE_NODE_FILTER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (object_class, sizeof (EphyTreeModelNodePrivate)); } static void @@ -189,8 +193,9 @@ ephy_tree_model_node_init (EphyTreeModelNode *model) } while (model->stamp == 0); - model->priv = g_new0 (EphyTreeModelNodePrivate, 1); + model->priv = EPHY_TREE_MODEL_NODE_GET_PRIVATE (model); + /* FIXME: huh? */ dummy = gtk_tree_view_new (); gtk_widget_destroy (dummy); @@ -202,19 +207,10 @@ ephy_tree_model_node_init (EphyTreeModelNode *model) static void ephy_tree_model_node_finalize (GObject *object) { - EphyTreeModelNode *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_TREE_MODEL_NODE (object)); - - model = EPHY_TREE_MODEL_NODE (object); - - g_return_if_fail (model->priv != NULL); + EphyTreeModelNode *model = EPHY_TREE_MODEL_NODE (object); g_ptr_array_free (model->priv->columns, TRUE); - g_free (model->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-tree-model-sort.c b/lib/widgets/ephy-tree-model-sort.c index 14096989b..40c519aa2 100644 --- a/lib/widgets/ephy-tree-model-sort.c +++ b/lib/widgets/ephy-tree-model-sort.c @@ -41,6 +41,8 @@ static gboolean ephy_tree_model_sort_multi_drag_data_get (EggTreeMultiDragSource static gboolean ephy_tree_model_sort_multi_drag_data_delete (EggTreeMultiDragSource *drag_source, GList *path_list); +#define EPHY_TREE_MODEL_SORT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TREE_MODEL_SORT, EphyTreeModelSortPrivate)) + struct EphyTreeModelSortPrivate { char *str_list; @@ -95,12 +97,14 @@ ephy_tree_model_sort_class_init (EphyTreeModelSortClass *klass) parent_class = g_type_class_peek_parent (klass); object_class->finalize = ephy_tree_model_sort_finalize; + + g_type_class_add_private (object_class, sizeof (EphyTreeModelSortPrivate)); } static void ephy_tree_model_sort_init (EphyTreeModelSort *ma) { - ma->priv = g_new0 (EphyTreeModelSortPrivate, 1); + ma->priv = EPHY_TREE_MODEL_SORT_GET_PRIVATE (ma); ma->priv->drag_column_id = -1; } @@ -108,15 +112,9 @@ ephy_tree_model_sort_init (EphyTreeModelSort *ma) static void ephy_tree_model_sort_finalize (GObject *object) { - EphyTreeModelSort *model; - - g_return_if_fail (object != NULL); - g_return_if_fail (EPHY_IS_TREE_MODEL_SORT (object)); - - model = EPHY_TREE_MODEL_SORT (object); + EphyTreeModelSort *model = EPHY_TREE_MODEL_SORT (object); g_free (model->priv->str_list); - g_free (model->priv); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/lib/widgets/ephy-zoom-action.c b/lib/widgets/ephy-zoom-action.c index c952a1a08..e5e04f04e 100644 --- a/lib/widgets/ephy-zoom-action.c +++ b/lib/widgets/ephy-zoom-action.c @@ -15,6 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifdef HAVE_CONFIG_H @@ -28,6 +30,8 @@ #include <glib-object.h> #include <bonobo/bonobo-i18n.h> +#define EPHY_ZOOM_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_ACTION, EphyZoomActionPrivate)) + struct _EphyZoomActionPrivate { float zoom; }; @@ -41,7 +45,6 @@ enum static void ephy_zoom_action_init (EphyZoomAction *action); static void ephy_zoom_action_class_init (EphyZoomActionClass *class); -static void ephy_zoom_action_finalize (GObject *object); enum { @@ -150,15 +153,13 @@ ephy_zoom_action_get_property (GObject *object, static void ephy_zoom_action_class_init (EphyZoomActionClass *class) { - GtkActionClass *action_class; GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkActionClass *action_class = GTK_ACTION_CLASS (class); object_class->set_property = ephy_zoom_action_set_property; object_class->get_property = ephy_zoom_action_get_property; - object_class->finalize = ephy_zoom_action_finalize; parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); action_class->toolbar_item_type = EPHY_TYPE_ZOOM_CONTROL; action_class->connect_proxy = connect_proxy; @@ -183,26 +184,18 @@ ephy_zoom_action_class_init (EphyZoomActionClass *class) G_TYPE_NONE, 1, G_TYPE_FLOAT); + + g_type_class_add_private (object_class, sizeof (EphyZoomActionPrivate)); } static void ephy_zoom_action_init (EphyZoomAction *action) { - action->priv = g_new0 (EphyZoomActionPrivate, 1); + action->priv = EPHY_ZOOM_ACTION_GET_PRIVATE (action); action->priv->zoom = 1.0; } -static void -ephy_zoom_action_finalize (GObject *object) -{ - EphyZoomAction *action = EPHY_ZOOM_ACTION (object); - - g_free (action->priv); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - void ephy_zoom_action_set_zoom_level (EphyZoomAction *action, float zoom) { diff --git a/lib/widgets/ephy-zoom-control.c b/lib/widgets/ephy-zoom-control.c index 91c611012..6fe7dd9f6 100644 --- a/lib/widgets/ephy-zoom-control.c +++ b/lib/widgets/ephy-zoom-control.c @@ -14,6 +14,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ */ #ifdef HAVE_CONFIG_H @@ -33,6 +35,9 @@ /** * Private data */ + +#define EPHY_ZOOM_CONTROL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ZOOM_CONTROL, EphyZoomControlPrivate)) + struct _EphyZoomControlPrivate { GtkWidget *option_menu; float zoom; @@ -191,7 +196,7 @@ ephy_zoom_control_init (EphyZoomControl *control) GtkWidget *item, *menu, *box; guint i; - p = g_new0 (EphyZoomControlPrivate, 1); + p = EPHY_ZOOM_CONTROL_GET_PRIVATE (control); control->priv = p; p->zoom = 1.0; @@ -325,6 +330,8 @@ ephy_zoom_control_class_init (EphyZoomControlClass *klass) G_TYPE_NONE, 1, G_TYPE_FLOAT); + + g_type_class_add_private (object_class, sizeof (EphyZoomControlPrivate)); } static void @@ -334,12 +341,9 @@ ephy_zoom_control_finalize (GObject *o) g_object_unref (control->priv->option_menu); - g_free (control->priv); - G_OBJECT_CLASS (parent_class)->finalize (o); } - void ephy_zoom_control_set_zoom_level (EphyZoomControl *control, float zoom) { |