[Top][All Lists]
[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);
- Re: [PATCH 11/17] pspp-widget-facade: New code to measure and render some GTK+ widgets., (continued)
- [PATCH 12/17] pspp-sheet-view: Optimize by making column header widgets lazy., Ben Pfaff, 2012/04/22
- [PATCH 15/17] pspp-sheet-view: Add "fixed-height" and "fixed-height-set" properties., Ben Pfaff, 2012/04/22
- [PATCH 17/17] psppire-cell-renderer-button: Add "slash" property., Ben Pfaff, 2012/04/22
- [PATCH 16/17] psppire-cell-renderer-button: New cell renderer for GtkButton., Ben Pfaff, 2012/04/22
- [PATCH 02/17] pspp-sheet-view: Reduce time and memory cost to O(1) in number of rows., Ben Pfaff, 2012/04/22
- [PATCH 01/17] Import GtkTreeView from GTK+ 2.0-2.20.1 renamed as PsppSheetView., Ben Pfaff, 2012/04/22
- Re: [PATCH 00/17] Implement PsppSheetView, Ben Pfaff, 2012/04/24