forked from AuroraMiddleware/gtk
Merge branch 'spinning-spinner' into 'master'
Rename GtkSpinner::active to ::spinning See merge request GNOME/gtk!1475
This commit is contained in:
commit
9d80db29de
@ -59,7 +59,7 @@ serialize_widget (GtkWidget *widget)
|
|||||||
}
|
}
|
||||||
else if (GTK_IS_SPINNER (widget))
|
else if (GTK_IS_SPINNER (widget))
|
||||||
{
|
{
|
||||||
g_object_get (widget, "active", &demo->active, NULL);
|
g_object_get (widget, "spinning", &demo->active, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ deserialize_widget (GtkDemoWidget *demo)
|
|||||||
}
|
}
|
||||||
else if (demo->type == GTK_TYPE_SPINNER)
|
else if (demo->type == GTK_TYPE_SPINNER)
|
||||||
{
|
{
|
||||||
widget = g_object_new (demo->type, "active", demo->active, NULL);
|
widget = g_object_new (demo->type, "spinning", demo->active, NULL);
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -240,8 +240,8 @@ edit_cb (GtkWidget *button, GtkWidget *child)
|
|||||||
{
|
{
|
||||||
gboolean active;
|
gboolean active;
|
||||||
|
|
||||||
g_object_get (child, "active", &active, NULL);
|
g_object_get (child, "spinning", &active, NULL);
|
||||||
g_object_set (child, "active", !active, NULL);
|
g_object_set (child, "spinning", !active, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button)
|
if (button)
|
||||||
|
@ -733,7 +733,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinner" id="spinner1">
|
<object class="GtkSpinner" id="spinner1">
|
||||||
<property name="active">1</property>
|
<property name="spinning">1</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">2</property>
|
<property name="left-attach">2</property>
|
||||||
</layout>
|
</layout>
|
||||||
@ -749,7 +749,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinner" id="spinner3">
|
<object class="GtkSpinner" id="spinner3">
|
||||||
<property name="active">1</property>
|
<property name="spinning">1</property>
|
||||||
<property name="sensitive">0</property>
|
<property name="sensitive">0</property>
|
||||||
<layout>
|
<layout>
|
||||||
<property name="left-attach">2</property>
|
<property name="left-attach">2</property>
|
||||||
|
@ -2505,6 +2505,8 @@ GtkSpinner
|
|||||||
gtk_spinner_new
|
gtk_spinner_new
|
||||||
gtk_spinner_start
|
gtk_spinner_start
|
||||||
gtk_spinner_stop
|
gtk_spinner_stop
|
||||||
|
gtk_spinner_set_spinning
|
||||||
|
gtk_spinner_get_spinning
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GTK_SPINNER
|
GTK_SPINNER
|
||||||
|
@ -2051,7 +2051,7 @@ listbox_header_func (GtkListBoxRow *row,
|
|||||||
g_object_bind_property (GTK_PLACES_VIEW (user_data),
|
g_object_bind_property (GTK_PLACES_VIEW (user_data),
|
||||||
"fetching-networks",
|
"fetching-networks",
|
||||||
network_header_spinner,
|
network_header_spinner,
|
||||||
"active",
|
"spinning",
|
||||||
G_BINDING_SYNC_CREATE);
|
G_BINDING_SYNC_CREATE);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (header_name), label);
|
gtk_container_add (GTK_CONTAINER (header_name), label);
|
||||||
|
@ -57,8 +57,9 @@
|
|||||||
*
|
*
|
||||||
* # CSS nodes
|
* # CSS nodes
|
||||||
*
|
*
|
||||||
* GtkSpinner has a single CSS node with the name spinner. When the animation is
|
* GtkSpinner has a single CSS node with the name spinner.
|
||||||
* active, the :checked pseudoclass is added to this node.
|
* When the animation is active, the :checked pseudoclass is
|
||||||
|
* added to this node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _GtkSpinnerClass GtkSpinnerClass;
|
typedef struct _GtkSpinnerClass GtkSpinnerClass;
|
||||||
@ -76,7 +77,7 @@ struct _GtkSpinnerClass
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_ACTIVE
|
PROP_SPINNING
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
|
G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
|
||||||
@ -138,25 +139,42 @@ gtk_spinner_css_changed (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
/**
|
||||||
gtk_spinner_get_active (GtkSpinner *spinner)
|
* gtk_spinner_get_spinning:
|
||||||
|
* @spinner: a #GtkSpinner
|
||||||
|
*
|
||||||
|
* Returns whether the spinner is spinning.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the spinner is active
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_spinner_get_spinning (GtkSpinner *spinner)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_SPINNER (spinner), FALSE);
|
||||||
|
|
||||||
return (gtk_widget_get_state_flags ((GtkWidget *)spinner) & GTK_STATE_FLAG_CHECKED) > 0;
|
return (gtk_widget_get_state_flags ((GtkWidget *)spinner) & GTK_STATE_FLAG_CHECKED) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/**
|
||||||
gtk_spinner_set_active (GtkSpinner *spinner,
|
* gtk_spinner_set_spinning:
|
||||||
gboolean active)
|
* @spinner: a #GtkSpinner
|
||||||
|
* @spinning: whether the spinner should be spinning
|
||||||
|
*
|
||||||
|
* Sets the activity of the spinner.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_spinner_set_spinning (GtkSpinner *spinner,
|
||||||
|
gboolean spinning)
|
||||||
{
|
{
|
||||||
gboolean current_active = gtk_spinner_get_active (spinner);
|
g_return_if_fail (GTK_IS_SPINNER (spinner));
|
||||||
|
|
||||||
active = !!active;
|
spinning = !!spinning;
|
||||||
|
|
||||||
if (active != current_active)
|
if (spinning != gtk_spinner_get_spinning (spinner))
|
||||||
{
|
{
|
||||||
g_object_notify (G_OBJECT (spinner), "active");
|
g_object_notify (G_OBJECT (spinner), "spinning");
|
||||||
|
|
||||||
if (active)
|
if (spinning)
|
||||||
gtk_widget_set_state_flags (GTK_WIDGET (spinner),
|
gtk_widget_set_state_flags (GTK_WIDGET (spinner),
|
||||||
GTK_STATE_FLAG_CHECKED, FALSE);
|
GTK_STATE_FLAG_CHECKED, FALSE);
|
||||||
else
|
else
|
||||||
@ -173,8 +191,8 @@ gtk_spinner_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
case PROP_ACTIVE:
|
case PROP_SPINNING:
|
||||||
g_value_set_boolean (value, gtk_spinner_get_active (GTK_SPINNER (object)));
|
g_value_set_boolean (value, gtk_spinner_get_spinning (GTK_SPINNER (object)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
@ -189,8 +207,8 @@ gtk_spinner_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
case PROP_ACTIVE:
|
case PROP_SPINNING:
|
||||||
gtk_spinner_set_active (GTK_SPINNER (object), g_value_get_boolean (value));
|
gtk_spinner_set_spinning (GTK_SPINNER (object), g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
@ -212,15 +230,15 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
|
|||||||
widget_class->measure = gtk_spinner_measure;
|
widget_class->measure = gtk_spinner_measure;
|
||||||
widget_class->css_changed = gtk_spinner_css_changed;
|
widget_class->css_changed = gtk_spinner_css_changed;
|
||||||
|
|
||||||
/* GtkSpinner:active:
|
/* GtkSpinner:spinning:
|
||||||
*
|
*
|
||||||
* Whether the spinner is active
|
* Whether the spinner is spinning
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_ACTIVE,
|
PROP_SPINNING,
|
||||||
g_param_spec_boolean ("active",
|
g_param_spec_boolean ("spinning",
|
||||||
P_("Active"),
|
P_("Spinning"),
|
||||||
P_("Whether the spinner is active"),
|
P_("Whether the spinner is spinning"),
|
||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||||
|
|
||||||
@ -257,7 +275,7 @@ gtk_spinner_start (GtkSpinner *spinner)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_SPINNER (spinner));
|
g_return_if_fail (GTK_IS_SPINNER (spinner));
|
||||||
|
|
||||||
gtk_spinner_set_active (spinner, TRUE);
|
gtk_spinner_set_spinning (spinner, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,5 +289,5 @@ gtk_spinner_stop (GtkSpinner *spinner)
|
|||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_SPINNER (spinner));
|
g_return_if_fail (GTK_IS_SPINNER (spinner));
|
||||||
|
|
||||||
gtk_spinner_set_active (spinner, FALSE);
|
gtk_spinner_set_spinning (spinner, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,18 @@ typedef struct _GtkSpinner GtkSpinner;
|
|||||||
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GType gtk_spinner_get_type (void) G_GNUC_CONST;
|
GType gtk_spinner_get_type (void) G_GNUC_CONST;
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
GtkWidget *gtk_spinner_new (void);
|
GtkWidget *gtk_spinner_new (void);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_spinner_start (GtkSpinner *spinner);
|
void gtk_spinner_start (GtkSpinner *spinner);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_spinner_stop (GtkSpinner *spinner);
|
void gtk_spinner_stop (GtkSpinner *spinner);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_spinner_set_spinning (GtkSpinner *spinner,
|
||||||
|
gboolean spinning);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_spinner_get_spinning (GtkSpinner *spinner);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinner" id="busy_spinner">
|
<object class="GtkSpinner" id="busy_spinner">
|
||||||
<property name="active">1</property>
|
<property name="spinning">1</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="margin-start">4px</property>
|
<property name="margin-start">4px</property>
|
||||||
|
@ -428,7 +428,7 @@ main (int argc, char *argv[])
|
|||||||
button = gtk_label_new ("Hidden here");
|
button = gtk_label_new ("Hidden here");
|
||||||
custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
||||||
gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom"));
|
gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom"));
|
||||||
gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "active", TRUE, NULL));
|
gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL));
|
||||||
g_object_ref_sink (custom);
|
g_object_ref_sink (custom);
|
||||||
g_object_set (button, "has-tooltip", TRUE, NULL);
|
g_object_set (button, "has-tooltip", TRUE, NULL);
|
||||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||||
@ -438,7 +438,7 @@ main (int argc, char *argv[])
|
|||||||
button = gtk_label_new ("Custom tooltip II");
|
button = gtk_label_new ("Custom tooltip II");
|
||||||
custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
custom = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
|
||||||
gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom too"));
|
gtk_container_add (GTK_CONTAINER (custom), gtk_label_new ("See, custom too"));
|
||||||
gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "active", TRUE, NULL));
|
gtk_container_add (GTK_CONTAINER (custom), g_object_new (GTK_TYPE_SPINNER, "spinning", TRUE, NULL));
|
||||||
g_object_ref_sink (custom);
|
g_object_ref_sink (custom);
|
||||||
g_object_set (button, "has-tooltip", TRUE, NULL);
|
g_object_set (button, "has-tooltip", TRUE, NULL);
|
||||||
g_signal_connect (button, "query-tooltip",
|
g_signal_connect (button, "query-tooltip",
|
||||||
|
Loading…
Reference in New Issue
Block a user