X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-button-editable.c;h=f77e3ce21711263f8eff489e28dd756b6bae2986;hb=0cba607fab2e2b3bcad0aca96da27254cb260f50;hp=cefc7a594d92e2fe0f52c41324fab2281b192fca;hpb=f95002ec226b18f52773e747cae7e1d00302ad1a;p=pspp diff --git a/src/ui/gui/psppire-button-editable.c b/src/ui/gui/psppire-button-editable.c index cefc7a594d..f77e3ce217 100644 --- a/src/ui/gui/psppire-button-editable.c +++ b/src/ui/gui/psppire-button-editable.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2011, 2012 Free Software Foundation, Inc. + Copyright (C) 2011, 2012, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include #define _(msgid) gettext (msgid) #define N_(msgid) msgid +#define P_(STRING) STRING /* GtkCellEditable interface. */ static void gtk_cell_editable_interface_init (GtkCellEditableIface *iface); @@ -40,7 +41,8 @@ G_DEFINE_TYPE_EXTENDED (PsppireButtonEditable, enum { PROP_0, - PROP_PATH + PROP_PATH, + PROP_EDITING_CANCELED }; static void @@ -58,6 +60,9 @@ psppire_button_editable_set_property (GObject *object, obj->path = g_value_dup_string (value); break; + case PROP_EDITING_CANCELED: + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -78,6 +83,10 @@ psppire_button_editable_get_property (GObject *object, g_value_set_string (value, obj->path); break; + case PROP_EDITING_CANCELED: + g_value_set_boolean (value, FALSE); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -85,26 +94,22 @@ psppire_button_editable_get_property (GObject *object, } static void -psppire_button_editable_dispose (GObject *gobject) +psppire_button_editable_finalize (GObject *gobject) { PsppireButtonEditable *obj = PSPPIRE_BUTTON_EDITABLE (gobject); g_free (obj->path); - obj->path = NULL; - G_OBJECT_CLASS (psppire_button_editable_parent_class)->dispose (gobject); + G_OBJECT_CLASS (psppire_button_editable_parent_class)->finalize (gobject); } static gboolean psppire_button_editable_button_release (GtkWidget *widget, GdkEventButton *event) { - GtkButton *button; - if (event->button == 1) { - button = GTK_BUTTON (widget); - gtk_button_released (button); + g_signal_emit_by_name (widget, "released", event, NULL); } return TRUE; @@ -121,17 +126,21 @@ psppire_button_editable_class_init (PsppireButtonEditableClass *class) gobject_class->set_property = psppire_button_editable_set_property; gobject_class->get_property = psppire_button_editable_get_property; - gobject_class->dispose = psppire_button_editable_dispose; + gobject_class->finalize = psppire_button_editable_finalize; widget_class->button_release_event = psppire_button_editable_button_release; - g_object_class_install_property (G_OBJECT_CLASS (class), + g_object_class_install_property (gobject_class, PROP_PATH, g_param_spec_string ("path", - _("TreeView path"), - _("The path to the row in the GtkTreeView, as a string"), + P_("TreeView path"), + P_("The path to the row in the GtkTreeView, as a string"), "", G_PARAM_READWRITE)); + + g_object_class_override_property (gobject_class, + PROP_EDITING_CANCELED, + "editing-canceled"); } static void @@ -145,6 +154,7 @@ psppire_button_editable_new (void) { return PSPPIRE_BUTTON_EDITABLE (g_object_new (PSPPIRE_TYPE_BUTTON_EDITABLE, NULL)); } + /* GtkCellEditable interface. */ @@ -161,15 +171,11 @@ gtk_cell_editable_interface_init (GtkCellEditableIface *iface) static void button_editable_editing_done (GtkCellEditable *cell_editable) { - - } static void button_editable_remove_widget (GtkCellEditable *cell_editable) { - - } static void