Commit Graph

169 Commits

Author SHA1 Message Date
Daniel Boles
8efc91c4e0 GtkProgressBar: trivial conditional optimisation
I'd hope the compiler would realise this for us, but let's be explicit.
2016-12-03 16:27:03 +00:00
Simon Steinbeiss
a1deb8e459 progressbar: add empty and full classes on trough based on fill-level
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774695
2016-11-19 03:02:46 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
601839c825 Remove various sizing related style properties 2016-10-16 18:17:21 +02:00
Matthias Clasen
b42d4b5b9a progressbar: Render text with the text css node
This is the same fix that was just applied to GtkScale.
2016-06-03 16:30:00 -04:00
Chun-wei Fan
092cb9e202 GTK: Fix build for pre-C99 compilers
Some compilers we support, such as pre-2013 Visual Studio, does not support
for INIFINITY, log2() and exp2(), so check for exp2() and log2() during
configure, and use fallbacks for them and INIFINTY if they are not found.

https://bugzilla.gnome.org/show_bug.cgi?id=766207
2016-05-10 17:14:07 +08:00
Matthias Clasen
dfdc7c3e0d progressbar: Enforce invariants
When measuring gadgets, minimum must come out <= natural.
Make sure we don't fail this when measuring progressbar text.

https://bugzilla.gnome.org/show_bug.cgi?id=765644
2016-04-26 20:44:07 -04:00
Matt Watson
d57ebe2de7 progressbar: port to progress tracker 2016-04-08 16:09:30 -07:00
Matthias Clasen
956b2ff998 progressbar: Don't leave css nodes behind
We create and destroy gadgets inside the hierarchy here,
and if we don't explicitly remove their CSS nodes from the parent,
they stick around.
2016-03-01 16:00:54 -05:00
Matthias Clasen
ea4cff1ea4 Use convenience API that was introduced recently
Use gtk_css_gadget_set_state in all the places where we previously
were getting a node from a gadget, just to call gtk_css_node_set_state.
2016-01-13 00:19:31 -05:00
Lapo Calamandrei
152171e60c Adwaita: transparent background for progressbar.osd
Hopefully fixes https://bugzilla.gnome.org/show_bug.cgi?id=760331
Added the .osd style class to the progressbar docs.
2016-01-09 20:05:41 +01:00
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Matthias Clasen
4e05148bef Simplify some code
Deal with the min-width/min-height fallback the same way
as in GtkBuiltinIcon.
2015-12-16 13:53:13 -05:00
Benjamin Otte
26d42771ef progressbar: Change the way the progress gadget gets size
Size of the progress element now grows also when it's close to 0 size.

Previously the size was clamped to the minimum size, now it starts
growing from the minimum size.
So for a 100px trough with a 10px min size progress, the sizes of the
progress element change like this:
        old     new
0%      10      10
5%      10      14
10%     10      19
20%     20      28
50%     50      55
100%    100     100
2015-12-16 01:50:01 +01:00
Matthias Clasen
fffa84b843 progressbar: Convert to gadgets
Use gadgets for the text, the trough and the progress.
2015-12-15 08:41:16 -05:00
Benjamin Otte
971a277419 cssnode: Change style-changed signal
Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
2015-12-12 02:16:04 +01:00
Matthias Clasen
43f822e70f Annotate deprecated style properties
Use G_PARAM_DEPRECATED with deprecated style properties.
This will make it easier to identify and remove such stale
properties from css, since it will now trigger warnings.
2015-11-16 15:13:33 -05:00
Matthias Clasen
c6d5accf9c progressbar: Ignore x/yspacing style properties
These are not really useful, so ignore and deprecate them.
2015-11-16 07:20:18 -05:00
Matthias Clasen
3007ad6f3b Cosmetic: Avoid explicit state variables
Using the state of the context makes this more obviously correct.
2015-11-14 12:32:57 -05:00
Matthias Clasen
9d4c78c2d0 progressbar: Add a CSS node for trough
This is better, since the trough doesn't fill up the allocation
entirely.
2015-11-04 12:32:15 -05:00
Matthias Clasen
332ea5f8ec progressbar: Add diagrams to CSS documentation 2015-11-03 14:27:35 -05:00
Matthias Clasen
479d64e89a progress bar: Add CSS documentation 2015-10-31 20:30:15 -04:00
Matthias Clasen
73704d98cc progressbar: Convert to CSS nodes
Use the element names progressbar and progress.
2015-10-31 20:20:13 -04:00
Matthias Clasen
bfe141c011 progressbar: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:35 -04:00
Matthias Clasen
eb715c3118 GtkProgressBar: Adjust docs to new style
Don't talk about superimposed text, since we don't do that
anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=748784
2015-05-07 22:07:41 -04:00
Lars Uebernickel
ada97b0928 gtkprogressbar: fix size allocation
As of 74405cc, progress bars use a new design with values drawn on top
(or to the left) of the through instead of inside of it. This change
brought a number of regressions: the min-horizontal-bar-height and
min-vertical-bar-width style properties are not respected anymore. For
vertical progress bars, the value was drawn too close to the bar and not
centered vertically.

Fix this by respecting the style properties and drawing the value label
at the correct position.

Also, the xspacing and yspacing properties didn't server any apparent
purpose. Change their semantics to mean "the spacing between the label
and the bar". Hence, they only need to be added to the size request when
showing the label. Since we are changing semantics anyway, reduce their
default values from 7 to 2, to avoid and excessive gap.

https://bugzilla.gnome.org/show_bug.cgi?id=746688
2015-03-28 19:00:06 -04:00
Benjamin Otte
3534225c76 progressbar: Make the trough the default element
Gets rid of a bunch of save/restore calls and allows animating the
background (but not the slider, booo!)
2014-10-13 04:39:58 +02:00
Matthias Clasen
67b4f8ea75 GtkProgressBar: Mark the default text for translation
At the same time, use a small space before %.
This matches what is done in GtkCellRendererProgress.

https://bugzilla.gnome.org/show_bug.cgi?id=735192
2014-09-29 23:05:22 -04:00
Benjamin Otte
b5a8b7ef3b widget: Make _gtk_set_simple_clip() take an optional content clip 2014-08-21 00:54:07 +02:00
Benjamin Otte
6c06bd55da gtk: Don't use gtk_render_activity()
... in places where we draw a background. This was changed for GTK 3.0.0
to allow animations, but these days it doesn't make sense anymore to use
gtk_render_activity() for backgrounds.
2014-08-16 16:34:14 +02:00
Matthias Clasen
a9201b8379 GtkProgressBar: Add style classes for edges
Add left/right/top/bottom style classes according to which edge(s)
of the progressbar the progress is adjacent to. Only for a fraction
of 1.0 will we set more than one edge.
2014-07-19 00:40:09 -04:00
Matthias Clasen
18a92992a0 GtkProgressBar: Set orientable style classes initially
This was an omission, horizontal/vertical would only be set
when the orientation is changed.
2014-07-18 19:39:11 -04:00
Matthias Clasen
c2907b8532 GtkProgressBar: implement clipping
This allows progress bars to have shadows.

https://bugzilla.gnome.org/show_bug.cgi?id=733361
2014-07-18 16:32:46 -04:00
Matthias Clasen
f446ffdd5d GtkProgressbar: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:07 -04:00
William Jon McCann
74405cc964 Update the design for progress bars
We now use a narrower trough and paint the optional text
beside the trough instead of inside it. This makes for a much
cleaner appearance and more readable text.
2014-05-07 09:56:35 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Matthias Clasen
10cd226dfe Progress bar: Handle 'no more pulse'
Before smooth animation, stopping the pulse would abruptly stop
the bouncy bar. This change makes it so that we slow down for
a bit, and then stop.
2013-11-11 07:24:35 -05:00
Matthias Clasen
eae9513cbd Make activity mode progress bars animate better
Use a tick callback and move the block each frame, instead
of making it jump only when gtk_progress_bar_pulse() is called.
2013-11-10 01:20:27 -05:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Benjamin Otte
b39bb4400e progressbar: Store activity position as percentage
... instead of in absolute pixels.
2012-12-29 01:00:15 +01:00
Benjamin Otte
02b440b466 progressbar: Remove activity_step from private struct
It's only used locally, so use a local variable
2012-12-29 01:00:15 +01:00
Benjamin Otte
7747910b9d gtk: Use context's font
Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.
2012-12-06 02:57:18 +01:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Philip Withnall
5df87d06d4 progressbar: Tidy up the gtk-doc comments a little 2012-01-21 10:05:10 +00:00
Rui Matos
f4c698ef93 Revert "progressbar: Set state flags on draw"
This reverts commit 6ed5918718 which is no
longer needed as the style context now has the state flags updated when going
into draw.
2011-12-19 20:59:06 +00:00