pspp-dev
[Top][All Lists]
Advanced

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

Re: [PATCH 16/17] psppire-cell-renderer-button: New cell renderer for Gt


From: Ben Pfaff
Subject: Re: [PATCH 16/17] psppire-cell-renderer-button: New cell renderer for GtkButton.
Date: Mon, 23 Apr 2012 22:50:18 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

John Darrington <address@hidden> writes:

> On Sun, Apr 22, 2012 at 11:12:34AM -0700, Ben Pfaff wrote:
>      This allows one to put a clickable GtkButton inside a PsppSheetView row.
>      +  g_object_class_install_property (G_OBJECT_CLASS (class),
>      +                                   PROP_PATH,
>      +                                   g_param_spec_string ("path",
>      +                                                        _("TreeView 
> path"),
>      +                                                        _("The path to 
> the row in the GtkTreeView, as a string"),
>      +                                                        "",
>      +                                                        
> G_PARAM_READWRITE));
>
> In other paramSpecs we've used P_() instead of _() - or nothing.  If these 
> strings are going
> to be translated, they should have a separate domain I think.

I decided to just remove the _().  The benefit of translating
this stuff is probably less than the cost to translators of
bothering.

>      +static void
>      +psppire_cell_renderer_button_init (PsppireCellRendererButton *obj)
>      +{
>      +  obj->editable = FALSE;
>      +  obj->label = g_strdup ("");
>
> This dynamically allocated string needs to be freed in the dispose/finalize 
> method 

Good point, I folded in the following:

diff --git a/src/ui/gui/psppire-cell-renderer-button.c 
b/src/ui/gui/psppire-cell-renderer-button.c
index 6c251ba..fe8a150 100644
--- a/src/ui/gui/psppire-cell-renderer-button.c
+++ b/src/ui/gui/psppire-cell-renderer-button.c
@@ -31,12 +31,14 @@
 #define _(msgid) gettext (msgid)
 
 static void psppire_cell_renderer_button_destroy (GtkObject *);
+static void psppire_cell_renderer_button_finalize (GObject *);
 
 static void update_style_cache (PsppireCellRendererButton *button,
                                 GtkWidget                 *widget);
 
 static void psppire_cell_renderer_button_load_gtkrc (void);
 
+
 G_DEFINE_TYPE_EXTENDED (PsppireCellRendererButton,
                         psppire_cell_renderer_button,
                         GTK_TYPE_CELL_RENDERER,
@@ -450,6 +452,7 @@ psppire_cell_renderer_button_class_init 
(PsppireCellRendererButtonClass *class)
 
   gobject_class->set_property = psppire_cell_renderer_button_set_property;
   gobject_class->get_property = psppire_cell_renderer_button_get_property;
+  gobject_class->finalize = psppire_cell_renderer_button_finalize;
 
   gtk_object_class->destroy = psppire_cell_renderer_button_destroy;
 
@@ -511,6 +514,14 @@ psppire_cell_renderer_button_init 
(PsppireCellRendererButton *obj)
 }
 
 static void
+psppire_cell_renderer_button_finalize (GObject *obj)
+{
+  PsppireCellRendererButton *button = PSPPIRE_CELL_RENDERER_BUTTON (obj);
+
+  g_free (button->label);
+}
+
+static void
 psppire_cell_renderer_button_destroy (GtkObject *obj)
 {
   PsppireCellRendererButton *button = PSPPIRE_CELL_RENDERER_BUTTON (obj);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]