Commit Graph

232 Commits

Author SHA1 Message Date
Matthias Clasen
3e8eacc8b7 dialog: Use an element name
This will help differentiating dialogs from other windows, style-wise.
2015-11-24 07:41:26 -05:00
Matthias Clasen
8422633311 Don't use g_list_next in gtkdialog.c
We generall access ->next directly.
2015-10-20 06:14:57 -04:00
Lars Uebernickel
2dda89cbd5 GtkButtonBox: remove spacing when buttons are linked
GtkButtonBox adds the "linked" class to its style context when its
layout is set to GTK_BUTTONBOX_EXPAND. It shouldn't ever make sense to
have spacing between buttons in that case, as themes generally draw
linked elements with a continuous border.

Thus, always set spacing to 0 and ignore GtkDialog's button-spacing
style property when the layout is set to EXPAND.

Also remove the now-redundant css rules which set button-spacing to 0
for message dialogs.

https://bugzilla.gnome.org/show_bug.cgi?id=752131
2015-07-14 15:12:56 +02:00
Matthias Clasen
2805ba64c6 GtkDialog: Use _gtk_builder_lookup_object 2015-04-27 23:09:30 -04:00
Matthias Clasen
4ee291c8f1 GtkDialog: Use the new helpers
Instead of issuing g_warning, fill the provided GError.
This lets us test this error handling, and is the right
thing to do. Use the new GtkBuilder helpers and
g_markup_collect_attributes to do so.
2015-04-27 01:15:23 -04:00
Matthias Clasen
31ff1204a4 GtkDialog: Fix up docs
The ui fragment in the example was causing a critical
warning, which is not nice. Fix it to work properly.
2015-04-26 15:03:48 -04:00
Timm Bäder
56133a1feb GtkDialog: Connect to activate signals only once
If the widget is an action widget, it's been previously added with
gtk_dialog_add_action_widget, which calls add_response_data on it, which
in turn connects to the clicked/activate signal of that widget, so we
don't need to connect to that signal a second time in
gtk_buildable_custom_finished.
2014-11-17 18:37:47 +01:00
Matthias Clasen
d55e3b25a7 Fix various compiler warnings
Mostly missing declarations and missing statics.
2014-09-05 21:21:49 -04:00
Matthias Clasen
7b3c81f688 GtkDialog: Keep special-casing help buttons
We used to move help buttons to the secondary position regardless
how they were added to the action area. Keep doing that, to avoid
breaking existing dialogs that rely on this behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=735119
2014-08-28 21:29:26 -04:00
Matthias Clasen
85297367dc GtkDialog: Manage action area visibility more carefully
People expect to be able to call gtk_widget_show_all on the dialog
to make action widgets visible, as seen e.g. in
https://bugzilla.gnome.org/show_bug.cgi?id=733431

To keep this working, we can't always set no-show-all on the
action_box. Only set it when the action_area is not used and empty.
2014-07-20 01:05:41 -04:00
Matthias Clasen
24e707315f GtkDialog: Be more careful in handling the headerbar
Just because an action widget has a parent thats a headerbar,
it is not guaranteed that it is 'our' headerbar. Add some
assertions to enforce this.
2014-07-17 12:53:54 -04:00
Matthias Clasen
7b40714541 GtkDialog: rejigger headerbar handling
We can't avoid calling set_titlebar in buildable_add_child, since
GtkBuilder assumes that it can e.g. call grab_default at the end,
which only works if the widget is inside a toplevel at that point.

Instead, drop the titlebar and clean up priv->headerbar in constructed
if we find that we don't want a headerbar.
2014-07-17 12:49:57 -04:00
Matthias Clasen
dc87027af9 Try harder to fix dialog titles
https://bugzilla.gnome.org/show_bug.cgi?id=733099
2014-07-15 21:31:13 -04:00
Matthias Clasen
97b9d8e4ae GtkDialog: Set window titles in header bars
This is fallout from the recent dialog changes. We don't set the
headerbar as titlebar early enough anymore, so when the window title
gets set, it does not get passed on to the headerbar. So, re-set it
manually when the titlebar is put in place.

https://bugzilla.gnome.org/show_bug.cgi?id=733099
2014-07-13 09:58:31 -04:00
Matthias Clasen
8afd4b71e9 GtkDialog: Fix setting of default action
The recent reshuffling caused an ordering problem where we would
hide the action area before relocating the buttons to the header
bar. But hiding makes the default button loose its defaultness.
Rearrange things so that we move the buttons before hiding the
action area, and thus preserve the default.
2014-07-09 19:48:01 -04:00
Matthias Clasen
10892863d5 GtkDialog: fix invisible action area
When there area explicitly added buttons in the action area,
we were trying to ensure that the action area is visible,
but failed, since we are now hiding the action_box. Fix it
by showing the action_box when things are left in the action
area.
2014-07-02 00:33:46 -04:00
Matthias Clasen
120d1f8983 GtkDialog: Don't use csd when use-header-bar is FALSE
https://bugzilla.gnome.org/show_bug.cgi?id=730893
2014-06-30 21:44:40 -04:00
Jasper St. Pierre
9c37b3de74 gtk: Don't use GObjectClass.constructor
Use the newer constructed instead, which has a fast path in GObject.
2014-06-26 19:06:43 -04:00
Matthias Clasen
02a44c454c GtkDialog: Be a little more careful about button placement
We were applying response based heuristics, even if the button
is explicitly put in the headerbar. That broke button placement
in some epiphany dialogs, such as the Cookies one. Therefore,
restrict the heuristics to action widgets that are added through
gtk_widget_add_action_widget() or <child type="action">, where it
is not possible to specify placement explicitly.
2014-06-06 13:00:06 -04:00
Matthias Clasen
9c6c4fdeb8 GtkDialog: avoid a crash
Just because use-header-bar is set, it is not safe to assume
every action widget is in the headerbar, so be careful when
setting child properties.
2014-06-06 12:20:57 -04:00
Matthias Clasen
7aadd6fd2e Remove unintentional addition
Debugging leftovers.
2014-06-05 18:12:42 -04:00
Matthias Clasen
d724175e49 GtkDialog: Improve the buildable implementation
When combining action child type with <action-widgets> to assign
response ids, we were not properly updating buttons that ended up
getting added to the headerbar before they have a response id.
Fix this by reapplying the headerbar button setup after parsing
<action-widgets>, and make sure to also update the suggested-action
style class.
2014-06-05 18:08:45 -04:00
Evan Nemerson
07d825574f gtk: add missing type annotations ported from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:33 -07:00
Matthias Clasen
47094a2a8a GtkDialog: Reduce a g_warning to a g_message
Otherwise, this breaks our testsuite.
2014-05-02 20:47:56 -04:00
Matthias Clasen
c4ec89cf9d GtkDialog: Warn about lack of transient parents
We want make it mandatory for dialogs to have transient parents,
eventually. This is a first step in that direction.
2014-05-02 18:23:58 -04:00
Matthias Clasen
66b6078ae2 GtkDialog: Update suggested-action more carefully
We were not really handling all cases correctly here. We want
the suggested-action style class to only be set on headerbar
buttons, and it should be set on the default widget. Ensure
this by syncing the suggested-action style class with the
default style class. As a side-effect, setting has-default
on an action widget in ui files will now have the expected
effect.

https://bugzilla.gnome.org/show_bug.cgi?id=728846
2014-04-25 22:11:53 -04:00
Matthias Clasen
90559a3fc5 GtkDialog: Support adding action widgets in ui files
GtkDialog has convenience API for adding action widgets that are
either placed in the action area or the headerbar. This commit
makes the same functionality available from GtkBuilder ui files
by specifying "action" as the child type.

https://bugzilla.gnome.org/show_bug.cgi?id=728846
2014-04-25 22:11:38 -04:00
William Jon McCann
7e479aa9ee dialog: add a box around the action area to use for styling
If we want to set style properties that include the area
of the border-width part of action_area we need to use a
parent box.

https://bugzilla.gnome.org/show_bug.cgi?id=722211
2014-04-22 22:35:02 -04:00
Matthias Clasen
28327ee9aa GtkDialog: fix up handling of style properties
The use of border-width-set here was an attempt to differentiate
between explicitly set (from code / ui files) border width from
theme changes. But when we are calling gtk_window_set_border_width
to apply the theme value, the -set property gets set, and all
further theme changes are ignored. This has the effect of only
letting the default value of these properties get applied.

Fix this by unsetting border-width-set after applying theme values.
2014-04-10 13:54:37 -07:00
Matthias Clasen
02cd5737f6 Don't let themes override explicit border-width in dialogs
This fixes an issue where the theme-provided border-width prevents
dialog contents from lining up properly with the headerbar. To make
this work in message dialogs, we have to explicitly set the border-
width of the action area to 0.
2014-03-24 10:26:31 -04:00
Matthias Clasen
7da97a3642 Revert "Don't let themes override explicit border-width in dialogs"
This reverts commit 6e4567e73b.

For some reason, this causes buttons in message dialogs to have an
unwanted border.
2014-03-24 08:38:59 -04:00
Matthias Clasen
6e4567e73b Don't let themes override explicit border-width in dialogs
This fixes an issue where the theme-provided border-width prevents
dialog contents from lining up properly with the headerbar.
2014-03-21 15:41:13 -04:00
Matthias Clasen
1a2b7bbd0a GtkDialog: Add some padding to title label 2014-03-17 22:46:22 -04:00
Bastien Nocera
20c764fc5e dialog: Avoid possible use-after-free
When the dialogue's titlebar was replaced, we were still trying to
update the label we constructed but that was now destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=726492
2014-03-17 14:29:10 +01:00
Matthias Clasen
3504f49473 Show dialog titles
We want to present a clean, rounded top when there is nothing
else to show, but many dialogs in applications rely on showing
information in their title, so add a label and show the title
when it is not empty.
2014-03-14 06:28:49 -04:00
William Jon McCann
322f6c740f dialogs: always use CSD on dialogs
If we aren't using a header bar then put a fake titlebar
box on it so we can round the corners.

One of the advantages of this is so that the styling of the dialog
is completely within one theme framework. This prevents skew between
the theming expectations from the window manager and GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=725345
2014-03-03 15:00:13 -05:00
William Jon McCann
2cc1bf4edf dialog: remove suggested action class when changing default action
So that we don't have multiple widgets with the style class set
to suggested-action.
2014-02-27 09:09:28 -05:00
William Jon McCann
fb8f36f34d dialog: set suggested-action even on dialogs without header bars
It is up to the theme whether these should be styled.
2014-02-27 09:08:53 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
c779b42476 Docs: use // for comments in examples
Without sgml mode, we can't escape /* as /&ast; anymore,
so just switch to // for comments in examples.
2014-02-14 23:34:22 -05:00
William Jon McCann
37a8ee6e95 docs: fully break lines in examples
Try to do a better job of keeping example content
from being too wide. It is often rendered as <pre>
text so the only time we can wrap it is in the source.

It is best to full break lines at all punctuation and
to try to keep the width under 70 chars or so.
2014-02-12 18:42:50 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
Matthias Clasen
e2a2d5012e GtkDialog: Make headerbar buttons homogeneous
The buttons in headerbars should be all the same width. Since
GtkHeaderBar doesn't have a homogeneous mode, use a size group
to achieve this.

https://bugzilla.gnome.org/show_bug.cgi?id=723672
2014-02-07 22:36:24 -05:00
William Jon McCann
326da2da58 docs: don't use <anchor> 2014-02-07 15:40:52 -05:00
William Jon McCann
13998c55e7 docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
William Jon McCann
cb6483d382 docs: use apostrophe in *'d 2014-02-07 13:39:53 -05:00
William Jon McCann
fa3f1e1488 docs: use apostrophe in *'ve 2014-02-07 13:38:26 -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
de42376122 Add GTK_STYLE_CLASS_SUGGESTED_ACTION 2014-02-07 10:28:52 -05:00