Commit Graph

90 Commits

Author SHA1 Message Date
Matthias Clasen
e237c947c7 headerbar: Convert to gadgets 2015-12-15 08:41:16 -05:00
Kalev Lember
9103707922 headerbar: Don't leak internal widgets
Make sure to clean up internal widgets in destroy, as these aren't
cleaned up when GtkContainer walks the childrens list in
gtk_container_destroy().

This also fixes a gedit crash as reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1288669

https://bugzilla.gnome.org/show_bug.cgi?id=759132
2015-12-07 22:15:25 -05:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Christoph Reiter
bb34db6d35 gtkheaderbar: update the window buttons on ::hierarchy-changed instead of ::realize
The window button setup depends on properties of the toplevel window.
Instead of updating the setup on realize, do it when the toplevel
changes.

This makes sure that when a GtkHeaderBar is added to a window
all the widgets are present and get_preferred_height() will return
the height the widget will have when finally shown. This allows
the logic in gtkwindow to select the right window size so that
the content size will match the requested default size.

https://bugzilla.gnome.org/show_bug.cgi?id=756618
2015-11-19 21:42:53 +01:00
Christian Hergert
5f0a8cf136 headerbar: remove G_PARAM_CONSTRUCT from custom-title
This fixes the ability to sublcass GtkHeaderBar from a UI template which
contains a custom <child type="title"> element.

https://bugzilla.gnome.org/show_bug.cgi?id=757544
2015-11-03 14:50:56 -08:00
Matthias Clasen
8c0c0f9c07 headerbar: Use an element name instead of a style class
Use the element name headerbar.
2015-10-30 01:07:58 -04:00
Matthias Clasen
84c7f6c747 header bar: Show a non-pixellated app icon
Load a hi-dpi icon when we are running with scale=2.

https://bugzilla.gnome.org/show_bug.cgi?id=751787
2015-09-30 18:42:20 -04:00
Matthias Clasen
565677a22c header bar: Don't leave a dangling pointer
This might be the cause for some crashes, like
https://bugzilla.redhat.com/show_bug.cgi?id=1264558
2015-09-29 15:15:06 -04:00
Matthias Clasen
661e51a8e2 header bar: Use g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:35 -04:00
Matthias Clasen
f881f37789 Fix csd decorations
By accident, commit b9b17c3c2a removed one line
that wasn't unused, but important for hiding close buttons on
dialogs. Bring it back.
2015-07-19 09:59:18 -04:00
Benjamin Otte
dbb1830728 headerbar: Switch css positions on direction change 2015-07-17 19:13:09 +02:00
Benjamin Otte
3d2ead0fce headerbar: Get rid of get_path_for_child()
Instead, reorder CSS nodes.
2015-07-16 06:15:13 +02:00
Benjamin Otte
a039fd1699 headerbar: Finish widget setup before showing it. 2015-07-16 06:15:13 +02:00
Benjamin Otte
792076e09b headerbar: forall() the button boxes in the right order 2015-07-16 06:15:13 +02:00
Benjamin Otte
b9b17c3c2a headerbar: Remove unused variables in private struct 2015-07-16 06:15:13 +02:00
Christoph Reiter
335c070f9b GtkHeaderBar: reduce minimum title width
The minimum title width affects the minimum window width
for CSD windows. To allow smaller windows like without
CSD reduce it a bit (276px vs 156px min width)

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-23 21:16:37 +02:00
Matthias Clasen
c8d6231c3c Fix window button updates in split headers
We were only updating window buttons when the headerbar was
a direct child of the window. That is not the case in more
complicated situations, such as the split headers in gedit
or polari. To fix such cases, make the headerbar itself listen
for state changes on its toplevel.

https://bugzilla.gnome.org/show_bug.cgi?id=747805
2015-04-14 17:05:34 -04:00
Matthias Clasen
b187773053 Add style classes to the title buttons
This will let themes treat close/min/max buttons differently,
if they so desire.

https://bugzilla.gnome.org/show_bug.cgi?id=744400
2015-02-15 13:03:29 -05:00
Benjamin Otte
3fcb892831 headerbar: Implement clipping 2015-01-22 16:25:24 +01:00
Matthias Clasen
5a01208f55 GtkHeaderBar: Queue a resize when pack-type is changed
Otherwise, buttons appear to stick to the wrong side in glade.
2014-11-06 01:05:51 -05:00
Matthias Clasen
e2882e4845 GtkHeaderBar: Make the position child property writable
Glade asssumes that it is, and without this, rearranging children
in glade is very cumbersome.
2014-11-04 16:56:25 -05:00
Matthias Clasen
2873195644 GtkHeaderBar: Fix a corner-case in child properties
The child property setting must be prepared to deal with any
child property for any child, even if it doesn't make sense,
like the pack-type for the custom title. This is happening
in glade when undoing a change in the custom-title property.
2014-11-02 17:49:47 -05:00
Matthias Clasen
3404e92312 GtkHeaderBar: Update separator visibility when needed
We need to be a little more forthcoming with showing and hiding
the separators - their visibility now depends on the the visibility
and pack type of the regular headerbar children. This was observed
in gnome-contacts, where headerbar buttons are shown and hidden.
2014-08-28 22:54:18 -04:00
Nikita Churaev
684b981fb5 Only show title button separator when there is something to separate
https://bugzilla.gnome.org/show_bug.cgi?id=729636
2014-08-08 23:02:14 +02:00
Matthias Clasen
9d527c83aa GtkHeaderBar: Use defines for style classes 2014-07-04 19:06:08 -04:00
Matthias Clasen
baea175628 GtkHeaderBar: Don't forget to show the subtitle
https://bugzilla.gnome.org/show_bug.cgi?id=731790
2014-06-18 11:56:08 -04:00
Matthias Clasen
d1f6858b36 GtkHeaderBar: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:04 -04:00
Matthias Clasen
d1d2763d00 GtkHeaderBar: Allow overdrawing
The draw function of GtkHeaderBar was returning TRUE, causing
after-signal handlers to not run. This breaks e.g. drawing of
dnd hightlights. Fix that.
2014-05-03 13:16:46 -04:00
Benjamin Otte
209781ae3c headerbar: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:28 +02:00
Volker Sobek
0940cbbeb9 docs: Fix parameter names for two functions
Don't use two different parameter names.
2014-04-21 22:57:35 +02:00
Yosef Or Boczko
900adae5d9 headerbar: Use popover for the fallback app menu
https://bugzilla.gnome.org/show_bug.cgi?id=723963
2014-04-06 02:23:19 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
c5874b1034 Document gtk_header_bar_get_has_subtitle 2014-02-19 01:03:37 -05:00
Matthias Clasen
e179c65da0 header bar: squeeze the title in
Let the center widget extend into the border area, to avoid
resizing header bars needlessly. This improves the uniformity
of header bars across applications, some of which don't use
subtitles, or use custom title widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=706515
https://bugzilla.gnome.org/show_bug.cgi?id=707999
2014-02-14 15:39:08 -05:00
William Jon McCann
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
Murray Cumming
a220871250 docs: Improve grammar in GtkHeaderBar overview 2014-01-31 11:24:34 +01:00
Matthias Clasen
6e96111d9f GtkHeaderBar: try harder to find the best window icon
GtkWindow has 4 (!) APIs for setting window icons, and we
have to try them all in the right order to find the right
icon. This commit makes it so, and keeps the icon list
manipulation inside gtkwindow.c by adding a private API
for getting a single icon at the right size.

https://bugzilla.gnome.org/show_bug.cgi?id=722515
2014-01-24 15:40:37 -05:00
Yosef Or Boczko
773e40ca7b docs: Add more a reference in GtkHeaderBar 2014-01-23 18:29:31 +02:00
William Jon McCann
0a416c7559 docs: avoid ambiguous return tags 2014-01-21 12:41:16 -05:00
Matthias Clasen
679883e098 Make sure title_bar_with is initialized
With a hidden custom title, we failed to initialize
the title_bar_width variables.
2014-01-18 17:58:44 -05:00
Volker Sobek
a4d69e7f14 docs/comments: Fix spelling of 'explicitly'
This replaces all occurrences of 'explicitely' with 'explicitly'. Only
code comments and gtk-doc statements are affected.

https://bugzilla.gnome.org/show_bug.cgi?id=722429
2014-01-18 03:47:46 +01:00
Matthias Clasen
b73d291086 header bar: Make it possible to have no title
Add a custom title had the side-effect of showing the widget.
That is not right, adding children and managing their visibility
should be independent. The headerbar size allocation code also
made the assumption that a custom title is always visible.

With these changes, GtkHeaderBar should be usable in situations
where the centering functionality is not required, and it is
important to freely pack content at both ends, such as in nautilus.

https://bugzilla.gnome.org/show_bug.cgi?id=722340
2014-01-17 19:52:29 -05:00
William Jon McCann
24aa40ed35 headerbar: Set a minimum size for the title
https://bugzilla.gnome.org/show_bug.cgi?id=720059
2014-01-17 17:52:06 -05:00
Cosimo Cecchi
197785744b window: add an is-maximized property to GtkWindow
With proper notifications, plus an accessor method for that state. This
allows client to just listen to notify::is-maximized instead of tracking
window-state-event.

https://bugzilla.gnome.org/show_bug.cgi?id=698786
2014-01-13 23:13:37 -05:00
Matthias Clasen
c3e91c7031 GtkHeaderBar: Fix positioning of pack-end widgets
This makes the positioning of pack-start and pack-end
widgets symmetric.
2014-01-06 23:37:18 -05:00
Matthias Clasen
2602372401 Be more careful when parsing gtk-decoration-layout
When the string is empty, breaking it at : will not give
us two tokens, and we were parsing garbage, leading to crash.
https://bugzilla.gnome.org/show_bug.cgi?id=721635
2014-01-06 17:07:21 -05:00
Matthias Clasen
f723113127 GtkHeaderBar: Refresh window buttons when settings change
We already do this when the shell-shows-menu settings changes,
but we forgot to do the same for the decoration layout.
2014-01-06 10:32:18 -05:00
Matthias Clasen
7e1a4800fa Redo header bar decorations once more
Applications need a way to fix or adapt the decoration layout,
for situations like split header bars. Setting the layout from
the theme with a style property did not offer a good way to do
this, and the ::show-close-button property does not provide
fine-grained control.

To improve the situation, move the layout string to a property of
GtkHeaderBar which is backed by a setting. This allows platforms to
set a default button layout independent of the theme, while applications
can override the default.

The style GtkWindow style property is now deprecated and ignored.
2013-12-21 21:58:24 -05:00
Matthias Clasen
18d439ee40 Allow close buttons on dialogs
It was a long-standing problem for some users of GtkDialog that
there is no guaranted way to close it. So, lets show a close
button.
2013-12-20 13:31:08 -05:00
Matthias Clasen
1ccbca42d0 GtkHeaderBar: Fix allocation of start and end boxes
We were giving these boxes too much width, consuming what
was supposed to be the spacing between the boxes and the
other content of the header bar.
2013-12-16 20:36:22 -05:00