Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adrien Plazas
libhandy
Commits
3d11bfbd
Commit
3d11bfbd
authored
Jan 23, 2020
by
Adrien Plazas
Browse files
Rename HdyPaginator into HdyCarousel
Fixes
Librem5/libhandy#161
.
parent
d48ef455
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
debian/libhandy-1-0.symbols
View file @
3d11bfbd
...
...
@@ -30,6 +30,30 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
hdy_carousel_box_set_position@LIBHANDY_1_0 0.9.90
hdy_carousel_box_set_spacing@LIBHANDY_1_0 0.9.90
hdy_carousel_box_stop_animation@LIBHANDY_1_0 0.9.90
hdy_carousel_get_allow_mouse_drag@LIBHANDY_1_0 0.9.90
hdy_carousel_get_animation_duration@LIBHANDY_1_0 0.9.90
hdy_carousel_get_center_content@LIBHANDY_1_0 0.9.90
hdy_carousel_get_indicator_spacing@LIBHANDY_1_0 0.9.90
hdy_carousel_get_indicator_style@LIBHANDY_1_0 0.9.90
hdy_carousel_get_interactive@LIBHANDY_1_0 0.9.90
hdy_carousel_get_n_pages@LIBHANDY_1_0 0.9.90
hdy_carousel_get_position@LIBHANDY_1_0 0.9.90
hdy_carousel_get_spacing@LIBHANDY_1_0 0.9.90
hdy_carousel_get_type@LIBHANDY_1_0 0.9.90
hdy_carousel_indicator_style_get_type@LIBHANDY_1_0 0.9.90
hdy_carousel_insert@LIBHANDY_1_0 0.9.90
hdy_carousel_new@LIBHANDY_1_0 0.9.90
hdy_carousel_prepend@LIBHANDY_1_0 0.9.90
hdy_carousel_reorder@LIBHANDY_1_0 0.9.90
hdy_carousel_scroll_to@LIBHANDY_1_0 0.9.90
hdy_carousel_scroll_to_full@LIBHANDY_1_0 0.9.90
hdy_carousel_set_allow_mouse_drag@LIBHANDY_1_0 0.9.90
hdy_carousel_set_animation_duration@LIBHANDY_1_0 0.9.90
hdy_carousel_set_center_content@LIBHANDY_1_0 0.9.90
hdy_carousel_set_indicator_spacing@LIBHANDY_1_0 0.9.90
hdy_carousel_set_indicator_style@LIBHANDY_1_0 0.9.90
hdy_carousel_set_interactive@LIBHANDY_1_0 0.9.90
hdy_carousel_set_spacing@LIBHANDY_1_0 0.9.90
hdy_centering_policy_get_type@LIBHANDY_1_0 0.0.10
hdy_column_get_linear_growth_width@LIBHANDY_1_0 0.0.3
hdy_column_get_maximum_width@LIBHANDY_1_0 0.0.1
...
...
@@ -138,30 +162,6 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
hdy_leaflet_transition_type_get_type@LIBHANDY_1_0 0.0.12
hdy_lerp@LIBHANDY_1_0 0.0.11
hdy_list_box_separator_header@LIBHANDY_1_0 0.0.6
hdy_paginator_get_allow_mouse_drag@LIBHANDY_1_0 0.0.12
hdy_paginator_get_animation_duration@LIBHANDY_1_0 0.0.11
hdy_paginator_get_center_content@LIBHANDY_1_0 0.0.11
hdy_paginator_get_indicator_spacing@LIBHANDY_1_0 0.0.11
hdy_paginator_get_indicator_style@LIBHANDY_1_0 0.0.11
hdy_paginator_get_interactive@LIBHANDY_1_0 0.0.11
hdy_paginator_get_n_pages@LIBHANDY_1_0 0.0.11
hdy_paginator_get_position@LIBHANDY_1_0 0.0.11
hdy_paginator_get_spacing@LIBHANDY_1_0 0.0.11
hdy_paginator_get_type@LIBHANDY_1_0 0.0.11
hdy_paginator_indicator_style_get_type@LIBHANDY_1_0 0.0.11
hdy_paginator_insert@LIBHANDY_1_0 0.0.11
hdy_paginator_new@LIBHANDY_1_0 0.0.11
hdy_paginator_prepend@LIBHANDY_1_0 0.0.11
hdy_paginator_reorder@LIBHANDY_1_0 0.0.11
hdy_paginator_scroll_to@LIBHANDY_1_0 0.0.11
hdy_paginator_scroll_to_full@LIBHANDY_1_0 0.0.11
hdy_paginator_set_allow_mouse_drag@LIBHANDY_1_0 0.0.12
hdy_paginator_set_animation_duration@LIBHANDY_1_0 0.0.11
hdy_paginator_set_center_content@LIBHANDY_1_0 0.0.11
hdy_paginator_set_indicator_spacing@LIBHANDY_1_0 0.0.11
hdy_paginator_set_indicator_style@LIBHANDY_1_0 0.0.11
hdy_paginator_set_interactive@LIBHANDY_1_0 0.0.11
hdy_paginator_set_spacing@LIBHANDY_1_0 0.0.11
hdy_preferences_group_add_preferences_to_model@LIBHANDY_1_0 0.0.10
hdy_preferences_group_get_description@LIBHANDY_1_0 0.0.10
hdy_preferences_group_get_title@LIBHANDY_1_0 0.0.10
...
...
doc/handy-docs.xml
View file @
3d11bfbd
...
...
@@ -37,6 +37,7 @@
<title>
Widgets and Objects
</title>
<xi:include
href=
"xml/hdy-action-row.xml"
/>
<xi:include
href=
"xml/hdy-animation.xml"
/>
<xi:include
href=
"xml/hdy-carousel.xml"
/>
<xi:include
href=
"xml/hdy-column.xml"
/>
<xi:include
href=
"xml/hdy-combo-row.xml"
/>
<xi:include
href=
"xml/hdy-dialog.xml"
/>
...
...
@@ -46,7 +47,6 @@
<xi:include
href=
"xml/hdy-header-group.xml"
/>
<xi:include
href=
"xml/hdy-keypad.xml"
/>
<xi:include
href=
"xml/hdy-leaflet.xml"
/>
<xi:include
href=
"xml/hdy-paginator.xml"
/>
<xi:include
href=
"xml/hdy-preferences-group.xml"
/>
<xi:include
href=
"xml/hdy-preferences-page.xml"
/>
<xi:include
href=
"xml/hdy-preferences-row.xml"
/>
...
...
examples/hdy-demo-window.c
View file @
3d11bfbd
...
...
@@ -26,10 +26,10 @@ struct _HdyDemoWindow
HdyComboRow
*
combo_row
;
HdyComboRow
*
enum_combo_row
;
HdyHeaderGroup
*
header_group
;
Hdy
Paginator
*
paginator
;
GtkListBox
*
paginator
_listbox
;
HdyComboRow
*
paginator
_orientation_row
;
HdyComboRow
*
paginator
_indicator_style_row
;
Hdy
Carousel
*
carousel
;
GtkListBox
*
carousel
_listbox
;
HdyComboRow
*
carousel
_orientation_row
;
HdyComboRow
*
carousel
_indicator_style_row
;
};
G_DEFINE_TYPE
(
HdyDemoWindow
,
hdy_demo_window
,
GTK_TYPE_APPLICATION_WINDOW
)
...
...
@@ -96,12 +96,12 @@ hdy_demo_window_notify_fold_cb (GObject *sender,
static
void
update_leaflet_swipe
(
HdyDemoWindow
*
self
)
{
gboolean
first_page
=
(
hdy_
paginator
_get_position
(
self
->
paginator
)
<=
0
);
gboolean
paginator
_visible
=
(
gtk_stack_get_visible_child
(
self
->
stack
)
==
GTK_WIDGET
(
self
->
paginator
));
gboolean
first_page
=
(
hdy_
carousel
_get_position
(
self
->
carousel
)
<=
0
);
gboolean
carousel
_visible
=
(
gtk_stack_get_visible_child
(
self
->
stack
)
==
GTK_WIDGET
(
self
->
carousel
));
hdy_leaflet_set_can_swipe_back
(
self
->
content_box
,
!
paginator
_visible
||
first_page
);
!
carousel
_visible
||
first_page
);
}
static
void
...
...
@@ -249,8 +249,8 @@ view_switcher_demo_clicked_cb (GtkButton *btn,
}
static
gchar
*
paginator
_orientation_name
(
HdyEnumValueObject
*
value
,
gpointer
user_data
)
carousel
_orientation_name
(
HdyEnumValueObject
*
value
,
gpointer
user_data
)
{
g_return_val_if_fail
(
HDY_IS_ENUM_VALUE_OBJECT
(
value
),
NULL
);
...
...
@@ -265,17 +265,17 @@ paginator_orientation_name (HdyEnumValueObject *value,
}
static
void
notify_
paginator
_position_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
notify_
carousel
_position_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
{
update_leaflet_swipe
(
self
);
}
static
void
notify_
paginator
_orientation_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
notify_
carousel
_orientation_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
{
HdyComboRow
*
row
=
HDY_COMBO_ROW
(
sender
);
gboolean
horizontal
;
...
...
@@ -284,7 +284,7 @@ notify_paginator_orientation_cb (GObject *sender,
g_assert
(
HDY_IS_DEMO_WINDOW
(
self
));
horizontal
=
(
hdy_combo_row_get_selected_index
(
row
)
==
GTK_ORIENTATION_HORIZONTAL
);
g_object_set
(
self
->
paginator
,
g_object_set
(
self
->
carousel
,
"orientation"
,
hdy_combo_row_get_selected_index
(
row
),
"margin-top"
,
horizontal
?
6
:
0
,
"margin-bottom"
,
horizontal
?
6
:
0
,
...
...
@@ -294,17 +294,17 @@ notify_paginator_orientation_cb (GObject *sender,
}
static
gchar
*
paginator
_indicator_style_name
(
HdyEnumValueObject
*
value
,
gpointer
user_data
)
carousel
_indicator_style_name
(
HdyEnumValueObject
*
value
,
gpointer
user_data
)
{
g_return_val_if_fail
(
HDY_IS_ENUM_VALUE_OBJECT
(
value
),
NULL
);
switch
(
hdy_enum_value_object_get_value
(
value
))
{
case
HDY_
PAGINATOR
_INDICATOR_STYLE_NONE
:
case
HDY_
CAROUSEL
_INDICATOR_STYLE_NONE
:
return
g_strdup
(
_
(
"None"
));
case
HDY_
PAGINATOR
_INDICATOR_STYLE_DOTS
:
case
HDY_
CAROUSEL
_INDICATOR_STYLE_DOTS
:
return
g_strdup
(
_
(
"Dots"
));
case
HDY_
PAGINATOR
_INDICATOR_STYLE_LINES
:
case
HDY_
CAROUSEL
_INDICATOR_STYLE_LINES
:
return
g_strdup
(
_
(
"Lines"
));
default:
return
NULL
;
...
...
@@ -312,26 +312,26 @@ paginator_indicator_style_name (HdyEnumValueObject *value,
}
static
void
notify_
paginator
_indicator_style_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
notify_
carousel
_indicator_style_cb
(
GObject
*
sender
,
GParamSpec
*
pspec
,
HdyDemoWindow
*
self
)
{
HdyComboRow
*
row
=
HDY_COMBO_ROW
(
sender
);
g_assert
(
HDY_IS_COMBO_ROW
(
row
));
g_assert
(
HDY_IS_DEMO_WINDOW
(
self
));
hdy_
paginator
_set_indicator_style
(
self
->
paginator
,
hdy_combo_row_get_selected_index
(
row
));
hdy_
carousel
_set_indicator_style
(
self
->
carousel
,
hdy_combo_row_get_selected_index
(
row
));
}
static
void
paginator
_return_clicked_cb
(
GtkButton
*
btn
,
HdyDemoWindow
*
self
)
carousel
_return_clicked_cb
(
GtkButton
*
btn
,
HdyDemoWindow
*
self
)
{
g_autoptr
(
GList
)
children
;
children
=
gtk_container_get_children
(
GTK_CONTAINER
(
self
->
paginator
));
hdy_
paginator
_scroll_to
(
self
->
paginator
,
GTK_WIDGET
(
children
->
data
));
children
=
gtk_container_get_children
(
GTK_CONTAINER
(
self
->
carousel
));
hdy_
carousel
_scroll_to
(
self
->
carousel
,
GTK_WIDGET
(
children
->
data
));
}
HdyDemoWindow
*
...
...
@@ -378,10 +378,10 @@ hdy_demo_window_class_init (HdyDemoWindowClass *klass)
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
combo_row
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
enum_combo_row
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
header_group
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
paginator
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
paginator
_listbox
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
paginator
_orientation_row
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
paginator
_indicator_style_row
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
carousel
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
carousel
_listbox
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
carousel
_orientation_row
);
gtk_widget_class_bind_template_child
(
widget_class
,
HdyDemoWindow
,
carousel
_indicator_style_row
);
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"key_pressed_cb"
,
G_CALLBACK
(
hdy_demo_window_key_pressed_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_header_visible_child_cb"
,
G_CALLBACK
(
hdy_demo_window_notify_header_visible_child_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_fold_cb"
,
G_CALLBACK
(
hdy_demo_window_notify_fold_cb
));
...
...
@@ -392,10 +392,10 @@ hdy_demo_window_class_init (HdyDemoWindowClass *klass)
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"dialog_action_clicked_cb"
,
G_CALLBACK
(
dialog_action_clicked_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"dialog_complex_clicked_cb"
,
G_CALLBACK
(
dialog_complex_clicked_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"view_switcher_demo_clicked_cb"
,
G_CALLBACK
(
view_switcher_demo_clicked_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
paginator
_position_cb"
,
G_CALLBACK
(
notify_
paginator
_position_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
paginator
_orientation_cb"
,
G_CALLBACK
(
notify_
paginator
_orientation_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
paginator
_indicator_style_cb"
,
G_CALLBACK
(
notify_
paginator
_indicator_style_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"
paginator
_return_clicked_cb"
,
G_CALLBACK
(
paginator
_return_clicked_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
carousel
_position_cb"
,
G_CALLBACK
(
notify_
carousel
_position_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
carousel
_orientation_cb"
,
G_CALLBACK
(
notify_
carousel
_orientation_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"notify_
carousel
_indicator_style_cb"
,
G_CALLBACK
(
notify_
carousel
_indicator_style_cb
));
gtk_widget_class_bind_template_callback_full
(
widget_class
,
"
carousel
_return_clicked_cb"
,
G_CALLBACK
(
carousel
_return_clicked_cb
));
}
static
void
...
...
@@ -438,10 +438,10 @@ hdy_demo_window_init (HdyDemoWindow *self)
lists_page_init
(
self
);
gtk_list_box_set_header_func
(
self
->
paginator
_listbox
,
hdy_list_box_separator_header
,
NULL
,
NULL
);
hdy_combo_row_set_for_enum
(
self
->
paginator
_orientation_row
,
GTK_TYPE_ORIENTATION
,
paginator
_orientation_name
,
NULL
,
NULL
);
hdy_combo_row_set_for_enum
(
self
->
paginator
_indicator_style_row
,
HDY_TYPE_
PAGINATOR
_INDICATOR_STYLE
,
paginator
_indicator_style_name
,
NULL
,
NULL
);
hdy_combo_row_set_selected_index
(
self
->
paginator
_indicator_style_row
,
HDY_
PAGINATOR
_INDICATOR_STYLE_DOTS
);
gtk_list_box_set_header_func
(
self
->
carousel
_listbox
,
hdy_list_box_separator_header
,
NULL
,
NULL
);
hdy_combo_row_set_for_enum
(
self
->
carousel
_orientation_row
,
GTK_TYPE_ORIENTATION
,
carousel
_orientation_name
,
NULL
,
NULL
);
hdy_combo_row_set_for_enum
(
self
->
carousel
_indicator_style_row
,
HDY_TYPE_
CAROUSEL
_INDICATOR_STYLE
,
carousel
_indicator_style_name
,
NULL
,
NULL
);
hdy_combo_row_set_selected_index
(
self
->
carousel
_indicator_style_row
,
HDY_
CAROUSEL
_INDICATOR_STYLE_DOTS
);
hdy_leaflet_set_visible_child_name
(
self
->
content_box
,
"content"
);
update_header_bar
(
self
);
...
...
examples/hdy-demo-window.ui
View file @
3d11bfbd
...
...
@@ -1321,11 +1321,11 @@
</packing>
</child>
<child>
<object
class=
"Hdy
Paginator"
id=
"paginator
"
>
<object
class=
"Hdy
Carousel"
id=
"carousel
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"center_content"
>
True
</property>
<property
name=
"indicator_spacing"
>
6
</property>
<signal
name=
"notify::position"
handler=
"notify_
paginator
_position_cb"
/>
<signal
name=
"notify::position"
handler=
"notify_
carousel
_position_cb"
/>
<child>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
...
...
@@ -1346,7 +1346,7 @@
<property
name=
"margin-bottom"
>
18
</property>
<style>
<class
name=
"dim-label"
/>
<class
name=
"
paginator
-icon"
/>
<class
name=
"
carousel
-icon"
/>
</style>
</object>
</child>
...
...
@@ -1359,7 +1359,7 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"opacity"
>
0.5
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
Paginator
</property>
<property
name=
"label"
translatable=
"yes"
>
Carousel
</property>
<property
name=
"halign"
>
center
</property>
<property
name=
"xalign"
>
0
</property>
<property
name=
"margin-bottom"
>
12
</property>
...
...
@@ -1397,7 +1397,7 @@
<property
name=
"maximum-width"
>
400
</property>
<property
name=
"linear-growth-width"
>
300
</property>
<child>
<object
class=
"GtkListBox"
id=
"
paginator
_listbox"
>
<object
class=
"GtkListBox"
id=
"
carousel
_listbox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"valign"
>
center
</property>
...
...
@@ -1406,17 +1406,17 @@
<class
name=
"frame"
/>
</style>
<child>
<object
class=
"HdyComboRow"
id=
"
paginator
_orientation_row"
>
<object
class=
"HdyComboRow"
id=
"
carousel
_orientation_row"
>
<property
name=
"title"
translatable=
"yes"
>
Orientation
</property>
<property
name=
"visible"
>
True
</property>
<signal
name=
"notify::selected-index"
handler=
"notify_
paginator
_orientation_cb"
swapped=
"no"
/>
<signal
name=
"notify::selected-index"
handler=
"notify_
carousel
_orientation_cb"
swapped=
"no"
/>
</object>
</child>
<child>
<object
class=
"HdyComboRow"
id=
"
paginator
_indicator_style_row"
>
<object
class=
"HdyComboRow"
id=
"
carousel
_indicator_style_row"
>
<property
name=
"title"
translatable=
"yes"
>
Page Indicators
</property>
<property
name=
"visible"
>
True
</property>
<signal
name=
"notify::selected-index"
handler=
"notify_
paginator
_indicator_style_cb"
swapped=
"no"
/>
<signal
name=
"notify::selected-index"
handler=
"notify_
carousel
_indicator_style_cb"
swapped=
"no"
/>
</object>
</child>
</object>
...
...
@@ -1453,7 +1453,7 @@
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
_Return to the first page
</property>
<property
name=
"use-underline"
>
True
</property>
<signal
name=
"clicked"
handler=
"
paginator
_return_clicked_cb"
swapped=
"no"
/>
<signal
name=
"clicked"
handler=
"
carousel
_return_clicked_cb"
swapped=
"no"
/>
<style>
<class
name=
"suggested-action"
/>
</style>
...
...
@@ -1463,8 +1463,8 @@
</child>
</object>
<packing>
<property
name=
"name"
>
paginator
</property>
<property
name=
"title"
>
Paginator
</property>
<property
name=
"name"
>
carousel
</property>
<property
name=
"title"
>
Carousel
</property>
</packing>
</child>
</object>
...
...
examples/style.css
View file @
3d11bfbd
...
...
@@ -3,6 +3,6 @@ stacksidebar list {
border-right-width
:
0px
;
}
hdy
paginator
.horizontal
.
paginator
-icon
{
hdy
carousel
.horizontal
.
carousel
-icon
{
-gtk-icon-transform
:
rotate
(
90deg
);
}
glade/glade-hdy-carousel.c
View file @
3d11bfbd
...
...
@@ -19,15 +19,15 @@
#define CENTER_CONTENT_INSENSITIVE_MSG _("This property does not apply unless Show Indicators is set.")
static
gint
hdy_
paginator
_get_page
(
Hdy
Paginator
*
paginator
)
hdy_
carousel
_get_page
(
Hdy
Carousel
*
carousel
)
{
return
round
(
hdy_
paginator
_get_position
(
paginator
));
return
round
(
hdy_
carousel
_get_position
(
carousel
));
}
static
gboolean
hdy_
paginator
_is_transient
(
Hdy
Paginator
*
paginator
)
hdy_
carousel
_is_transient
(
Hdy
Carousel
*
carousel
)
{
return
fmod
(
hdy_
paginator
_get_position
(
paginator
),
1
.
0
)
>
0
.
00001
;
return
fmod
(
hdy_
carousel
_get_position
(
carousel
),
1
.
0
)
>
0
.
00001
;
}
static
gint
...
...
@@ -103,7 +103,7 @@ selection_changed_cb (GladeProject *project,
for
(
l
=
children
;
l
;
l
=
l
->
next
)
{
page
=
l
->
data
;
if
(
sel_widget
==
page
||
gtk_widget_is_ancestor
(
sel_widget
,
page
))
{
hdy_
paginator
_scroll_to
(
HDY_
PAGINATOR
(
container
),
page
);
hdy_
carousel
_scroll_to
(
HDY_
CAROUSEL
(
container
),
page
);
index
=
get_page_index
(
container
,
page
);
glade_widget_property_set
(
gwidget
,
"page"
,
index
);
break
;
...
...
@@ -120,7 +120,7 @@ project_changed_cb (GladeWidget *gwidget,
GladeProject
*
project
,
*
old_project
;
project
=
glade_widget_get_project
(
gwidget
);
old_project
=
g_object_get_data
(
G_OBJECT
(
gwidget
),
"
paginator
-project-ptr"
);
old_project
=
g_object_get_data
(
G_OBJECT
(
gwidget
),
"
carousel
-project-ptr"
);
if
(
old_project
)
g_signal_handlers_disconnect_by_func
(
G_OBJECT
(
old_project
),
...
...
@@ -131,29 +131,29 @@ project_changed_cb (GladeWidget *gwidget,
g_signal_connect
(
G_OBJECT
(
project
),
"selection-changed"
,
G_CALLBACK
(
selection_changed_cb
),
gwidget
);
g_object_set_data
(
G_OBJECT
(
gwidget
),
"
paginator
-project-ptr"
,
project
);
g_object_set_data
(
G_OBJECT
(
gwidget
),
"
carousel
-project-ptr"
,
project
);
}
static
void
position_changed_cb
(
Hdy
Paginator
*
paginator
,
GParamSpec
*
pspec
,
GladeWidget
*
gwidget
)
position_changed_cb
(
Hdy
Carousel
*
carousel
,
GParamSpec
*
pspec
,
GladeWidget
*
gwidget
)
{
gint
old_page
,
new_page
;
glade_widget_property_get
(
gwidget
,
"page"
,
&
old_page
);
new_page
=
hdy_
paginator
_get_page
(
paginator
);
new_page
=
hdy_
carousel
_get_page
(
carousel
);
if
(
old_page
==
new_page
||
hdy_
paginator
_is_transient
(
paginator
))
if
(
old_page
==
new_page
||
hdy_
carousel
_is_transient
(
carousel
))
return
;
glade_widget_property_set
(
gwidget
,
"page"
,
new_page
);
}
void
glade_hdy_
paginator
_post_create
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GladeCreateReason
reason
)
glade_hdy_
carousel
_post_create
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GladeCreateReason
reason
)
{
GladeWidget
*
gwidget
=
glade_widget_get_from_gobject
(
container
);
...
...
@@ -175,10 +175,10 @@ glade_hdy_paginator_post_create (GladeWidgetAdaptor *adaptor,
}
void
glade_hdy_
paginator
_child_action_activate
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
object
,
const
gchar
*
action_path
)
glade_hdy_
carousel
_child_action_activate
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
object
,
const
gchar
*
action_path
)
{
if
(
!
strcmp
(
action_path
,
"insert_page_after"
)
||
!
strcmp
(
action_path
,
"insert_page_before"
))
{
...
...
@@ -199,8 +199,8 @@ glade_hdy_paginator_child_action_activate (GladeWidgetAdaptor *adaptor,
placeholder
=
glade_placeholder_new
();
hdy_
paginator
_insert
(
HDY_
PAGINATOR
(
container
),
placeholder
,
index
);
hdy_
paginator
_scroll_to
(
HDY_
PAGINATOR
(
container
),
placeholder
);
hdy_
carousel
_insert
(
HDY_
CAROUSEL
(
container
),
placeholder
,
index
);
hdy_
carousel
_scroll_to
(
HDY_
CAROUSEL
(
container
),
placeholder
);
property
=
glade_widget_get_property
(
parent
,
"pages"
);
glade_command_set_property
(
property
,
pages
+
1
);
...
...
@@ -246,7 +246,7 @@ set_n_pages (GObject *container,
gint
old_size
,
new_size
,
i
,
page
;
new_size
=
g_value_get_int
(
value
);
old_size
=
hdy_
paginator
_get_n_pages
(
HDY_
PAGINATOR
(
container
));
old_size
=
hdy_
carousel
_get_n_pages
(
HDY_
CAROUSEL
(
container
));
if
(
old_size
==
new_size
)
return
;
...
...
@@ -280,7 +280,7 @@ set_page (GObject *object,
child
=
get_nth_page
(
GTK_CONTAINER
(
object
),
new_page
);
if
(
child
)
hdy_
paginator
_scroll_to
(
HDY_
PAGINATOR
(
object
),
child
);
hdy_
carousel
_scroll_to
(
HDY_
CAROUSEL
(
object
),
child
);
}
static
void
...
...
@@ -288,24 +288,24 @@ set_indicator_style (GObject *container,
const
GValue
*
value
)
{
GladeWidget
*
gwidget
;
Hdy
Paginator
IndicatorStyle
style
;
Hdy
Carousel
IndicatorStyle
style
;
gwidget
=
glade_widget_get_from_gobject
(
container
);
style
=
g_value_get_enum
(
value
);
glade_widget_property_set_sensitive
(
gwidget
,
"indicator-spacing"
,
style
!=
HDY_
PAGINATOR
_INDICATOR_STYLE_NONE
,
style
!=
HDY_
CAROUSEL
_INDICATOR_STYLE_NONE
,
CENTER_CONTENT_INSENSITIVE_MSG
);
glade_widget_property_set_sensitive
(
gwidget
,
"center-content"
,
style
!=
HDY_
PAGINATOR
_INDICATOR_STYLE_NONE
,
style
!=
HDY_
CAROUSEL
_INDICATOR_STYLE_NONE
,
CENTER_CONTENT_INSENSITIVE_MSG
);
}
void
glade_hdy_
paginator
_set_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
const
GValue
*
value
)
glade_hdy_
carousel
_set_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
const
GValue
*
value
)
{
if
(
!
strcmp
(
id
,
"pages"
))
set_n_pages
(
object
,
value
);
...
...
@@ -320,25 +320,25 @@ glade_hdy_paginator_set_property (GladeWidgetAdaptor *adaptor,
}
void
glade_hdy_
paginator
_get_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
GValue
*
value
)
glade_hdy_
carousel
_get_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
GValue
*
value
)
{
if
(
!
strcmp
(
id
,
"pages"
))
{
g_value_reset
(
value
);
g_value_set_int
(
value
,
hdy_
paginator
_get_n_pages
(
HDY_
PAGINATOR
(
object
)));
g_value_set_int
(
value
,
hdy_
carousel
_get_n_pages
(
HDY_
CAROUSEL
(
object
)));
}
else
if
(
!
strcmp
(
id
,
"page"
))
{
g_value_reset
(
value
);
g_value_set_int
(
value
,
hdy_
paginator
_get_page
(
HDY_
PAGINATOR
(
object
)));
g_value_set_int
(
value
,
hdy_
carousel
_get_page
(
HDY_
CAROUSEL
(
object
)));
}
else
{
GWA_GET_CLASS
(
GTK_TYPE_CONTAINER
)
->
get_property
(
adaptor
,
object
,
id
,
value
);
}
}
static
gboolean
glade_hdy_
paginator
_verify_n_pages
(
GObject
*
object
,
const
GValue
*
value
)
glade_hdy_
carousel
_verify_n_pages
(
GObject
*
object
,
const
GValue
*
value
)
{
gint
new_size
,
old_size
;
...
...
@@ -349,27 +349,27 @@ glade_hdy_paginator_verify_n_pages (GObject *object,
}
static
gboolean
glade_hdy_
paginator
_verify_page
(
GObject
*
object
,
const
GValue
*
value
)
glade_hdy_
carousel
_verify_page
(
GObject
*
object
,
const
GValue
*
value
)
{
gint
page
,
pages
;
page
=
g_value_get_int
(
value
);
pages
=
hdy_
paginator
_get_n_pages
(
HDY_
PAGINATOR
(
object
));
pages
=
hdy_
carousel
_get_n_pages
(
HDY_
CAROUSEL
(
object
));
return
0
<=
page
&&
page
<
pages
;
}
gboolean
glade_hdy_
paginator
_verify_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
const
GValue
*
value
)
glade_hdy_
carousel
_verify_property
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
object
,
const
gchar
*
id
,
const
GValue
*
value
)
{
if
(
!
strcmp
(
id
,
"pages"
))
return
glade_hdy_
paginator
_verify_n_pages
(
object
,
value
);
return
glade_hdy_
carousel
_verify_n_pages
(
object
,
value
);
else
if
(
!
strcmp
(
id
,
"page"
))
return
glade_hdy_
paginator
_verify_page
(
object
,
value
);
return
glade_hdy_
carousel
_verify_page
(
object
,
value
);
else
if
(
GWA_GET_CLASS
(
GTK_TYPE_CONTAINER
)
->
verify_property
)
return
GWA_GET_CLASS
(
GTK_TYPE_CONTAINER
)
->
verify_property
(
adaptor
,
object
,
id
,
value
);
...
...
@@ -378,9 +378,9 @@ glade_hdy_paginator_verify_property (GladeWidgetAdaptor *adaptor,
}
void
glade_hdy_
paginator
_add_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
child
)
glade_hdy_
carousel
_add_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
child
)
{
GladeWidget
*
gbox
,
*
gchild
;
gint
pages
,
page
;
...
...
@@ -416,9 +416,9 @@ glade_hdy_paginator_add_child (GladeWidgetAdaptor *adaptor,
}
void
glade_hdy_
paginator
_remove_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
child
)
glade_hdy_
carousel
_remove_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
child
)
{
GladeWidget
*
gbox
;
gint
pages
,
page
;
...
...
@@ -433,20 +433,20 @@ glade_hdy_paginator_remove_child (GladeWidgetAdaptor *adaptor,
}
void
glade_hdy_
paginator
_replace_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
current
,
GObject
*
new_widget
)
glade_hdy_
carousel
_replace_child
(
GladeWidgetAdaptor
*
adaptor
,
GObject
*
container
,
GObject
*
current
,
GObject
*
new_widget
)
{
GladeWidget
*
gbox
,
*
gchild
;
gint
pages
,
page
,
index
;
index
=
get_page_index
(
GTK_CONTAINER
(
container
),
GTK_WIDGET
(
current
));
gtk_container_remove
(
GTK_CONTAINER
(
container
),
GTK_WIDGET
(
current
));
hdy_
paginator
_insert
(
HDY_
PAGINATOR
(
container
),
GTK_WIDGET
(
new_widget
),
index
);
hdy_
paginator
_scroll_to_full
(
HDY_
PAGINATOR
(
container
),
GTK_WIDGET
(
new_widget
),
0
);
hdy_
carousel
_insert
(
HDY_
CAROUSEL
(
container
),
GTK_WIDGET
(
new_widget
),
index
);
hdy_
carousel
_scroll_to_full
(
HDY_
CAROUSEL
(
container
),