forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master Closes #2489 See merge request GNOME/gtk!1578
This commit is contained in:
commit
858997d172
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="resizable">0</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
@ -17,31 +18,33 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_a</property>
|
||||
<property name="label">Color</property>
|
||||
<property name="label">_Color</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_b</property>
|
||||
<property name="label">Flavors</property>
|
||||
<property name="label">_Flavors</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="popover">thing_c</property>
|
||||
<property name="label">Tools</property>
|
||||
<property name="label">_Tools</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_a">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
@ -68,14 +71,12 @@
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_b">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.chocolate</property>
|
||||
@ -101,14 +102,12 @@
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="thing_c">
|
||||
<style>
|
||||
<class name="menu"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Hammer</property>
|
||||
|
@ -56,23 +56,25 @@ do_overlay (GtkWidget *do_widget)
|
||||
}
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_can_target (vbox, FALSE);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_START);
|
||||
|
||||
label = gtk_label_new ("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_widget_set_can_target (label, FALSE);
|
||||
gtk_widget_set_margin_top (label, 8);
|
||||
gtk_widget_set_margin_bottom (label, 50);
|
||||
gtk_widget_set_margin_bottom (label, 8);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
|
||||
gtk_widget_set_margin_top (entry, 50);
|
||||
gtk_widget_set_margin_top (entry, 8);
|
||||
gtk_widget_set_margin_bottom (entry, 8);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
||||
|
||||
|
@ -28,7 +28,7 @@ fancy_shape_renderer (cairo_t *cr,
|
||||
(double) attr->ink_rect.width / PANGO_SCALE,
|
||||
(double) attr->ink_rect.height / PANGO_SCALE);
|
||||
|
||||
if (GPOINTER_TO_UINT (attr->data) == 0x2664) /* U+2665 BLACK HEART SUIT */
|
||||
if (GPOINTER_TO_UINT (attr->data) == 0x2665) /* U+2665 BLACK HEART SUIT */
|
||||
{
|
||||
cairo_move_to (cr, .5, .0);
|
||||
cairo_line_to (cr, .9, -.4);
|
||||
|
@ -61,7 +61,10 @@ do_shortcut_triggers (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
list = gtk_list_box_new ();
|
||||
g_object_set (list, "margin", 6, NULL);
|
||||
gtk_widget_set_margin_top (list, 6);
|
||||
gtk_widget_set_margin_bottom (list, 6);
|
||||
gtk_widget_set_margin_start (list, 6);
|
||||
gtk_widget_set_margin_end (list, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), list);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
|
||||
|
@ -257,7 +257,6 @@ add_move_binding (GtkShortcutController *controller,
|
||||
gtk_callback_action_new (puzzle_key_pressed, NULL, NULL),
|
||||
"(ii)", dx, dy);
|
||||
gtk_shortcut_controller_add_shortcut (controller, shortcut);
|
||||
g_object_unref (shortcut);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -53,7 +53,7 @@
|
||||
<object class="GtkSpinner">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">1</property>
|
||||
<property name="spinning">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
@ -153,6 +153,7 @@ struct _GtkMenuButtonPrivate
|
||||
gpointer create_popup_user_data;
|
||||
GDestroyNotify create_popup_destroy_notify;
|
||||
|
||||
GtkWidget *label_widget;
|
||||
GtkWidget *align_widget;
|
||||
GtkWidget *arrow_widget;
|
||||
GtkArrowType arrow_type;
|
||||
@ -167,6 +168,7 @@ enum
|
||||
PROP_POPOVER,
|
||||
PROP_ICON_NAME,
|
||||
PROP_LABEL,
|
||||
PROP_USE_UNDERLINE,
|
||||
PROP_RELIEF,
|
||||
LAST_PROP
|
||||
};
|
||||
@ -205,6 +207,9 @@ gtk_menu_button_set_property (GObject *object,
|
||||
case PROP_LABEL:
|
||||
gtk_menu_button_set_label (self, g_value_get_string (value));
|
||||
break;
|
||||
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));
|
||||
break;
|
||||
@ -241,6 +246,9 @@ gtk_menu_button_get_property (GObject *object,
|
||||
case PROP_LABEL:
|
||||
g_value_set_string (value, gtk_menu_button_get_label (GTK_MENU_BUTTON (object)));
|
||||
break;
|
||||
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)));
|
||||
break;
|
||||
@ -415,6 +423,13 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
menu_button_props[PROP_USE_UNDERLINE] =
|
||||
g_param_spec_boolean ("use-underline",
|
||||
P_("Use underline"),
|
||||
P_("If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
menu_button_props[PROP_RELIEF] =
|
||||
g_param_spec_enum ("relief",
|
||||
P_("Border relief"),
|
||||
@ -896,6 +911,8 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
|
||||
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
||||
GtkWidget *child;
|
||||
GtkWidget *box;
|
||||
GtkWidget *label_widget;
|
||||
GtkWidget *image;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||
|
||||
@ -904,9 +921,17 @@ gtk_menu_button_set_label (GtkMenuButton *menu_button,
|
||||
gtk_container_remove (GTK_CONTAINER (priv->button), child);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_label_new (label));
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("pan-down-symbolic"));
|
||||
label_widget = gtk_label_new (label);
|
||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||
gtk_label_set_xalign (GTK_LABEL (label_widget), 0);
|
||||
gtk_label_set_use_underline (GTK_LABEL (label_widget),
|
||||
gtk_button_get_use_underline (GTK_BUTTON (priv->button)));
|
||||
gtk_widget_set_hexpand (label_widget, TRUE);
|
||||
image = gtk_image_new_from_icon_name ("pan-down-symbolic");
|
||||
gtk_container_add (GTK_CONTAINER (box), label_widget);
|
||||
gtk_container_add (GTK_CONTAINER (box), image);
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), box);
|
||||
priv->label_widget = label_widget;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_LABEL]);
|
||||
}
|
||||
@ -1067,3 +1092,31 @@ gtk_menu_button_set_create_popup_func (GtkMenuButton *menu_button
|
||||
|
||||
update_sensitivity (menu_button);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_menu_button_set_use_underline (GtkMenuButton *menu_button,
|
||||
gboolean use_underline)
|
||||
{
|
||||
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||
|
||||
if (gtk_button_get_use_underline (GTK_BUTTON (priv->button)) == use_underline)
|
||||
return;
|
||||
|
||||
gtk_button_set_use_underline (GTK_BUTTON (priv->button), use_underline);
|
||||
if (priv->label_widget)
|
||||
gtk_label_set_use_underline (GTK_LABEL (priv->label_widget), use_underline);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_USE_UNDERLINE]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_menu_button_get_use_underline (GtkMenuButton *menu_button)
|
||||
{
|
||||
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), FALSE);
|
||||
|
||||
return gtk_button_get_use_underline (GTK_BUTTON (priv->button));
|
||||
}
|
||||
|
@ -89,6 +89,12 @@ void gtk_menu_button_set_label (GtkMenuButton *menu_button,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const char * gtk_menu_button_get_label (GtkMenuButton *menu_button);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_menu_button_set_use_underline (GtkMenuButton *menu_button,
|
||||
gboolean use_underline);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user