Commit 985b42b5 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Added new composite widget: GladePropertyLabel.

Now GladeEditorProperty creates a GladePropertyLabel on demand if
needed, instead of implementing the label itself.

This will allow custom property editors to use the property labels
in the interface defined with GtkBuilder script.
parent 7f205196
...@@ -51,7 +51,8 @@ BUILT_SOURCES = \ ...@@ -51,7 +51,8 @@ BUILT_SOURCES = \
gladeui-resources.h gladeui-resources.h
UI_FILES = \ UI_FILES = \
glade-project-properties.ui glade-project-properties.ui \
glade-property-label.ui
EXTRA_DIST = \ EXTRA_DIST = \
$(UI_FILES) \ $(UI_FILES) \
...@@ -72,6 +73,7 @@ libgladeui_2_la_SOURCES = \ ...@@ -72,6 +73,7 @@ libgladeui_2_la_SOURCES = \
glade-widget.c \ glade-widget.c \
glade-property-class.c \ glade-property-class.c \
glade-property.c \ glade-property.c \
glade-property-label.c \
glade-signal-class.c \ glade-signal-class.c \
glade-signal.c \ glade-signal.c \
glade-widget-action.c \ glade-widget-action.c \
...@@ -139,6 +141,7 @@ libgladeuiinclude_HEADERS = \ ...@@ -139,6 +141,7 @@ libgladeuiinclude_HEADERS = \
glade-widget-adaptor.h \ glade-widget-adaptor.h \
glade-property.h \ glade-property.h \
glade-property-class.h \ glade-property-class.h \
glade-property-label.h \
glade-utils.h \ glade-utils.h \
glade-clipboard.h \ glade-clipboard.h \
glade-command.h \ glade-command.h \
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "glade.h" #include "glade.h"
#include "glade-widget.h" #include "glade-widget.h"
#include "glade-editor-property.h" #include "glade-editor-property.h"
#include "glade-property-label.h"
#include "glade-property.h" #include "glade-property.h"
#include "glade-command.h" #include "glade-command.h"
#include "glade-project.h" #include "glade-project.h"
...@@ -79,9 +80,7 @@ struct _GladeEditorPropertyPrivate ...@@ -79,9 +80,7 @@ struct _GladeEditorPropertyPrivate
GladePropertyClass *klass; /* The property class this GladeEditorProperty was created for */ GladePropertyClass *klass; /* The property class this GladeEditorProperty was created for */
GladeProperty *property; /* The currently loaded property */ GladeProperty *property; /* The currently loaded property */
GtkWidget *item_label; /* The property name portion of the eprop */ GtkWidget *item_label; /* A GladePropertyLabel, if one was constructed */
GtkWidget *label; /* The actual property name label */
GtkWidget *warning; /* Icon to show warnings */
GtkWidget *input; /* Input part of property (need to set sensitivity seperately) */ GtkWidget *input; /* Input part of property (need to set sensitivity seperately) */
GtkWidget *check; /* Check button for optional properties. */ GtkWidget *check; /* Check button for optional properties. */
...@@ -89,7 +88,6 @@ struct _GladeEditorPropertyPrivate ...@@ -89,7 +88,6 @@ struct _GladeEditorPropertyPrivate
gulong sensitive_id; /* signal connection id for sensitivity changes */ gulong sensitive_id; /* signal connection id for sensitivity changes */
gulong changed_id; /* signal connection id for value changes */ gulong changed_id; /* signal connection id for value changes */
gulong enabled_id; /* signal connection id for enable/disable changes */ gulong enabled_id; /* signal connection id for enable/disable changes */
gulong state_id; /* signal connection id for state changes */
gboolean loading; /* True during glade_editor_property_load calls, this gboolean loading; /* True during glade_editor_property_load calls, this
* is used to avoid feedback from input widgets. * is used to avoid feedback from input widgets.
...@@ -159,6 +157,16 @@ glade_editor_property_get_item_label (GladeEditorProperty *eprop) ...@@ -159,6 +157,16 @@ glade_editor_property_get_item_label (GladeEditorProperty *eprop)
{ {
g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (eprop), NULL); g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (eprop), NULL);
if (!eprop->priv->item_label)
{
eprop->priv->item_label = glade_property_label_new();
g_object_ref_sink (eprop->priv->item_label);
if (eprop->priv->property)
glade_property_label_set_property (GLADE_PROPERTY_LABEL (eprop), eprop->priv->property);
}
return eprop->priv->item_label; return eprop->priv->item_label;
} }
...@@ -201,8 +209,6 @@ glade_editor_property_tooltip_cb (GladeProperty *property, ...@@ -201,8 +209,6 @@ glade_editor_property_tooltip_cb (GladeProperty *property,
choice_tooltip = insensitive; choice_tooltip = insensitive;
gtk_widget_set_tooltip_text (eprop->priv->input, choice_tooltip); gtk_widget_set_tooltip_text (eprop->priv->input, choice_tooltip);
gtk_widget_set_tooltip_text (eprop->priv->label, choice_tooltip);
gtk_widget_set_tooltip_text (eprop->priv->warning, support);
} }
static void static void
...@@ -219,9 +225,6 @@ glade_editor_property_sensitivity_cb (GladeProperty *property, ...@@ -219,9 +225,6 @@ glade_editor_property_sensitivity_cb (GladeProperty *property,
gtk_widget_set_sensitive (priv->input, gtk_widget_set_sensitive (priv->input,
sensitive && support_sensitive && property_enabled); sensitive && support_sensitive && property_enabled);
if (priv->item_label)
gtk_widget_set_sensitive (priv->item_label,
sensitive && support_sensitive && property_enabled);
if (priv->check) if (priv->check)
gtk_widget_set_sensitive (priv->check, sensitive && support_sensitive); gtk_widget_set_sensitive (priv->check, sensitive && support_sensitive);
} }
...@@ -236,40 +239,6 @@ glade_editor_property_value_changed_cb (GladeProperty *property, ...@@ -236,40 +239,6 @@ glade_editor_property_value_changed_cb (GladeProperty *property,
glade_editor_property_load (eprop, eprop->priv->property); glade_editor_property_load (eprop, eprop->priv->property);
} }
static void
glade_editor_property_fix_label (GladeEditorProperty *eprop)
{
gchar *text = NULL;
if (!eprop->priv->property)
return;
/* refresh label */
if ((glade_property_get_state (eprop->priv->property) & GLADE_STATE_CHANGED) != 0)
text = g_strdup_printf ("<b>%s:</b>", glade_property_class_get_name (eprop->priv->klass));
else
text = g_strdup_printf ("%s:", glade_property_class_get_name (eprop->priv->klass));
gtk_label_set_markup (GTK_LABEL (eprop->priv->label), text);
g_free (text);
/* refresh icon */
if ((glade_property_get_state (eprop->priv->property) & GLADE_STATE_UNSUPPORTED) != 0)
gtk_widget_show (eprop->priv->warning);
else
gtk_widget_hide (eprop->priv->warning);
/* check sensitivity */
glade_editor_property_sensitivity_cb (eprop->priv->property, NULL, eprop);
}
static void
glade_editor_property_state_cb (GladeProperty *property,
GParamSpec *pspec,
GladeEditorProperty *eprop)
{
glade_editor_property_fix_label (eprop);
}
static void static void
glade_editor_property_enabled_toggled_cb (GtkWidget *check, glade_editor_property_enabled_toggled_cb (GtkWidget *check,
GladeEditorProperty *eprop) GladeEditorProperty *eprop)
...@@ -324,7 +293,6 @@ glade_editor_property_constructor (GType type, ...@@ -324,7 +293,6 @@ glade_editor_property_constructor (GType type,
{ {
GObject *obj; GObject *obj;
GladeEditorProperty *eprop; GladeEditorProperty *eprop;
GtkWidget *hbox;
/* Invoke parent constructor (eprop->priv->klass should be resolved by this point) . */ /* Invoke parent constructor (eprop->priv->klass should be resolved by this point) . */
obj = G_OBJECT_CLASS (table_class)->constructor obj = G_OBJECT_CLASS (table_class)->constructor
...@@ -348,35 +316,6 @@ glade_editor_property_constructor (GType type, ...@@ -348,35 +316,6 @@ glade_editor_property_constructor (GType type,
eprop->priv->input = GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->create_input (eprop); eprop->priv->input = GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->create_input (eprop);
gtk_widget_show (eprop->priv->input); gtk_widget_show (eprop->priv->input);
/* Create the warning icon */
eprop->priv->warning = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_MENU);
gtk_widget_set_no_show_all (eprop->priv->warning, TRUE);
/* Create & setup label */
eprop->priv->item_label = gtk_event_box_new ();
eprop->priv->label = gtk_label_new (NULL);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (eprop->priv->item_label), FALSE);
g_object_ref_sink (eprop->priv->item_label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_label_set_line_wrap (GTK_LABEL (eprop->priv->label), TRUE);
gtk_label_set_width_chars (GTK_LABEL (eprop->priv->label), 10);
gtk_label_set_line_wrap_mode (GTK_LABEL (eprop->priv->label), PANGO_WRAP_WORD_CHAR);
gtk_misc_set_alignment (GTK_MISC (eprop->priv->label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), eprop->priv->label, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), eprop->priv->warning, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (eprop->priv->item_label), hbox);
gtk_widget_show_all (eprop->priv->item_label);
glade_editor_property_fix_label (eprop);
g_signal_connect (G_OBJECT (eprop->priv->item_label), "button-press-event",
G_CALLBACK (glade_editor_property_button_pressed), eprop);
g_signal_connect (G_OBJECT (eprop->priv->input), "button-press-event", g_signal_connect (G_OBJECT (eprop->priv->input), "button-press-event",
G_CALLBACK (glade_editor_property_button_pressed), eprop); G_CALLBACK (glade_editor_property_button_pressed), eprop);
...@@ -466,7 +405,6 @@ glade_eprop_property_finalized (GladeEditorProperty *eprop, ...@@ -466,7 +405,6 @@ glade_eprop_property_finalized (GladeEditorProperty *eprop,
eprop->priv->sensitive_id = 0; eprop->priv->sensitive_id = 0;
eprop->priv->changed_id = 0; eprop->priv->changed_id = 0;
eprop->priv->enabled_id = 0; eprop->priv->enabled_id = 0;
eprop->priv->state_id = 0;
eprop->priv->property = NULL; eprop->priv->property = NULL;
glade_editor_property_load (eprop, NULL); glade_editor_property_load (eprop, NULL);
...@@ -487,8 +425,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, ...@@ -487,8 +425,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop,
g_signal_handler_disconnect (eprop->priv->property, eprop->priv->sensitive_id); g_signal_handler_disconnect (eprop->priv->property, eprop->priv->sensitive_id);
if (eprop->priv->changed_id > 0) if (eprop->priv->changed_id > 0)
g_signal_handler_disconnect (eprop->priv->property, eprop->priv->changed_id); g_signal_handler_disconnect (eprop->priv->property, eprop->priv->changed_id);
if (eprop->priv->state_id > 0)
g_signal_handler_disconnect (eprop->priv->property, eprop->priv->state_id);
if (eprop->priv->enabled_id > 0) if (eprop->priv->enabled_id > 0)
g_signal_handler_disconnect (eprop->priv->property, eprop->priv->enabled_id); g_signal_handler_disconnect (eprop->priv->property, eprop->priv->enabled_id);
...@@ -496,7 +432,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, ...@@ -496,7 +432,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop,
eprop->priv->sensitive_id = 0; eprop->priv->sensitive_id = 0;
eprop->priv->changed_id = 0; eprop->priv->changed_id = 0;
eprop->priv->enabled_id = 0; eprop->priv->enabled_id = 0;
eprop->priv->state_id = 0;
eprop->priv->changed_blocked = FALSE; eprop->priv->changed_blocked = FALSE;
/* Unref it here */ /* Unref it here */
...@@ -542,11 +477,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, ...@@ -542,11 +477,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop,
"notify::enabled", "notify::enabled",
G_CALLBACK (glade_editor_property_enabled_cb), G_CALLBACK (glade_editor_property_enabled_cb),
eprop); eprop);
eprop->priv->state_id =
g_signal_connect (G_OBJECT (eprop->priv->property),
"notify::state",
G_CALLBACK (glade_editor_property_state_cb), eprop);
/* In query dialogs when the user hits cancel, /* In query dialogs when the user hits cancel,
* these babies go away (so better stay protected). * these babies go away (so better stay protected).
...@@ -568,10 +498,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, ...@@ -568,10 +498,6 @@ glade_editor_property_load_common (GladeEditorProperty *eprop,
/* Load initial sensitive state. /* Load initial sensitive state.
*/ */
glade_editor_property_sensitivity_cb (property, NULL, eprop); glade_editor_property_sensitivity_cb (property, NULL, eprop);
/* Load intial label state
*/
glade_editor_property_state_cb (property, NULL, eprop);
} }
} }
...@@ -3461,17 +3387,24 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop, ...@@ -3461,17 +3387,24 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop,
glade_editor_property_load (eprop, property); glade_editor_property_load (eprop, property);
if (eprop->priv->item_label)
glade_property_label_set_property (GLADE_PROPERTY_LABEL (eprop->priv->item_label), property);
if (property) if (property)
{ {
g_assert (eprop->priv->klass == glade_property_get_class (property)); g_assert (eprop->priv->klass == glade_property_get_class (property));
gtk_widget_show (GTK_WIDGET (eprop)); gtk_widget_show (GTK_WIDGET (eprop));
gtk_widget_show (GTK_WIDGET (eprop->priv->item_label));
if (eprop->priv->item_label)
gtk_widget_show (eprop->priv->item_label);
} }
else else
{ {
gtk_widget_hide (GTK_WIDGET (eprop)); gtk_widget_hide (GTK_WIDGET (eprop));
gtk_widget_hide (GTK_WIDGET (eprop->priv->item_label));
if (eprop->priv->item_label)
gtk_widget_hide (eprop->priv->item_label);
} }
} }
else else
......
/*
* Copyright (C) 2013 Tristan Van Berkom.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Tristan Van Berkom <tvb@gnome.org>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib/gi18n-lib.h>
#include "glade.h"
#include "glade-widget.h"
#include "glade-popup.h"
#include "glade-property-label.h"
/* GObjectClass */
static void glade_property_label_dispose (GObject *object);
static void glade_property_label_set_real_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void glade_property_label_get_real_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
/* GtkWidgetClass */
static gint glade_property_label_button_press (GtkWidget *widget,
GdkEventButton *event);
struct _GladePropertyLabelPrivate
{
GladeProperty *property;
GtkWidget *warning;
GtkWidget *label;
gulong tooltip_id; /* signal connection id for tooltip changes */
gulong state_id; /* signal connection id for state changes */
gulong sensitive_id; /* signal connection id for sensitivity changes */
gulong enabled_id; /* signal connection id for property enabled changes */
};
enum {
PROP_0,
PROP_PROPERTY
};
G_DEFINE_TYPE (GladePropertyLabel, glade_property_label, GTK_TYPE_EVENT_BOX);
static void
glade_property_label_init (GladePropertyLabel *label)
{
label->priv =
G_TYPE_INSTANCE_GET_PRIVATE (label,
GLADE_TYPE_PROPERTY_LABEL,
GladePropertyLabelPrivate);
gtk_widget_init_template (GTK_WIDGET (label));
}
static void
glade_property_label_class_init (GladePropertyLabelClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
gobject_class->dispose = glade_property_label_dispose;
gobject_class->set_property = glade_property_label_set_real_property;
gobject_class->get_property = glade_property_label_get_real_property;
widget_class->button_press_event = glade_property_label_button_press;
/* Install a property, this is actually just a proxy for the internal GtkEntry text */
g_object_class_install_property (gobject_class,
PROP_PROPERTY,
g_param_spec_string ("property",
_("Property"),
_("The GladeProperty to display a label for"),
NULL,
G_PARAM_READWRITE));
/* Bind to template */
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladeui/glade-property-label.ui");
gtk_widget_class_bind_child (widget_class, GladePropertyLabelPrivate, label);
gtk_widget_class_bind_child (widget_class, GladePropertyLabelPrivate, warning);
g_type_class_add_private (gobject_class, sizeof (GladePropertyLabelPrivate));
}
/***********************************************************
* GObjectClass *
***********************************************************/
static void
glade_property_label_dispose (GObject *object)
{
glade_property_label_set_property (GLADE_PROPERTY_LABEL (object), NULL);
G_OBJECT_CLASS (glade_property_label_parent_class)->dispose (object);
}
static void
glade_property_label_set_real_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GladePropertyLabel *label = GLADE_PROPERTY_LABEL (object);
switch (prop_id)
{
case PROP_PROPERTY:
glade_property_label_set_property (label, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
glade_property_label_get_real_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GladePropertyLabel *label = GLADE_PROPERTY_LABEL (object);
switch (prop_id)
{
case PROP_PROPERTY:
g_value_set_object (value, glade_property_label_get_property (label));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/***********************************************************
* GtkWidgetClass *
***********************************************************/
static gint
glade_property_label_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GladePropertyLabel *label = GLADE_PROPERTY_LABEL (widget);
GladePropertyLabelPrivate *priv = label->priv;
if (priv->property && glade_popup_is_popup_event (event))
{
glade_popup_property_pop (priv->property, event);
return TRUE;
}
return FALSE;
}
/***********************************************************
* Callbacks *
***********************************************************/
static void
glade_property_label_tooltip_cb (GladeProperty *property,
const gchar *tooltip,
const gchar *insensitive,
const gchar *support,
GladePropertyLabel *label)
{
GladePropertyLabelPrivate *priv = label->priv;
const gchar *choice_tooltip;
if (glade_property_get_sensitive (property))
choice_tooltip = tooltip;
else
choice_tooltip = insensitive;
gtk_widget_set_tooltip_text (priv->label, choice_tooltip);
gtk_widget_set_tooltip_text (priv->warning, support);
}
static void
glade_property_label_sensitivity_cb (GladeProperty *property,
GParamSpec *pspec,
GladePropertyLabel *label)
{
GladePropertyLabelPrivate *priv = label->priv;
gboolean sensitive;
sensitive = glade_property_get_enabled (property);
sensitive = sensitive && glade_property_get_sensitive (priv->property);
sensitive = sensitive && (glade_property_get_state (priv->property) & GLADE_STATE_SUPPORT_DISABLED) == 0;
gtk_widget_set_sensitive (GTK_WIDGET (label), sensitive);
}
static void
glade_property_label_state_cb (GladeProperty *property,
GParamSpec *pspec,
GladePropertyLabel *label)
{
GladePropertyLabelPrivate *priv = label->priv;
GladePropertyClass *pclass;
gchar *text = NULL;
if (!priv->property)
return;
pclass = glade_property_get_class (priv->property);
/* refresh label */
if ((glade_property_get_state (priv->property) & GLADE_STATE_CHANGED) != 0)
text = g_strdup_printf ("<b>%s:</b>", glade_property_class_get_name (pclass));
else
text = g_strdup_printf ("%s:", glade_property_class_get_name (pclass));
gtk_label_set_markup (GTK_LABEL (priv->label), text);
g_free (text);
/* refresh icon */
if ((glade_property_get_state (priv->property) & GLADE_STATE_UNSUPPORTED) != 0)
gtk_widget_show (priv->warning);
else
gtk_widget_hide (priv->warning);
}
static void
glade_property_label_property_finalized (GladePropertyLabel *label,
GladeProperty *where_property_was)
{
/* Silent disconnect */
label->priv->property = NULL;
label->priv->tooltip_id = 0;
label->priv->state_id = 0;
label->priv->sensitive_id = 0;
label->priv->enabled_id = 0;
}
/***********************************************************
* API *
***********************************************************/
GtkWidget *
glade_property_label_new (void)
{
return g_object_new (GLADE_TYPE_PROPERTY_LABEL, NULL);
}
void
glade_property_label_set_property (GladePropertyLabel *label,
GladeProperty *property)
{
GladePropertyLabelPrivate *priv;
g_return_if_fail (GLADE_IS_PROPERTY_LABEL (label));
g_return_if_fail (property == NULL || GLADE_IS_PROPERTY (property));
priv = label->priv;
if (priv->property != property)
{
/* Disconnect last */
if (priv->property)
{
if (priv->tooltip_id > 0)
g_signal_handler_disconnect (priv->property, priv->tooltip_id);
if (priv->state_id > 0)
g_signal_handler_disconnect (priv->property, priv->state_id);
if (priv->sensitive_id > 0)
g_signal_handler_disconnect (priv->property, priv->sensitive_id);
if (priv->enabled_id > 0)
g_signal_handler_disconnect (priv->property, priv->enabled_id);
priv->tooltip_id = 0;
priv->state_id = 0;
priv->sensitive_id = 0;
priv->enabled_id = 0;
g_object_weak_unref (G_OBJECT (priv->property),
(GWeakNotify) glade_property_label_property_finalized, label);
}
priv->property = property;
/* Connect new */
if (priv->property)
{
GladePropertyClass *pclass = glade_property_get_class (priv->property);
priv->tooltip_id =
g_signal_connect (G_OBJECT (priv->property),
"tooltip-changed",
G_CALLBACK (glade_property_label_tooltip_cb),
label);
priv->sensitive_id =
g_signal_connect (G_OBJECT (priv->property),
"notify::sensitive",
G_CALLBACK (glade_property_label_sensitivity_cb),
label);
priv->state_id =
g_signal_connect (G_OBJECT (priv->property),
"notify::state",
G_CALLBACK (glade_property_label_state_cb), label);
priv->enabled_id =
g_signal_connect (G_OBJECT (priv->property),
"notify::enabled",
G_CALLBACK (glade_property_label_sensitivity_cb),
label);
g_object_weak_ref (G_OBJECT (priv->property),
(GWeakNotify) glade_property_label_property_finalized, label);
/* Load initial tooltips
*/
glade_property_label_tooltip_cb
(property, glade_property_class_get_tooltip (pclass),
glade_propert_get_insensitive_tooltip (property),
glade_property_get_support_warning (property), label);
/* Load initial sensitive state.
*/
glade_property_label_sensitivity_cb (property, NULL, label);
/* Load intial label state
*/
glade_property_label_state_cb (property, NULL, label);
}
g_object_notify (G_OBJECT (label), "property");
}
}
GladeProperty *
glade_property_label_get_property (GladePropertyLabel *label)
{
g_return_val_if_fail (GLADE_IS_PROPERTY_LABEL (label), NULL);
return label->priv->property;
}
/*
* Copyright (C) 2013 Tristan Van Berkom.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Tristan Van Berkom <tvb@gnome.org>
*/
#ifndef __GLADE_PROPERTY_LABEL_H__
#define __GLADE_PROPERTY_LABEL_H__
#include <gtk/gtk.h>
#include <gladeui/glade-xml-utils.h>
#include <gladeui/glade-property-class.h>
#include <gladeui/glade-property.h>
G_BEGIN_DECLS
#define GLADE_TYPE_PROPERTY_LABEL (glade_property_label_get_type ())
#define GLADE_PROPERTY_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_PROPERTY_LABEL, GladePropertyLabel))
#define GLADE_PROPERTY_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_PROPERTY_LABEL, GladePropertyLabelClass))
#define GLADE_IS_PROPERTY_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROPERTY_LABEL))
#define GLADE_IS_PROPERTY_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROPERTY_LABEL))
#define GLADE_PROPERTY_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PROPERTY_LABEL, GladePropertyLabelClass))
typedef struct _GladePropertyLabel GladePropertyLabel;
typedef struct _GladePropertyLabelClass GladePropertyLabelClass;
typedef struct _GladePropertyLabelPrivate GladePropertyLabelPrivate;
struct _GladePropertyLabel
{
/*< private >*/
GtkEventBox box;
GladePropertyLabelPrivate *priv;
};
struct _GladePropertyLabelClass
{
GtkEventBoxClass parent_class;
};
GType glade_property_label_get_type (void) G_GNUC_CONST;