forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2835
This commit is contained in:
commit
da9d32e472
@ -284,12 +284,14 @@ create_ucd_view (GtkWidget *label)
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_codepoint), NULL);
|
||||
column = gtk_column_view_column_new ("Codepoint", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_centered_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_char), NULL);
|
||||
column = gtk_column_view_column_new ("Char", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@ -297,6 +299,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Name", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@ -304,6 +307,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@ -311,6 +315,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Break Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@ -318,6 +323,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Combining Class", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@ -325,6 +331,7 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Script", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
@ -179,6 +179,7 @@ struct _GtkModelButton
|
||||
guint active : 1;
|
||||
guint centered : 1;
|
||||
guint iconic : 1;
|
||||
guint keep_open : 1;
|
||||
};
|
||||
|
||||
typedef struct _GtkModelButtonClass GtkModelButtonClass;
|
||||
@ -1044,7 +1045,7 @@ gtk_model_button_clicked (GtkModelButton *self)
|
||||
gtk_popover_menu_set_open_submenu (menu, submenu);
|
||||
gtk_popover_menu_set_parent_menu (GTK_POPOVER_MENU (submenu), GTK_WIDGET (menu));
|
||||
}
|
||||
else if (self->role == GTK_BUTTON_ROLE_NORMAL)
|
||||
else if (!self->keep_open)
|
||||
{
|
||||
GtkWidget *popover;
|
||||
|
||||
@ -1057,6 +1058,20 @@ gtk_model_button_clicked (GtkModelButton *self)
|
||||
gtk_action_helper_activate (self->action_helper);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
toggle_cb (GtkWidget *widget,
|
||||
GVariant *args,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkModelButton *self = GTK_MODEL_BUTTON (widget);
|
||||
|
||||
self->keep_open = self->role != GTK_BUTTON_ROLE_NORMAL;
|
||||
g_signal_emit (widget, signals[SIGNAL_CLICKED], 0);
|
||||
self->keep_open = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_model_button_finalize (GObject *object)
|
||||
{
|
||||
@ -1128,6 +1143,14 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GtkShortcutAction *action;
|
||||
guint activate_keyvals[] = {
|
||||
GDK_KEY_Return, GDK_KEY_ISO_Enter, GDK_KEY_KP_Enter
|
||||
};
|
||||
guint toggle_keyvals[] = {
|
||||
GDK_KEY_space, GDK_KEY_KP_Space
|
||||
};
|
||||
int i;
|
||||
|
||||
object_class->dispose = gtk_model_button_dispose;
|
||||
object_class->finalize = gtk_model_button_finalize;
|
||||
@ -1277,6 +1300,30 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, I_("modelbutton"));
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM);
|
||||
|
||||
action = gtk_signal_action_new ("clicked");
|
||||
for (i = 0; i < G_N_ELEMENTS (activate_keyvals); i++)
|
||||
{
|
||||
GtkShortcut *shortcut;
|
||||
|
||||
shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (activate_keyvals[i], 0),
|
||||
g_object_ref (action));
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
g_object_unref (shortcut);
|
||||
}
|
||||
g_object_unref (action);
|
||||
|
||||
action = gtk_callback_action_new (toggle_cb, NULL, NULL);
|
||||
for (i = 0; i < G_N_ELEMENTS (toggle_keyvals); i++)
|
||||
{
|
||||
GtkShortcut *shortcut;
|
||||
|
||||
shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (toggle_keyvals[i], 0),
|
||||
g_object_ref (action));
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
g_object_unref (shortcut);
|
||||
}
|
||||
g_object_unref (action);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user