menubutton: Drop relief

We are only using this as a boolean, so change it
to a boolean property named has-frame.
This commit is contained in:
Matthias Clasen 2020-04-17 00:31:50 -04:00
parent df1816a29c
commit 12d5fdd457
8 changed files with 45 additions and 54 deletions

View File

@ -161,7 +161,7 @@
<object class="GtkMenuButton" id="more-button">
<property name="receives-default">1</property>
<property name="menu-model">menu1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="label" translatable="yes">More...</property>
</object>
</child>

View File

@ -2639,7 +2639,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -2783,7 +2783,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -3275,7 +3275,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>

View File

@ -1710,8 +1710,8 @@ gtk_menu_button_set_icon_name
gtk_menu_button_get_icon_name
gtk_menu_button_set_label
gtk_menu_button_get_label
gtk_menu_button_set_relief
gtk_menu_button_get_relief
gtk_menu_button_set_has_frame
gtk_menu_button_get_has_frame
gtk_menu_button_popup
gtk_menu_button_popdown
GtkMenuButtonCreatePopupFunc

View File

@ -166,7 +166,7 @@ enum
PROP_ICON_NAME,
PROP_LABEL,
PROP_USE_UNDERLINE,
PROP_RELIEF,
PROP_HAS_FRAME,
LAST_PROP
};
@ -207,8 +207,8 @@ gtk_menu_button_set_property (GObject *object,
case PROP_USE_UNDERLINE:
gtk_menu_button_set_use_underline (self, g_value_get_boolean (value));
break;
case PROP_RELIEF:
gtk_menu_button_set_relief (self, g_value_get_enum (value));
case PROP_HAS_FRAME:
gtk_menu_button_set_has_frame (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -246,8 +246,8 @@ gtk_menu_button_get_property (GObject *object,
case PROP_USE_UNDERLINE:
g_value_set_boolean (value, gtk_menu_button_get_use_underline (GTK_MENU_BUTTON (object)));
break;
case PROP_RELIEF:
g_value_set_enum (value, gtk_menu_button_get_relief (GTK_MENU_BUTTON (object)));
case PROP_HAS_FRAME:
g_value_set_boolean (value, gtk_menu_button_get_has_frame (GTK_MENU_BUTTON (object)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -431,12 +431,11 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
menu_button_props[PROP_RELIEF] =
g_param_spec_enum ("relief",
P_("Border relief"),
P_("The border relief style"),
GTK_TYPE_RELIEF_STYLE,
GTK_RELIEF_NORMAL,
menu_button_props[PROP_HAS_FRAME] =
g_param_spec_boolean ("has-frame",
P_("Has frame"),
P_("Whether the button has a frame"),
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (gobject_class, LAST_PROP, menu_button_props);
@ -932,47 +931,39 @@ gtk_menu_button_get_label (GtkMenuButton *menu_button)
}
/**
* gtk_menu_button_set_relief:
* @menu_button: The #GtkMenuButton you want to set relief styles of
* @relief: The GtkReliefStyle as described above
* gtk_menu_button_set_has_frame:
* @menu_button: a #GtkMenuButton
* @has_frame: whether the button should have a visible frame
*
* Sets the relief style of the edges of the given
* #GtkMenuButton widget.
*
* Two styles exist, %GTK_RELIEF_NORMAL and %GTK_RELIEF_NONE.
* The default style is, as one can guess, %GTK_RELIEF_NORMAL.
* Sets the style of the button.
*/
void
gtk_menu_button_set_relief (GtkMenuButton *menu_button,
GtkReliefStyle relief)
gtk_menu_button_set_has_frame (GtkMenuButton *menu_button,
gboolean has_frame)
{
gboolean has_frame;
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
has_frame = relief == GTK_RELIEF_NORMAL;
if (gtk_button_get_has_frame (GTK_BUTTON (menu_button->button)) == has_frame)
return;
gtk_button_set_has_frame (GTK_BUTTON (menu_button->button), has_frame);
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_RELIEF]);
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_HAS_FRAME]);
}
/**
* gtk_menu_button_get_relief:
* @menu_button: The #GtkMenuButton you want the #GtkReliefStyle from.
* gtk_menu_button_get_has_frame:
* @menu_button: a #GtkMenuButton
*
* Returns the current relief style of the given #GtkMenuButton.
* Returns whether the button has a frame.
*
* Returns: The current #GtkReliefStyle
* Returns: %TRUE if the button has a frame
*/
GtkReliefStyle
gtk_menu_button_get_relief (GtkMenuButton *menu_button)
gboolean
gtk_menu_button_get_has_frame (GtkMenuButton *menu_button)
{
g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), GTK_RELIEF_NORMAL);
g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), TRUE);
return gtk_button_get_has_frame (GTK_BUTTON (menu_button->button))
? GTK_RELIEF_NORMAL : GTK_RELIEF_NONE;
return gtk_button_get_has_frame (GTK_BUTTON (menu_button->button));
}
/**

View File

@ -96,10 +96,10 @@ GDK_AVAILABLE_IN_ALL
gboolean gtk_menu_button_get_use_underline (GtkMenuButton *menu_button);
GDK_AVAILABLE_IN_ALL
void gtk_menu_button_set_relief (GtkMenuButton *menu_button,
GtkReliefStyle relief);
void gtk_menu_button_set_has_frame (GtkMenuButton *menu_button,
gboolean has_frame);
GDK_AVAILABLE_IN_ALL
GtkReliefStyle gtk_menu_button_get_relief (GtkMenuButton *menu_button);
gboolean gtk_menu_button_get_has_frame (GtkMenuButton *menu_button);
GDK_AVAILABLE_IN_ALL
void gtk_menu_button_popup (GtkMenuButton *menu_button);

View File

@ -2633,7 +2633,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -2774,7 +2774,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -3266,7 +3266,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>

View File

@ -867,7 +867,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="label" translatable="yes">link button</property>
<property name="receives-default">1</property>
<property name="has-tooltip">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="uri">http://www.gtk.org</property>
</object>
</child>
@ -2634,7 +2634,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -2775,7 +2775,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -3267,7 +3267,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>

View File

@ -2634,7 +2634,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -2775,7 +2775,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@ -3267,7 +3267,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>