xed-tab-label.c/h: Clean up code styling
This commit is contained in:
parent
422dc034f4
commit
66800ca9a3
|
@ -34,27 +34,27 @@
|
||||||
/* Signals */
|
/* Signals */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CLOSE_CLICKED,
|
CLOSE_CLICKED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_TAB
|
PROP_TAB
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _XedTabLabelPrivate
|
struct _XedTabLabelPrivate
|
||||||
{
|
{
|
||||||
XedTab *tab;
|
XedTab *tab;
|
||||||
|
|
||||||
GtkWidget *ebox;
|
GtkWidget *ebox;
|
||||||
GtkWidget *close_button;
|
GtkWidget *close_button;
|
||||||
GtkWidget *spinner;
|
GtkWidget *spinner;
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
|
||||||
gboolean close_button_sensitive;
|
gboolean close_button_sensitive;
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -64,114 +64,119 @@ G_DEFINE_TYPE (XedTabLabel, xed_tab_label, GTK_TYPE_BOX)
|
||||||
static void
|
static void
|
||||||
xed_tab_label_finalize (GObject *object)
|
xed_tab_label_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
G_OBJECT_CLASS (xed_tab_label_parent_class)->finalize (object);
|
G_OBJECT_CLASS (xed_tab_label_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xed_tab_label_set_property (GObject *object,
|
xed_tab_label_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_TAB:
|
case PROP_TAB:
|
||||||
tab_label->priv->tab = XED_TAB (g_value_get_object (value));
|
tab_label->priv->tab = XED_TAB (g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xed_tab_label_get_property (GObject *object,
|
xed_tab_label_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_TAB:
|
case PROP_TAB:
|
||||||
g_value_set_object (value, tab_label->priv->tab);
|
g_value_set_object (value, tab_label->priv->tab);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
close_button_clicked_cb (GtkWidget *widget,
|
close_button_clicked_cb (GtkWidget *widget,
|
||||||
XedTabLabel *tab_label)
|
XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL);
|
g_signal_emit (tab_label, signals[CLOSE_CLICKED], 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_tip (XedTab *tab, XedTabLabel *tab_label)
|
sync_tip (XedTab *tab,
|
||||||
|
XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
str = _xed_tab_get_tooltips (tab);
|
str = _xed_tab_get_tooltips (tab);
|
||||||
g_return_if_fail (str != NULL);
|
g_return_if_fail (str != NULL);
|
||||||
|
|
||||||
gtk_widget_set_tooltip_markup (tab_label->priv->ebox, str);
|
gtk_widget_set_tooltip_markup (tab_label->priv->ebox, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_name (XedTab *tab, GParamSpec *pspec, XedTabLabel *tab_label)
|
sync_name (XedTab *tab,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
g_return_if_fail (tab == tab_label->priv->tab);
|
g_return_if_fail (tab == tab_label->priv->tab);
|
||||||
|
|
||||||
str = _xed_tab_get_name (tab);
|
str = _xed_tab_get_name (tab);
|
||||||
g_return_if_fail (str != NULL);
|
g_return_if_fail (str != NULL);
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (tab_label->priv->label), str);
|
gtk_label_set_text (GTK_LABEL (tab_label->priv->label), str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
sync_tip (tab, tab_label);
|
sync_tip (tab, tab_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_state (XedTab *tab, GParamSpec *pspec, XedTabLabel *tab_label)
|
sync_state (XedTab *tab,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
XedTabState state;
|
XedTabState state;
|
||||||
|
|
||||||
g_return_if_fail (tab == tab_label->priv->tab);
|
g_return_if_fail (tab == tab_label->priv->tab);
|
||||||
|
|
||||||
state = xed_tab_get_state (tab);
|
state = xed_tab_get_state (tab);
|
||||||
|
|
||||||
gtk_widget_set_sensitive (tab_label->priv->close_button,
|
gtk_widget_set_sensitive (tab_label->priv->close_button,
|
||||||
tab_label->priv->close_button_sensitive &&
|
tab_label->priv->close_button_sensitive &&
|
||||||
(state != XED_TAB_STATE_CLOSING) &&
|
(state != XED_TAB_STATE_CLOSING) &&
|
||||||
(state != XED_TAB_STATE_SAVING) &&
|
(state != XED_TAB_STATE_SAVING) &&
|
||||||
(state != XED_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
|
(state != XED_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
|
||||||
(state != XED_TAB_STATE_SAVING_ERROR));
|
(state != XED_TAB_STATE_SAVING_ERROR));
|
||||||
|
|
||||||
if ((state == XED_TAB_STATE_LOADING) ||
|
if ((state == XED_TAB_STATE_LOADING) ||
|
||||||
(state == XED_TAB_STATE_SAVING) ||
|
(state == XED_TAB_STATE_SAVING) ||
|
||||||
(state == XED_TAB_STATE_REVERTING))
|
(state == XED_TAB_STATE_REVERTING))
|
||||||
{
|
{
|
||||||
gtk_widget_hide (tab_label->priv->icon);
|
gtk_widget_hide (tab_label->priv->icon);
|
||||||
|
|
||||||
gtk_widget_show (tab_label->priv->spinner);
|
gtk_widget_show (tab_label->priv->spinner);
|
||||||
gtk_spinner_start (GTK_SPINNER (tab_label->priv->spinner));
|
gtk_spinner_start (GTK_SPINNER (tab_label->priv->spinner));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
pixbuf = _xed_tab_get_icon (tab);
|
pixbuf = _xed_tab_get_icon (tab);
|
||||||
|
|
||||||
if (pixbuf != NULL)
|
if (pixbuf != NULL)
|
||||||
{
|
{
|
||||||
|
@ -184,183 +189,176 @@ sync_state (XedTab *tab, GParamSpec *pspec, XedTabLabel *tab_label)
|
||||||
gtk_widget_hide (tab_label->priv->icon);
|
gtk_widget_hide (tab_label->priv->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_hide (tab_label->priv->spinner);
|
gtk_widget_hide (tab_label->priv->spinner);
|
||||||
gtk_spinner_stop (GTK_SPINNER (tab_label->priv->spinner));
|
gtk_spinner_stop (GTK_SPINNER (tab_label->priv->spinner));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sync tip since encoding is known only after load/save end */
|
/* sync tip since encoding is known only after load/save end */
|
||||||
sync_tip (tab, tab_label);
|
sync_tip (tab, tab_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xed_tab_label_constructed (GObject *object)
|
xed_tab_label_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
XedTabLabel *tab_label = XED_TAB_LABEL (object);
|
||||||
|
|
||||||
if (!tab_label->priv->tab)
|
if (!tab_label->priv->tab)
|
||||||
{
|
{
|
||||||
g_critical ("The tab label was not properly constructed");
|
g_critical ("The tab label was not properly constructed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_name (tab_label->priv->tab, NULL, tab_label);
|
sync_name (tab_label->priv->tab, NULL, tab_label);
|
||||||
sync_state (tab_label->priv->tab, NULL, tab_label);
|
sync_state (tab_label->priv->tab, NULL, tab_label);
|
||||||
|
|
||||||
g_signal_connect_object (tab_label->priv->tab,
|
g_signal_connect_object (tab_label->priv->tab, "notify::name",
|
||||||
"notify::name",
|
G_CALLBACK (sync_name), tab_label, 0);
|
||||||
G_CALLBACK (sync_name),
|
|
||||||
tab_label,
|
|
||||||
0);
|
|
||||||
|
|
||||||
g_signal_connect_object (tab_label->priv->tab,
|
g_signal_connect_object (tab_label->priv->tab, "notify::state",
|
||||||
"notify::state",
|
G_CALLBACK (sync_state), tab_label, 0);
|
||||||
G_CALLBACK (sync_state),
|
|
||||||
tab_label,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xed_tab_label_class_init (XedTabLabelClass *klass)
|
xed_tab_label_class_init (XedTabLabelClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = xed_tab_label_finalize;
|
object_class->finalize = xed_tab_label_finalize;
|
||||||
object_class->set_property = xed_tab_label_set_property;
|
object_class->set_property = xed_tab_label_set_property;
|
||||||
object_class->get_property = xed_tab_label_get_property;
|
object_class->get_property = xed_tab_label_get_property;
|
||||||
object_class->constructed = xed_tab_label_constructed;
|
object_class->constructed = xed_tab_label_constructed;
|
||||||
|
|
||||||
signals[CLOSE_CLICKED] =
|
signals[CLOSE_CLICKED] =
|
||||||
g_signal_new ("close-clicked",
|
g_signal_new ("close-clicked",
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (XedTabLabelClass, close_clicked),
|
G_STRUCT_OFFSET (XedTabLabelClass, close_clicked),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_TAB,
|
PROP_TAB,
|
||||||
g_param_spec_object ("tab",
|
g_param_spec_object ("tab",
|
||||||
"Tab",
|
"Tab",
|
||||||
"The XedTab",
|
"The XedTab",
|
||||||
XED_TYPE_TAB,
|
XED_TYPE_TAB,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof(XedTabLabelPrivate));
|
g_type_class_add_private (object_class, sizeof(XedTabLabelPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xed_tab_label_init (XedTabLabel *tab_label)
|
xed_tab_label_init (XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
GtkWidget *ebox;
|
GtkWidget *ebox;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *close_button;
|
GtkWidget *close_button;
|
||||||
GtkWidget *spinner;
|
GtkWidget *spinner;
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *dummy_label;
|
GtkWidget *dummy_label;
|
||||||
|
|
||||||
tab_label->priv = XED_TAB_LABEL_GET_PRIVATE (tab_label);
|
tab_label->priv = XED_TAB_LABEL_GET_PRIVATE (tab_label);
|
||||||
|
|
||||||
tab_label->priv->close_button_sensitive = TRUE;
|
tab_label->priv->close_button_sensitive = TRUE;
|
||||||
|
|
||||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (tab_label),
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (tab_label), GTK_ORIENTATION_HORIZONTAL);
|
||||||
GTK_ORIENTATION_HORIZONTAL);
|
ebox = gtk_event_box_new ();
|
||||||
ebox = gtk_event_box_new ();
|
gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
|
||||||
gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
|
gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (tab_label), ebox, TRUE, TRUE, 0);
|
tab_label->priv->ebox = ebox;
|
||||||
tab_label->priv->ebox = ebox;
|
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||||
gtk_container_add (GTK_CONTAINER (ebox), hbox);
|
gtk_container_add (GTK_CONTAINER (ebox), hbox);
|
||||||
|
|
||||||
close_button = xed_close_button_new ();
|
close_button = xed_close_button_new ();
|
||||||
gtk_widget_set_tooltip_text (close_button, _("Close document"));
|
gtk_widget_set_tooltip_text (close_button, _("Close document"));
|
||||||
gtk_box_pack_start (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (tab_label), close_button, FALSE, FALSE, 0);
|
||||||
tab_label->priv->close_button = close_button;
|
tab_label->priv->close_button = close_button;
|
||||||
|
|
||||||
g_signal_connect (close_button,
|
g_signal_connect (close_button, "clicked",
|
||||||
"clicked",
|
G_CALLBACK (close_button_clicked_cb), tab_label);
|
||||||
G_CALLBACK (close_button_clicked_cb),
|
|
||||||
tab_label);
|
|
||||||
|
|
||||||
spinner = gtk_spinner_new ();
|
spinner = gtk_spinner_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
|
||||||
tab_label->priv->spinner = spinner;
|
tab_label->priv->spinner = spinner;
|
||||||
|
|
||||||
/* setup icon, empty by default */
|
/* setup icon, empty by default */
|
||||||
icon = gtk_image_new ();
|
icon = gtk_image_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
|
||||||
tab_label->priv->icon = icon;
|
tab_label->priv->icon = icon;
|
||||||
|
|
||||||
label = gtk_label_new ("");
|
label = gtk_label_new ("");
|
||||||
|
|
||||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||||
gtk_widget_set_margin_left (label, 0);
|
gtk_widget_set_margin_left (label, 0);
|
||||||
gtk_widget_set_margin_right (label, 0);
|
gtk_widget_set_margin_right (label, 0);
|
||||||
gtk_widget_set_margin_top (label, 0);
|
gtk_widget_set_margin_top (label, 0);
|
||||||
gtk_widget_set_margin_bottom (label, 0);
|
gtk_widget_set_margin_bottom (label, 0);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
tab_label->priv->label = label;
|
tab_label->priv->label = label;
|
||||||
|
|
||||||
dummy_label = gtk_label_new ("");
|
dummy_label = gtk_label_new ("");
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), dummy_label, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), dummy_label, TRUE, TRUE, 0);
|
||||||
|
|
||||||
gtk_widget_show (ebox);
|
gtk_widget_show (ebox);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
gtk_widget_show (close_button);
|
gtk_widget_show (close_button);
|
||||||
gtk_widget_show (icon);
|
gtk_widget_show (icon);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_widget_show (dummy_label);
|
gtk_widget_show (dummy_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xed_tab_label_set_close_button_sensitive (XedTabLabel *tab_label,
|
xed_tab_label_set_close_button_sensitive (XedTabLabel *tab_label,
|
||||||
gboolean sensitive)
|
gboolean sensitive)
|
||||||
{
|
{
|
||||||
XedTabState state;
|
XedTabState state;
|
||||||
|
|
||||||
g_return_if_fail (XED_IS_TAB_LABEL (tab_label));
|
g_return_if_fail (XED_IS_TAB_LABEL (tab_label));
|
||||||
|
|
||||||
sensitive = (sensitive != FALSE);
|
sensitive = (sensitive != FALSE);
|
||||||
|
|
||||||
if (sensitive == tab_label->priv->close_button_sensitive)
|
if (sensitive == tab_label->priv->close_button_sensitive)
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tab_label->priv->close_button_sensitive = sensitive;
|
tab_label->priv->close_button_sensitive = sensitive;
|
||||||
|
|
||||||
state = xed_tab_get_state (tab_label->priv->tab);
|
state = xed_tab_get_state (tab_label->priv->tab);
|
||||||
|
|
||||||
gtk_widget_set_sensitive (tab_label->priv->close_button,
|
gtk_widget_set_sensitive (tab_label->priv->close_button,
|
||||||
tab_label->priv->close_button_sensitive &&
|
tab_label->priv->close_button_sensitive &&
|
||||||
(state != XED_TAB_STATE_CLOSING) &&
|
(state != XED_TAB_STATE_CLOSING) &&
|
||||||
(state != XED_TAB_STATE_SAVING) &&
|
(state != XED_TAB_STATE_SAVING) &&
|
||||||
(state != XED_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
|
(state != XED_TAB_STATE_SHOWING_PRINT_PREVIEW) &&
|
||||||
(state != XED_TAB_STATE_PRINTING) &&
|
(state != XED_TAB_STATE_PRINTING) &&
|
||||||
(state != XED_TAB_STATE_PRINT_PREVIEWING) &&
|
(state != XED_TAB_STATE_PRINT_PREVIEWING) &&
|
||||||
(state != XED_TAB_STATE_SAVING_ERROR));
|
(state != XED_TAB_STATE_SAVING_ERROR));
|
||||||
}
|
}
|
||||||
|
|
||||||
XedTab *
|
XedTab *
|
||||||
xed_tab_label_get_tab (XedTabLabel *tab_label)
|
xed_tab_label_get_tab (XedTabLabel *tab_label)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (XED_IS_TAB_LABEL (tab_label), NULL);
|
g_return_val_if_fail (XED_IS_TAB_LABEL (tab_label), NULL);
|
||||||
|
|
||||||
return tab_label->priv->tab;
|
return tab_label->priv->tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
xed_tab_label_new (XedTab *tab)
|
xed_tab_label_new (XedTab *tab)
|
||||||
{
|
{
|
||||||
XedTabLabel *tab_label;
|
XedTabLabel *tab_label;
|
||||||
|
|
||||||
tab_label = g_object_new (XED_TYPE_TAB_LABEL,
|
tab_label = g_object_new (XED_TYPE_TAB_LABEL,
|
||||||
"homogeneous", FALSE,
|
"homogeneous", FALSE,
|
||||||
"tab", tab,
|
"tab", tab,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return GTK_WIDGET (tab_label);
|
return GTK_WIDGET (tab_label);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -28,38 +28,38 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define XED_TYPE_TAB_LABEL (xed_tab_label_get_type ())
|
#define XED_TYPE_TAB_LABEL (xed_tab_label_get_type ())
|
||||||
#define XED_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_TAB_LABEL, XedTabLabel))
|
#define XED_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_TAB_LABEL, XedTabLabel))
|
||||||
#define XED_TAB_LABEL_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_TAB_LABEL, XedTabLabel const))
|
#define XED_TAB_LABEL_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XED_TYPE_TAB_LABEL, XedTabLabel const))
|
||||||
#define XED_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_TAB_LABEL, XedTabLabelClass))
|
#define XED_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XED_TYPE_TAB_LABEL, XedTabLabelClass))
|
||||||
#define XED_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_TAB_LABEL))
|
#define XED_IS_TAB_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XED_TYPE_TAB_LABEL))
|
||||||
#define XED_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_TAB_LABEL))
|
#define XED_IS_TAB_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XED_TYPE_TAB_LABEL))
|
||||||
#define XED_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_TAB_LABEL, XedTabLabelClass))
|
#define XED_TAB_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XED_TYPE_TAB_LABEL, XedTabLabelClass))
|
||||||
|
|
||||||
typedef struct _XedTabLabel XedTabLabel;
|
typedef struct _XedTabLabel XedTabLabel;
|
||||||
typedef struct _XedTabLabelClass XedTabLabelClass;
|
typedef struct _XedTabLabelClass XedTabLabelClass;
|
||||||
typedef struct _XedTabLabelPrivate XedTabLabelPrivate;
|
typedef struct _XedTabLabelPrivate XedTabLabelPrivate;
|
||||||
|
|
||||||
struct _XedTabLabel {
|
struct _XedTabLabel {
|
||||||
GtkBox parent;
|
GtkBox parent;
|
||||||
|
|
||||||
XedTabLabelPrivate *priv;
|
XedTabLabelPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _XedTabLabelClass {
|
struct _XedTabLabelClass {
|
||||||
GtkBoxClass parent_class;
|
GtkBoxClass parent_class;
|
||||||
|
|
||||||
void (* close_clicked) (XedTabLabel *tab_label);
|
void (* close_clicked) (XedTabLabel *tab_label);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType xed_tab_label_get_type (void) G_GNUC_CONST;
|
GType xed_tab_label_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkWidget *xed_tab_label_new (XedTab *tab);
|
GtkWidget *xed_tab_label_new (XedTab *tab);
|
||||||
|
|
||||||
XedTab *xed_tab_label_get_tab (XedTabLabel *tab_label);
|
XedTab *xed_tab_label_get_tab (XedTabLabel *tab_label);
|
||||||
|
|
||||||
void xed_tab_label_set_close_button_sensitive (XedTabLabel *tab_label,
|
void xed_tab_label_set_close_button_sensitive (XedTabLabel *tab_label,
|
||||||
gboolean sensitive);
|
gboolean sensitive);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue