Commit Graph

362 Commits

Author SHA1 Message Date
Timm Bäder
9f86cb2b4e treeviewcolumn: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Matthias Clasen
750341414d Revert "treeviewcolumn: Stop using GtkWidget::event"
This reverts commit da74314779.

Turns out we'll keep ::event, so this was misguided.
2018-01-02 18:14:04 -05:00
Matthias Clasen
da74314779 treeviewcolumn: Stop using GtkWidget::event
This signal is going away.
2017-12-30 22:27:54 -05:00
Matthias Clasen
dbfaa99107 image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.

Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
f31a51a1c8 treeview: Pass height to allocate as argument
Instead of exporting a function to query it.
2017-11-13 01:28:16 +01:00
Daniel Boles
497e877755 TreeViewCol: Fix SEGV on remove/add, + memory leak
Nulling priv->button in _unset_tree_view() is asymmetrical: we create
it via init(), not _set_tree_view(), so we shouldn’t null in the latter.

Worse, doing so manifests in criticals + a SEGV easily with basic use of
testtreecolumns, removing the TVC from a TV then trying to add it to one

Finally, the wrong null-out meant dispose() failed to unref the button,
so it leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=728452
https://bugzilla.gnome.org/show_bug.cgi?id=788614
2017-10-07 00:46:37 +01:00
Daniel Boles
af28c031fc TreeViewCol: Don’t try to disconnect null treeview
https://bugzilla.gnome.org/show_bug.cgi?id=788614
2017-10-07 00:46:37 +01:00
Daniel Boles
161b063909 Revert "treeviewcolumn: Don't leak button"
This reverts commit 2c28c627c1.

See following commits: the real problem is setting priv->button to NULL
soon after this, so this just makes that wrong decision look more right.

https://bugzilla.gnome.org/show_bug.cgi?id=788614
2017-10-07 00:45:40 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
f7d02bfb61 treeviewcolumn: Don't swallow motion/crossing events
If the column is not clickable, it may make some sense to stop
event propagation here for button events. However motion events
should be left alone.

Fixes treeview column resize pointer cursors, since that's
implemented up the bubbling phase in the treeview.
2017-10-06 18:25:44 +02:00
Timm Bäder
2c28c627c1 treeviewcolumn: Don't leak button
We g_object_ref_sink the button in _create_button, so we need to unref
it ourselves.
2017-10-06 17:23:34 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Matthias Clasen
208a85c3fe treev view column: Use GdkEvent API 2017-09-19 18:39:03 +02:00
Carlos Garnacho
14a28224e4 treeview: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
d836fa5134 treeviewcolumn: Remove input window 2017-07-19 21:27:16 -04:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Carlos Garnacho
6c47938b00 gtktreeview: Remove header window
It is no longer necessary to overlay the column headers above the
treeview.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
cfd5a76ece gtktreeview: Remove widget window
It can be entirely replaced by setting a proper clip rectangle.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
c92b7d4224 box: Remove fill child property
GtkWidget:halign and GtkWidget:valign are sufficient
2017-04-25 20:30:37 +02:00
Timm Bäder
5729ea7744 box: Remove expand child property
GtkWidget already has hexpand/vexpand properties.
2017-04-25 20:30:37 +02:00
Timm Bäder
bd86af4e15 treeviewcolumn: Use gtk_widget_measure to measure widget sizes 2017-03-05 09:24:41 +01:00
Timm Bäder
56a58655fe Remove unnecessary gtk_widget_show calls 2017-01-22 14:38:21 +01:00
Benjamin Otte
0efeaf9508 treeview: Port rest of stuff to snapshot()
The only thing still drawn with Cairo are grid lines.
2016-12-22 03:37:32 +01:00
Timm Bäder
dece018994 Remove GtkAlignment 2016-10-18 00:29:19 +02:00
Benjamin Otte
8417ecd602 treeviewcolumn: Use gdk_window_new_input() 2016-10-18 00:22:35 +02:00
Timm Bäder
f45dadadd0 box: Remove 'padding' child property 2016-10-16 18:17:21 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Benjamin Otte
fcbd480c76 API: Remove GDK_WA_CURSOR
The cursor was set using gdk_window_set_cursor() even in
gdk_window_new().

So instead of having yet another flag, just make the users of that flag
call gdk_window_set_cursor() directly after the window was created.
2016-10-16 18:17:21 +02:00
Christian Hergert
3c775eb2b8 treeviewcolumn: use g_clear_object when freeing cursor
There is the chance that the cursor returned NULL on systems
with missing cursors. This defensively handles that by checking
for a NULL cursor.
2016-09-27 12:41:55 -07:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02: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
Benjamin Otte
983de6f4a0 treeview: Use a cssnode instead of regions
This makes Treeview headers work again like before region support was
removed.
2015-10-22 16:42:47 +02:00
Benjamin Otte
20ce0588b1 treeviewcolumn: Create button on init
This way, the button is always available and the code doesn't have to
special case this condition.
2015-10-22 16:42:46 +02:00
Matthias Clasen
c60362ab10 tree view column: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:37 -04:00
Matthias Clasen
5c2759af3c Use standard cursor names
This changes GTK+ to use gdk_cursor_new_from_name() with the
'standard' css names, instead of GdkCursorType.

https://bugzilla.gnome.org/show_bug.cgi?id=652085
2015-07-26 01:45:06 -04:00
Matthias Clasen
fa3ff773be GtkTreeViewColumn: Fix a documentation typo 2015-07-04 00:29:26 -04:00
Matthias Clasen
eea16f03f5 Stop using GDK_POINTER_MOTION_HINT_MASK in widgets
It is deprecated and no longer needed, and,as observed in
https://bugzilla.gnome.org/show_bug.cgi?id=746253 it
interferes with turning off event compression.
2015-03-22 17:33:38 -04:00
Matthias Clasen
bce5a0f1a1 GtkTreeViewColumn: a better way to avoid overlap
The overlap was caused by using pack-end for the arrow, which
causes it to be allocated from the other end. Avoid the problem
by using pack-start for both the title and the arrow, and
reordering them according to xalign.
2014-07-10 15:21:17 -04:00
Matthias Clasen
4aa649e9cd GtkTreeView: Avoid overlapping sort indicator
Hide the sort indicator when it would overlap the column title.
2014-07-10 14:22:59 -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
Carlos Garnacho
b8886436b3 treeviewcolumn: Avoid a device position query
This happens in an event handler, and the button event should be
expected to have the right coordinates on the event window already.
2014-06-11 17:36:03 +02:00
Matthias Clasen
785e4d376e GtkTreeViewColumn: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:13 -04:00
Matthias Clasen
a3cd0ee7d8 Revert "Use minimum/natural size semantics"
This reverts commit 6d53c2339f.

https://bugzilla.gnome.org/show_bug.cgi?id=731054 showed some
major regressions caused by this commit.
2014-06-01 10:20:08 -04:00
Evan Nemerson
9db729f5a6 gtk: fix several out argument annotations
These mostly just switch from allow-none to optional, nullable, or
both, as necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:33 -07:00
Evan Nemerson
e568903360 gtk: fix many callback annotations to include closure information
Without this information introspection-based consumers don't realize
they can include context information, but instead think that they
receive an extra gpointer argument (which they don't know how to
handle).

https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:32 -07:00
Matthias Clasen
04703689b8 Deprecate GtkAligment
This has been dangling ever since 3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=645781
2014-05-23 20:31:25 -04:00
Matthias Clasen
4f830fb117 treeview: Don't show missing images
When a model is sortable, but the the column is not currently used
for sorting, we want to reserve the space for showing the sort
indicator. But we currently set the icon to 'missing-image', which
is not great to show all over the place. So, just set the opacity
to 0.
2014-05-17 15:32:54 -04:00
Matthias Clasen
57feff4e14 Drop GtkArrow use in GtkTreeViewColumn
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
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00