Commit Graph

483 Commits

Author SHA1 Message Date
Cosimo Cecchi
c1218f964a notebook: restore previous behaviour wrt. unparenting of tab labels
When the tab label gets removed from the notebook on widget
desctruction, we should still unconditionally unparent it from the
notebook, since failing to do so will keep a stray reference alive.

In case applications rely on the tab label being destroyed to release
other references (e.g. because the tab label is a custom object, or
another object's lifecycle is tied to it using g_object_set_data_full()),
this will also possibly cause other references to get leaked.
In Nautilus, the result was we were failing to release the reference to
a NautilusWindowSlot, and other parts of the application relied
on it being destroyed at a specific time instead, causing the
application to crash when closing a window.

This is a regression from commit
325cf071d1.

This commit restores the previous unparenting behavior in case we're not
in a DnD operation.

https://bugzilla.gnome.org/show_bug.cgi?id=680349
2012-07-31 20:17:54 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Matthias Clasen
cea4b80096 Fix a compiler warning
This was introduced in the previous commit.
2012-06-23 13:07:47 -04:00
Matthias Clasen
3056324570 GtkNotebook: Fix reverse tab order
When using Shift-Tab to move the focus out of page content onto
the tab label, we end up in a situation where both Tab and Shift-Tab
move focus back into the page, which is not really what is expected
when the notebook is part of a dialog.

Instead, arrange things so that using Shift-Tab with focus on a
tab label moves the focus out of the notebook.

http://bugzilla.gnome.org/show_bug.cgi?id=669986
2012-06-23 12:37:20 -04:00
Matthias Clasen
325cf071d1 GtkNotebook: Maintain invariants during tab dnd
It turns out that we can end up removing a notebook child while
the tab is still 'detached'. Child removal causes
gtk_notebook_remove_tab_label() to be called on the tab label,
but that function did not deal with the eventuality that the tab
label may be a child of the dnd window.

http://bugzilla.gnome.org/show_bug.cgi?id=677943
2012-06-23 10:04:14 -04:00
Cosimo Cecchi
10a4771ae3 notebook: fix size requisition for the initial_gap style property
This is probably going to be replaced by something different soon, but
in the meantime, fix this annoying bug, visible e.g. in widget-factory
for left/right tab examples.
2012-05-30 18:02:42 -04:00
Matthias Clasen
d44edc1f7d Revert "WIP: make GtkNotebook window-draggable"
This reverts commit b3a66c59ad.
2012-04-28 02:06:37 -04:00
Diego Escalante Urrelo
b3a66c59ad WIP: make GtkNotebook window-draggable
https://bugzilla.gnome.org/show_bug.cgi?id=672427

https://bugzilla.gnome.org/show_bug.cgi?id=674587
2012-04-28 02:01:16 -04:00
Benjamin Otte
ece9d2fd92 gtk: Make widget only invalidate widget positions
Instead of resetting them completely
2012-04-17 08:59:10 +02:00
Benjamin Otte
461803e407 gtk: Get gtkwidgetpath.h includes out of the public headers
and include them in the C files instead.
2012-03-19 02:26:16 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Claudio Saavedra
cfe65a0d6c GtkNotebook: and another fix
https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-16 12:33:26 +02:00
Claudio Saavedra
ccf7867c35 GtkNotebook: fix one child-notify emission
Forgot to increase the counter in the for loop, doing it now.

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-16 12:28:46 +02:00
Claudio Saavedra
347328adb0 GtkNotebook: emit child-notify::position on drag 'n drop reorder
https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-15 01:05:12 +02:00
Claudio Saavedra
cb775a6a6d GtkNotebook: emit child-notify::position on page add/removal
For each page added/removed, notify all the other children changing
position.

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-15 01:05:12 +02:00
Claudio Saavedra
e2339f5ebd GtkNotebook: emit child-notify::position a few more times
When moving a page around, all children changing their position
need to be notified.

There are still other places where proper notification is missing
(drag 'n drop, etc.)

https://bugzilla.gnome.org/show_bug.cgi?id=669116
2012-02-10 16:39:44 +02:00
Carlos Garcia Campos
594903ecde gtknotebook: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Cosimo Cecchi
637e6688da notebook: fixup previous commit
Oops, I hit push too early.
2012-01-18 16:14:31 -05:00
Cosimo Cecchi
70cf23a729 notebook: don't force ACTIVE state flag on the label for active tab
This is just wrong, since it's not the tab label being active, but the
tab itself.
2012-01-18 16:13:25 -05:00
Matthias Clasen
cf172a5873 Revert "GtkNotebook: fix crash when DnD tabs between windows"
This reverts commit eeb9de80e1.
2012-01-15 18:54:05 -05:00
Xan Lopez
eeb9de80e1 GtkNotebook: fix crash when DnD tabs between windows
When doing DnD between windows the tab label is set as the child of
the DnD info window. If this is happening the remove method of
GtkNotebook should not unparent the tab label, since it's been already
unparented, belongs to the DnD window and will be properly destroyed
when the DnD is over.

https://bugzilla.gnome.org/show_bug.cgi?id=639875
2012-01-04 08:48:46 +01:00
Rui Matos
8b444d1c03 notebook: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Matthias Clasen
d978ed85ae Remove an unused variable 2011-12-05 18:07:41 -05:00
Carlos Garnacho
029a884d9e gtk,notebook: Invalidate the gap side when reordering tabs
This narrow area is invalidated so the gap follows the tab
being reordered.
2011-12-05 21:23:23 +01:00
Alexander Larsson
fd06890354 notebook: Make the tab reordering dnd window transparent 2011-12-05 21:15:06 +01:00
Cosimo Cecchi
79bbce5577 notebook: use the current page allocation when computing the redraw area
Instead of taking the first page and trying to adjust the rect with
random padding values, take the current page, as it's always guaranteed
to be at least as tall as inactive tabs.
This fixes some annoying 1px drawing artifacts while switching tabs when
the theme disables notebook padding.

https://bugzilla.gnome.org/show_bug.cgi?id=664494
2011-11-21 14:19:36 -05:00
Cosimo Cecchi
f01162c727 notebook: properly subtract the initial_gap width from the tab space
Instead of modifying the allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=664494
2011-11-21 14:19:36 -05:00
Cosimo Cecchi
009224a80e notebook: make sure to allocate the CSS border width
Instead of taking only the CSS padding into account when allocating the
notebook children, also allocate the border width.

https://bugzilla.gnome.org/show_bug.cgi?id=664342
2011-11-20 16:03:31 -05:00
Michael Natterer
0308352417 notebook: don't leak the action widgets
The notebook owns them, so it must destroy them in destroy().
(cherry picked from commit 87ebfb19fd)
2011-11-17 01:07:37 +01:00
Cosimo Cecchi
ccdc3c1802 notebook: update tab area allocation when switching page
When the active page is switched, it's important
gtk_notebook_pages_allocate() is called after the bulk of
gtk_notebook_real_switch_page() is run, as the former allocates a
different space according to the currently active tab, which is set by
the latter.
gtk_notebook_pages_allocate() already calls gtk_notebook_redraw_tabs()
when the allocation changes, so just move its call down to
gtk_notebook_real_switch_page() to fix the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=662629
2011-10-24 13:19:39 -04:00
Cosimo Cecchi
bdfa05bc81 notebook: don't forget to prepare the tab style context before drawing
The previous commit a9affcdd3f
accidentally removed the call to notebook_tab_prepare_style_context()
2011-09-29 01:49:55 -04:00
Benjamin Otte
a9affcdd3f notebook: Remove unused variables 2011-09-29 04:24:02 +02:00
Cosimo Cecchi
63124e81b6 notebook: vborder/hborder deprecations are Since: 3.4, not 3.2 2011-09-27 13:46:01 -04:00
Cosimo Cecchi
c2f5d3d8b0 notebook: add top/bottom/left/right style classes to the tab region
When we use the style context to get information for the tab region,
also add a style class to indicate its position, so that the relevant
information is pulled off from the theme.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
d6a58e5bd3 notebook: unconditionally apply padding to the tab content
Not only when on left or top, otherwise the other position look
off-centered.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
34ee6d08bb notebook: really deprecate tab_vborder and tab_hborder
The setter for this was deprecated in 2.x and removed in 3.0.
I don't see any reason why we should hardcode 2px for this value;
instead, deprecated the getter and make it always return zero, and stop
using the variables internally.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
2500a95fad notebook: allow using different padding values for the active tab state
The code before was basically adding and removing the same padding value
in two different places during the allocation cycle.
Instead, what we want to do is to offset the inactive tab allocation by
the difference with the active tab padding, to ensure the tab content is
always drawn centered and in the right position.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
d4f83cdfb6 notebook: use the current state to get the padding values
We want to enable the use of different padding values between active and
inactive tabs, so that the two are completely separated (but limited by
the active tab size).
This way themes can decide how bigger the active tab is drawn compared
to the normal one just specifying a different padding value from the
CSS, like this:

.notebook tab {
  padding: 2;
}

.notebook tab:active {
  padding: 4;
}

As a first step, fetch the padding values with the right state flags
from GtkStyleContext.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Benjamin Otte
e11e51c252 notebook: Fix child property setters causing underallocations
Don't randomly allocate around, queue resizes instead.
2011-08-27 02:47:51 +02:00
Colin Walters
c8fdd5e847 Squash two compilation warnings about possibly-uninitialzed 2011-08-25 14:47:21 -04:00
Paolo Borelli
508353fd15 Do not manually create empty label
gtk_notebook_update_labels will take care of creating it if needed.
2011-08-15 15:08:28 +02:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Benjamin Otte
ebadb36962 notebook: Remove unused private member variable 2011-07-20 02:36:44 +02:00
Benjamin Otte
1cdb47d960 notebook: Remove the homogenous private member variable
It's unused and therefor always FALSE, so we can remove the parts of the
code that branch based on it.
2011-07-19 12:53:06 +02:00
Matthias Clasen
318192b937 Convert GailNotebook to GtkNotebookAccessible 2011-07-05 16:08:56 -04:00
Paolo Borelli
399de11116 Speed up page insertion
Make sure to call widget_set_child_visible(false) on all tabs except the
current before calling widget_set_parent.
2011-06-26 20:41:21 +02:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Benjamin Otte
a6daba5e78 API: Change semantics of gtk_container_get_child_path()
Include the child widget path in the returned path now. This allows
customizing the path of the current widgets - like adding flags to child
widgets (and maybe siblings in the future).
2011-06-02 02:03:50 +02:00