xed-status-combo-box.c: Clean up some code styling
This commit is contained in:
parent
8ebb54b824
commit
b082e73a61
|
@ -117,9 +117,7 @@ xed_status_combo_box_destroy (GtkWidget *widget)
|
||||||
|
|
||||||
if (combo->priv->menu)
|
if (combo->priv->menu)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (combo->priv->menu,
|
g_signal_handlers_disconnect_by_func (combo->priv->menu, menu_deactivate, combo);
|
||||||
menu_deactivate,
|
|
||||||
combo);
|
|
||||||
gtk_menu_detach (GTK_MENU (combo->priv->menu));
|
gtk_menu_detach (GTK_MENU (combo->priv->menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,8 +230,7 @@ show_menu (XedStatusComboBox *combo,
|
||||||
gint max_height;
|
gint max_height;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (combo->priv->menu,
|
gtk_widget_get_preferred_size (combo->priv->menu, &request, NULL);
|
||||||
&request, NULL);
|
|
||||||
|
|
||||||
/* do something relative to our own height here, maybe we can do better */
|
/* do something relative to our own height here, maybe we can do better */
|
||||||
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
|
gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
|
||||||
|
@ -257,8 +254,7 @@ show_menu (XedStatusComboBox *combo,
|
||||||
|
|
||||||
if (combo->priv->current_item)
|
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);
|
||||||
combo->priv->current_item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,18 +350,12 @@ xed_status_combo_box_init (XedStatusComboBox *self)
|
||||||
gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0);
|
||||||
|
|
||||||
self->priv->menu = gtk_menu_new ();
|
self->priv->menu = gtk_menu_new ();
|
||||||
gtk_menu_attach_to_widget (GTK_MENU (self->priv->menu),
|
gtk_menu_attach_to_widget (GTK_MENU (self->priv->menu), GTK_WIDGET (self), menu_detached);
|
||||||
GTK_WIDGET (self),
|
|
||||||
menu_detached);
|
|
||||||
|
|
||||||
g_signal_connect (self->priv->button,
|
g_signal_connect (self->priv->button, "button-press-event",
|
||||||
"button-press-event",
|
G_CALLBACK (button_press_event), self);
|
||||||
G_CALLBACK (button_press_event),
|
g_signal_connect (self->priv->menu, "deactivate",
|
||||||
self);
|
G_CALLBACK (menu_deactivate), self);
|
||||||
g_signal_connect (self->priv->menu,
|
|
||||||
"deactivate",
|
|
||||||
G_CALLBACK (menu_deactivate),
|
|
||||||
self);
|
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (self->priv->button));
|
context = gtk_widget_get_style_context (GTK_WIDGET (self->priv->button));
|
||||||
gtk_style_context_add_provider (context,
|
gtk_style_context_add_provider (context,
|
||||||
|
@ -449,8 +439,7 @@ xed_status_combo_box_remove_item (XedStatusComboBox *combo,
|
||||||
g_return_if_fail (XED_IS_STATUS_COMBO_BOX (combo));
|
g_return_if_fail (XED_IS_STATUS_COMBO_BOX (combo));
|
||||||
g_return_if_fail (GTK_IS_MENU_ITEM (item));
|
g_return_if_fail (GTK_IS_MENU_ITEM (item));
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (combo->priv->menu),
|
gtk_container_remove (GTK_CONTAINER (combo->priv->menu), GTK_WIDGET (item));
|
||||||
GTK_WIDGET (item));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -496,10 +485,8 @@ xed_status_combo_box_set_item_text (XedStatusComboBox *combo,
|
||||||
g_return_if_fail (XED_IS_STATUS_COMBO_BOX (combo));
|
g_return_if_fail (XED_IS_STATUS_COMBO_BOX (combo));
|
||||||
g_return_if_fail (GTK_IS_MENU_ITEM (item));
|
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,
|
||||||
COMBO_BOX_TEXT_DATA,
|
g_strdup (text), (GDestroyNotify)g_free);
|
||||||
g_strdup (text),
|
|
||||||
(GDestroyNotify)g_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue