diff options
author | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-09-02 07:20:17 +0800 |
commit | 73a95385f4034998cc78199dc8bb9ee22d90d6aa (patch) | |
tree | 499d78ab52e8937f672e3659105dda083a34c988 /lib/widgets | |
parent | 3375c1878c4c0ebf4f5067d128024ea484208f62 (diff) | |
download | gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.gz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.bz2 gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.lz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.xz gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.tar.zst gsoc2013-epiphany-73a95385f4034998cc78199dc8bb9ee22d90d6aa.zip |
Mega-patch, changelog too long to paste here.
Diffstat (limited to 'lib/widgets')
-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 |
12 files changed, 98 insertions, 104 deletions
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) { |