Commit Graph

550 Commits

Author SHA1 Message Date
Daniel Boles
c662e691ed combobox: Fix documentation typo bx => box 2017-01-21 16:13:44 +00:00
Daniel Boles
802f838aa0 combobox: If typechecking, don’t reference before 2017-01-20 21:08:58 +00:00
Daniel Boles
360fbd0920 combobox: popdown() the menu during unmap()
combo_box_popdown() currently skips popping down our menu if it is NULL.
But the required call to this at end-of-life was in destroy(), by which
point dispose() already NULLed the menu, so Menu::popdown() would never
run, even if it should. Fix this by trying popdown() earlier in unmap().
Also, add a converse assurance that we don’t popup() while not mapped.

Even once we remove all the now-pointless NULL checks, destroy() was the
wrong place to call combo_box_popdown(), and unmap() is the right place.
2017-01-20 13:47:26 +00:00
Daniel Boles
68824e80fd combobox: Remove dead code & unneeded type checks
Commit fdc0c6426b removed the appears-as-
list style property, & hence the ability to put the ComboBox into list
mode – but it left behind a pile of hijinks that were only used in said
mode & so were now doing absolutely nothing. This commit deletes those.

While doing that, I got carried away…so this also stops pointlessly type
checking popup_widget, as that can never be anything but a GtkTreeMenu.
It still checks for NULL everywhere, which shouldn’t be needed, but (A)
this commit is already too big, & (B) simply removing such checks where
they _seem_ unnecessary causes bad times. I’ll puzzle through that later
2017-01-19 23:50:09 +00:00
Daniel Boles
c790724469 combobox: Make wrap-width and grid mode work again
Commit fdc0c6426b for removing (partly!)
appears-as-list also deleted the code that propagated wrap-width to the
TreeMenu and thus put us into “grid mode”. This restores that code.

And as Benjamin noted, calling check_appearance() here is wrong, so bye.
2017-01-19 22:08:45 +00:00
Daniel Boles
94ae322f65 combobox: Avoid a pointless assignment
Don’t get the active item pointer before the grid/non-grid conditional,
because if we’re in grid mode, we re-get it before selecting it anyway.
2017-01-19 03:31:52 +00:00
Daniel Boles
c83ead5eea combobox: Also preselect active item in grid popup
i.e. when wrap-width > 0. This was only being done for non-grid cases.
So, ComboBoxes in grid mode did not indicate their selection when popped
up and required users to keynav from ‘nothing’ (at the top-left) to the
item they wanted to select. By selecting the active item in advance, now
it’s highlighted & acts as the starting point for keynav around the grid
2017-01-19 03:18:08 +00:00
Daniel Boles
e4ede33a65 combobox: Work around popup handler altering model
GtkFileChooserButton installs a handler for the popped-up signal, which
refilters the menu, in order to hide the “(None)” item from the popup
if it was previously selected in the ComboBox. This oddity means that:

 • Until recently, this item would be selected in the menu shell, which
   would then be popped up and change the selection away from that item.
   This was therefore redundant (more on which below!) but benign.

 • After the patch for https://bugzilla.gnome.org/show_bug.cgi?id=771242
   however, this causes a critical assertion fail, as now we stash the
   originally selected item in a pointer so that it can be selected only
   after realisation/popup – but by that stage, the model has just been
   refiltered and the previous pointer no longer refers to a valid item.

This commit works around this problem by, after popping up the menu,
getting the active item again, in case a popped-up handler has gone and
invalidated the pointer to the active item that we saved before popup.

If a handler does this, everything done to find/use the original item is
pointless. But this avoids the ugly critical in FileChooserButton, while
not harming every other ComboBox that doesn’t mess with its model while
popping up (hopefully the vast majority), and it’s very difficult to
imagine a way to check if the active item is /going to/ be hidden later)
2017-01-18 22:24:24 +00:00
Daniel Boles
7a5c995fd4 combobox: Don’t select active item if it’s hidden
I hope no one ever actually brings such a silly item into this world,
but this achieves symmetry with the similar checks immediately after.
2017-01-18 22:24:24 +00:00
Daniel Boles
2e973cedc9 combobox: Move variables into narrowest scopes 2017-01-18 22:24:24 +00:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Timm Bäder
626868c7ba combobox: Remove unused define 2017-01-07 16:15:12 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Piotr Drąg
a2da4ddceb Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2016-12-19 15:08:10 -05:00
Daniel Boles
975a3fa4aa ComboBox: Fix the whitespace fix 2016-12-01 12:59:46 +00:00
Daniel Boles
e723fd6a23 ComboBox: Do not select item before menu realised
For a menu mode CB with wrap_width == 0 and an active item, that item is
selected in gtk_combo_box_menu_popup. Selection causes the MenuShell to
activate and hence take a grab. This was done before the menu was popped
up. A patch distributed in Debian sid - after being proposed on our BZ -
revealed that on the 1st popup of any such ComboBox, within grab_add,
the MenuShell's toplevel's GdkWindow is NULL. This causes a Gdk-CRITICAL
assertion fail on the 1st time opening any such CB, on Debian and if
that patch were merged to GTK+. By selecting after popup, we ensure the
MenuShell is realised before its grab_add and so avoid the critical.

https://bugzilla.gnome.org/show_bug.cgi?id=771242
2016-12-01 12:46:12 +00:00
Daniel Boles
a72dbeba06 ComboBox: Fix whitespace
* Replace tabs for indentation with spaces
 * Remove whitespace at ends of lines
2016-12-01 12:46:12 +00:00
Benjamin Otte
9b6dfa83e2 snapshot: Convert GtkComboBox 2016-11-15 17:48:45 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
fdc0c6426b combobox: Remove appears-as-list style property
Remove all the code handling the appears-as-list=TRUE case.
2016-11-12 08:10:02 +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
Matthias Clasen
579b43b8e8 Convert GtkComboBox to indirect rendering
The removal of the draw method in GtkComboBox reveals another
instance of parent-child invariant violation in GtkComboBoxText.
2016-10-18 11:49:13 +01:00
Timm Bäder
d5e3897052 combobox: Remove deprecated API 2016-10-18 00:29:19 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
f45dadadd0 box: Remove 'padding' child property 2016-10-16 18:17:21 +02:00
Benjamin Otte
4ed9452e90 API: menu: Remove tearoff support 2016-10-16 18:17:21 +02:00
William Hua
83efaaf64a gtkcombobox: pass trigger event when popping up menu
https://bugzilla.gnome.org/show_bug.cgi?id=771242
2016-10-03 09:18:59 -04:00
William Hua
8701e34f74 port to new gtk_menu_popup_at_* () functions
https://bugzilla.gnome.org/show_bug.cgi?id=756579
2016-07-19 09:38:54 -04:00
Stefan Sauer
32675db490 docs: point to suggested api for deprecated functions
We deprecated a bunch of _focus_on_click() functions. Point to the new API
in GtkWidget.
2016-06-09 22:44:44 +02:00
Matthias Clasen
e9a58190af combobox: Stop using screen width/height
Popups should always be placed relative to a monitor.
2016-04-27 23:18:16 -04:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Matthias Clasen
4a5801b902 combobox: Correct the CSS node docs
The box was somehow overlooked in the diagrams.
2016-03-02 15:20:47 -05:00
Benjamin Otte
222c43fc60 combobox: Put child into box
Put the combobox child into the box we added for this purpose. That way,
we don't have to maintain the child's position ourselves anymore.
2016-03-02 13:54:39 +01:00
Benjamin Otte
c3d3bf61e4 combobox: Put the button in a box
This is so we can put the entry into the box in the next commit.
2016-03-02 13:54:39 +01:00
Benjamin Otte
04d9577cb7 combobox: Make sure the cellview expands
Windows theme needs the expansion for correct drawing of the focus
outline.
2016-03-02 13:54:39 +01:00
Benjamin Otte
13b320ecb2 combobox: Ensure an entry gets created for has_entry combos
Previously add/remove on the combobox would result in a cellview being
created.
2016-03-02 13:54:39 +01:00
Timm Bäder
c360b5fb49 Remove more unnecessary redraws
The call to gtk_widget_set_state_flags immediately before these already
queues a redraw/allocate/resize in case they have to be queued.
2016-02-07 19:16:26 +01:00
Matthias Clasen
3c4f36f622 combobox: Avoid a misleading indentation
gcc 6 warns about this sort of thing. There were also some
stray ; here.
2016-01-30 22:50:54 -05:00
Matthias Clasen
e8b9aacfc1 combo: Add .linked class when appropriate
Add the .linked style class to combo boxes which have
an entry, since that is what they are.
2016-01-15 17:55:44 -05:00
Matthias Clasen
54a6e032ca combobox: Document the popup window CSS node 2016-01-15 17:48:39 -05:00
Cosimo Cecchi
23d8791a47 combobox: remove unused struct member
The box was removed a while ago.
2015-12-22 10:53:03 -08:00
Cosimo Cecchi
ef41bd7112 combobox: deprecate shadow-type style property
It does not add any value to what can be achieved through regular CSS
styling.
2015-12-22 09:29:43 -08:00
Cosimo Cecchi
f5628f0439 combobox: port to use a gadget
Wrap the size request and allocate code into a GtkCssCustomGadget. This
makes margins work on GtkComboBox.
2015-12-22 09:29:43 -08:00
Cosimo Cecchi
a90d928a34 combobox: use a private variable when possible
Instead of dereferencing the same variable over and over.
2015-12-22 09:29:43 -08:00
Cosimo Cecchi
f03268eabe combobox: trivial code cleanup 2015-12-22 09:29:43 -08:00
Cosimo Cecchi
ebc7b59b44 combobox: remove unneeded check
The combobox always has a window.
2015-12-22 09:29:43 -08:00
Cosimo Cecchi
5764c09272 combobox: use GtkIcon to render button arrow
We can now use the newly introduced GtkIcon widget to properly render
the arrow in the combobox with CSS.
2015-12-22 09:29:43 -08:00
Carlos Garnacho
26f3d02f03 GtkComboBox: Avoid GdkDeviceManager API
We used to pick a master pointer "at random", use the default seat pointer
instead.
2015-12-16 19:47:06 +01:00
Carlos Garnacho
534b0af512 GtkComboBox: Use gdk_seat_grab()
https://bugzilla.gnome.org/show_bug.cgi?id=759309
2015-12-15 00:32:55 +01:00
Adam Reichold
5088b4937e Fix method to update menu sensitivity of combo box
After removal of the selectable header and separator from the combo box,
the method to update the menu sensitivity must be changed as it assumes
at least two items within each sub menu and contains special handling
for the separator. Removing this fixes bug #759079.
2015-12-07 11:23:18 -05:00
Matthias Clasen
f1b7005ede combobox: Don't add .linked
It interferes with getting the desired styling for combo boxes
with an entry, and is not needed.
2015-11-05 21:59:56 -05:00
Matthias Clasen
92e3655ace combo box: Add diagrams to CSS documentation 2015-11-03 14:27:35 -05:00
Florian Müllner
9a29a2768b Deprecate widget-specific :focus-on-click properties
The differences between the existing properties and the newly added
GtkWidget:focus-on-click property are minimal (different owner_type
in GParamSpec), so it is extremely unlikely that dropping the former
would break anything.

https://bugzilla.gnome.org/show_bug.cgi?id=757269
2015-11-03 07:44:17 -05:00
Matthias Clasen
d229ea3de1 combobox: Use element names
Use combobox as the element name for the main CSS nodes of
GtkComboBox and GtkComboBoxText. Add the .combo style class
to the button and entry. in a GtkComboBox or GtkComboBoxText.
2015-11-02 13:56:25 -05:00
Benjamin Otte
624fb8b360 entry: Always render like with is_cellrenderer
And remove the API to set that variable.
If you want the entry to not fill its whole allocated area,
  gtk_widget_set_valign (entry, GTK_ALIGN_FILL);
will give you the old behavior.
2015-10-28 19:44:26 +01:00
Benjamin Otte
bf95c8462b combobox: Stop using old styling code
Instead of get_path_for_child() use CSS nodes.
2015-09-13 01:54:03 +02:00
Benjamin Otte
2550c6a4db combobox: Refactor cell view treatment
Instead of putting it inside the button manually, put it there properly
by adding a box containing the cell view and the arrow.

Do the same thing in list mode, instead of creating an event box that
tries to behave as a button.
2015-07-31 04:03:44 +02:00
Benjamin Otte
bbd9c59832 combobox: Handle NULLing the cellview on remove simpler 2015-07-31 04:03:44 +02:00
Benjamin Otte
1261ec985b combobox: Remove unused variables 2015-07-31 04:03:44 +02:00
Benjamin Otte
62c43aac43 combobox: Create cell view identically
... in the two places it can be created.
2015-07-31 04:03:44 +02:00
Benjamin Otte
5e2ab6db7f combobox: Use ui file to construct internal button child 2015-07-26 17:18:42 +02:00
Benjamin Otte
5ad5431cb7 combobox: Create button on init() and destroy in destroy()
The button is the same in both menu and list mode, so there's no need to
destroy and recreate it.
2015-07-26 17:18:42 +02:00
Benjamin Otte
e0572212bc combobox: Add scroll support in list mode 2015-07-26 17:18:42 +02:00
Benjamin Otte
8243140731 combobox: Remove unused argument
The visible check is always FALSE, so no need to keep the code around.
2015-07-26 17:18:42 +02:00
Benjamin Otte
63c219b8e7 combobox: Remove the box from the button
... when in menu mode.

Now that we don't have a separator anymore, the box is not needed
anymore.
2015-07-26 17:18:42 +02:00
Benjamin Otte
fcb26376df combobox: Remove the separator
It was a special case and it's not used by themes anymore.

Plus, in the CSS world, if a theme wants a separator, it can just
style the button's border to create one.
2015-07-26 17:18:42 +02:00
Benjamin Otte
3402363684 combobox: Unconditionally draw background and border 2015-07-21 02:28:53 +02:00
Benjamin Otte
5f6db9a182 combobox: Remove autoscroll timer on popdown 2015-07-21 02:28:53 +02:00
Benjamin Otte
19726a5a0e combobox: Remove cell_view_frame
Cell views can draw their own frames now.
2015-07-21 02:28:53 +02:00
Benjamin Otte
8d3bcb6ef8 combobox: Simplify code
We don't add new children to the child's parent, we add them to ourself.
Because guess who a child's parent is?
2015-07-18 05:39:01 +02:00
Benjamin Otte
d071415d56 combobox: Remove unused header function functionality 2015-07-18 05:18:19 +02:00
Benjamin Otte
1ec7f435d8 combobox: Remove unused argument from private function 2015-07-18 05:18:19 +02:00
Matthias Clasen
f16fc99391 combo box: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Benjamin Otte
9744e86e04 combobox: Don't set cell view background
This can be done with CSS these days. Also, these days the background of
cell views is transparent, so it doesn't even have to be done.
2014-10-03 06:18:05 +02:00
Benjamin Otte
b5a8b7ef3b widget: Make _gtk_set_simple_clip() take an optional content clip 2014-08-21 00:54:07 +02: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
f0f9c2aa37 Revert "gtkbin: replace internal api"
This reverts commit 0f4751c08e.

This causes warnings from the notebook and combobox code.
2014-06-16 17:31:56 -04:00
Stefan Sauer
0f4751c08e gtkbin: replace internal api 2014-06-14 08:10:46 +02:00
Matthias Clasen
ec9cf6d7c3 GtkComboBox: Add private api to get the popup
This will be used to make the popup appear in the inspector.
2014-06-10 08:54:12 -04:00
Matthias Clasen
1720eb4713 GtkComboBox: Notify for has-frame and editing-canceled 2014-06-09 13:30:55 -04:00
Matthias Clasen
a27ba44331 GtkComboBox: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:53 -04:00
Carlos Garnacho
246e6cd0b9 combobox: Fix reentrancy in gtk_combo_box_popdown()
If called when already popped down, warnings would be issued due
to priv->grab_pointer being unexpectedly NULL, this would happen
in regular operation when selecting items in appears-as-list mode.

So both add a NULL check for priv->grab_pointer, and bail out early
if the popup window is already hidden.
2014-06-05 21:16:05 +02:00
Evan Nemerson
54ec42f035 gtk: port many nullability annotation fixes from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-30 13:24:20 -07:00
Benjamin Otte
1cbace5f68 combobox: Implement clip 2014-05-24 16:21:02 +02:00
Carlos Garnacho
46b4e5d388 combobox: remove superfluous GTK+ grabs 2014-05-23 19:54:24 +02:00
Matthias Clasen
9a127d364f Drop GtkArrow use in GtkComboBox
This is in preparation for GtkArrow getting deprecated.
https://bugzilla.gnome.org/show_bug.cgi?id=729564
2014-05-13 23:50:12 -04:00
Benjamin Otte
a89c598617 combobox: Add workaround so evolution doesn't crash
Removing the NULL checks in 7f60cab47d
caused evolution to crash. It chains up with NULL and that used to work.

This patch should be reverted for GTK 4.0.

https://bugzilla.gnome.org/show_bug.cgi?id=729496
2014-05-05 15:53:03 +02:00
Cosimo Cecchi
7f60cab47d combobox: fix a segfault
Don't dereference a NULL pointer.
2014-05-01 19:44:12 +02:00
Benjamin Otte
7455ab72f8 combobox: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:27 +02:00
Bastien Nocera
f71f7215ab all: Name more idles and timeouts
Following up from 438cd857c4,
name more timeouts and idles.

The original grep was missing checking for gdk_threads_add_*()
functions (at least for some of the files).

https://bugzilla.gnome.org/show_bug.cgi?id=726870
2014-03-26 20:09:30 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -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
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
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
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
a22358c0c0 docs: use ` instead of <literal> 2014-02-04 18:24:29 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00