summaryrefslogtreecommitdiff
path: root/pluma/pluma-status-combo-box.c
diff options
context:
space:
mode:
Diffstat (limited to 'pluma/pluma-status-combo-box.c')
-rw-r--r--pluma/pluma-status-combo-box.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c
index d5c8eaec..70c800f6 100644
--- a/pluma/pluma-status-combo-box.c
+++ b/pluma/pluma-status-combo-box.c
@@ -34,7 +34,7 @@ struct _PlumaStatusComboBoxPrivate
GtkWidget *label;
GtkWidget *item;
GtkWidget *arrow;
-
+
GtkWidget *menu;
GtkWidget *current_item;
};
@@ -47,10 +47,10 @@ enum
};
/* Properties */
-enum
+enum
{
PROP_0,
-
+
PROP_LABEL
};
@@ -134,7 +134,7 @@ pluma_status_combo_box_changed (PlumaStatusComboBox *combo,
GtkMenuItem *item)
{
const gchar *text;
-
+
text = g_object_get_data (G_OBJECT (item), COMBO_BOX_TEXT_DATA);
if (text != NULL)
@@ -148,12 +148,12 @@ static void
pluma_status_combo_box_class_init (PlumaStatusComboBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
object_class->finalize = pluma_status_combo_box_finalize;
object_class->get_property = pluma_status_combo_box_get_property;
object_class->set_property = pluma_status_combo_box_set_property;
object_class->constructed = pluma_status_combo_box_constructed;
-
+
klass->changed = pluma_status_combo_box_changed;
signals[CHANGED] =
@@ -164,7 +164,7 @@ pluma_status_combo_box_class_init (PlumaStatusComboBoxClass *klass)
changed), NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GTK_TYPE_MENU_ITEM);
-
+
g_object_class_install_property (object_class, PROP_LABEL,
g_param_spec_string ("label",
"LABEL",
@@ -196,13 +196,13 @@ button_press_event (GtkWidget *widget,
/* do something relative to our own height here, maybe we can do better */
max_height = allocation.height * 20;
-
+
if (request.height > max_height)
{
gtk_widget_set_size_request (combo->priv->menu, -1, max_height);
gtk_widget_set_size_request (gtk_widget_get_toplevel (combo->priv->menu), -1, max_height);
}
-
+
gtk_menu_popup_at_widget (GTK_MENU (combo->priv->menu),
gtk_widget_get_parent (widget),
GDK_GRAVITY_NORTH_WEST,
@@ -213,7 +213,7 @@ button_press_event (GtkWidget *widget,
if (combo->priv->current_item)
{
- gtk_menu_shell_select_item (GTK_MENU_SHELL (combo->priv->menu),
+ gtk_menu_shell_select_item (GTK_MENU_SHELL (combo->priv->menu),
combo->priv->current_item);
}
}
@@ -239,12 +239,12 @@ static void
pluma_status_combo_box_init (PlumaStatusComboBox *self)
{
self->priv = PLUMA_STATUS_COMBO_BOX_GET_PRIVATE (self);
-
+
gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), TRUE);
self->priv->frame = gtk_frame_new (NULL);
gtk_widget_show (self->priv->frame);
-
+
self->priv->button = gtk_toggle_button_new ();
gtk_widget_set_name (self->priv->button, "pluma-status-combo-button");
gtk_button_set_relief (GTK_BUTTON (self->priv->button), GTK_RELIEF_NONE);
@@ -254,40 +254,40 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self)
self->priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_widget_show (self->priv->hbox);
-
+
gtk_container_add (GTK_CONTAINER (self), self->priv->frame);
gtk_container_add (GTK_CONTAINER (self->priv->frame), self->priv->button);
gtk_container_add (GTK_CONTAINER (self->priv->button), self->priv->hbox);
-
+
self->priv->label = gtk_label_new ("");
gtk_widget_show (self->priv->label);
-
+
gtk_label_set_single_line_mode (GTK_LABEL (self->priv->label), TRUE);
gtk_label_set_xalign (GTK_LABEL (self->priv->label), 0.0);
-
+
gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->label, FALSE, TRUE, 0);
-
+
self->priv->item = gtk_label_new ("");
gtk_widget_show (self->priv->item);
-
+
gtk_label_set_single_line_mode (GTK_LABEL (self->priv->item), TRUE);
gtk_widget_set_halign (self->priv->item, GTK_ALIGN_START);
-
+
gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->item, TRUE, TRUE, 0);
self->priv->arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (self->priv->arrow);
gtk_widget_set_halign (self->priv->arrow, GTK_ALIGN_CENTER);
gtk_widget_set_valign (self->priv->arrow, GTK_ALIGN_CENTER);
-
+
gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0);
-
+
self->priv->menu = gtk_menu_new ();
g_object_ref_sink (self->priv->menu);
- g_signal_connect (self->priv->button,
- "button-press-event",
- G_CALLBACK (button_press_event),
+ g_signal_connect (self->priv->button,
+ "button-press-event",
+ G_CALLBACK (button_press_event),
self);
g_signal_connect (self->priv->menu,
"deactivate",
@@ -313,13 +313,13 @@ pluma_status_combo_box_new (const gchar *label)
* @label: (allow-none):
*/
void
-pluma_status_combo_box_set_label (PlumaStatusComboBox *combo,
+pluma_status_combo_box_set_label (PlumaStatusComboBox *combo,
const gchar *label)
{
gchar *text;
g_return_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo));
-
+
text = g_strconcat (" ", label, ": ", NULL);
gtk_label_set_markup (GTK_LABEL (combo->priv->label), text);
g_free (text);
@@ -355,7 +355,7 @@ pluma_status_combo_box_add_item (PlumaStatusComboBox *combo,
g_return_if_fail (GTK_IS_MENU_ITEM (item));
gtk_menu_shell_append (GTK_MENU_SHELL (combo->priv->menu), GTK_WIDGET (item));
-
+
pluma_status_combo_box_set_item_text (combo, item, text);
g_signal_connect (item, "activate", G_CALLBACK (item_activated), combo);
}
@@ -390,12 +390,12 @@ pluma_status_combo_box_get_item_text (PlumaStatusComboBox *combo,
GtkMenuItem *item)
{
const gchar *ret = NULL;
-
+
g_return_val_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo), NULL);
g_return_val_if_fail (GTK_IS_MENU_ITEM (item), NULL);
-
+
ret = g_object_get_data (G_OBJECT (item), COMBO_BOX_TEXT_DATA);
-
+
return ret;
}
@@ -405,7 +405,7 @@ pluma_status_combo_box_get_item_text (PlumaStatusComboBox *combo,
* @item:
* @text: (allow-none):
*/
-void
+void
pluma_status_combo_box_set_item_text (PlumaStatusComboBox *combo,
GtkMenuItem *item,
const gchar *text)
@@ -413,7 +413,7 @@ pluma_status_combo_box_set_item_text (PlumaStatusComboBox *combo,
g_return_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo));
g_return_if_fail (GTK_IS_MENU_ITEM (item));
- g_object_set_data_full (G_OBJECT (item),
+ g_object_set_data_full (G_OBJECT (item),
COMBO_BOX_TEXT_DATA,
g_strdup (text),
(GDestroyNotify)g_free);
@@ -433,7 +433,7 @@ GtkLabel *
pluma_status_combo_box_get_item_label (PlumaStatusComboBox *combo)
{
g_return_val_if_fail (PLUMA_IS_STATUS_COMBO_BOX (combo), NULL);
-
+
return GTK_LABEL (combo->priv->item);
}