[gnome-builder] help: update headerbar docs
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] help: update headerbar docs
- Date: Tue, 12 Mar 2019 23:53:49 +0000 (UTC)
commit 752b722c19218eeb0ba2bf3a95f732e70583f2a0
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 12 15:49:03 2019 -0700
help: update headerbar docs
doc/help/plugins/workbench/headerbar.rst | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/doc/help/plugins/workbench/headerbar.rst b/doc/help/plugins/workbench/headerbar.rst
index 94e34ca48..1d355fcc6 100644
--- a/doc/help/plugins/workbench/headerbar.rst
+++ b/doc/help/plugins/workbench/headerbar.rst
@@ -1,31 +1,37 @@
Adding Widgets to the Header Bar
================================
-You might want to add a button to the workbench header bar.
-To do this, use an ``Ide.WorkbenchAddin`` and fetch the header bar using ``Ide.Workbench.get_headerbar()``.
+You might want to add a button to the workspace header bar.
+To do this, use an ``Ide.WorkspaceAddin`` and fetch the header bar using ``Ide.Workspace.get_headerbar()``.
You can attach your widget to either the left or the right side of the ``Ide.OmniBar`` in the center of the
header bar.
-Additionally, by specifying a ``Gtk.PackType``, you can align the button within the left or right of the
header bar.
-We suggest using ``Gio.SimpleAction`` to attach an action to the workbench and then activating the action
using the ``Gtk.Button:action-name`` property.
+We suggest using ``Gio.SimpleAction`` to attach an action to the workspace and then activating the action
using the ``Gtk.Button:action-name`` property.
.. code-block:: python3
- :caption: Adding a button to the workbench header bar
+ :caption: Adding a button to the workspace header bar
import gi
- from gi.repository import GObject
- from gi.repository import Ide
+ from gi.repository import GObject, Ide
- class MyWorkbenchAddin(GObject.Object, Ide.WorkbenchAddin):
+ class MyWorkspaceAddin(GObject.Object, Ide.WorkspaceAddin):
- def do_load(self, workbench):
- headerbar = workbench.get_headerbar()
+ def do_load(self, workspace):
+ headerbar = workspace.get_headerbar()
# Add button to top-center-left
self.button = Gtk.Button(label='Click', action_name='win.hello', visible=True)
- headerbar.insert_left(self.button, Gtk.PackType.PACK_END, 0)
+ headerbar.add_center_left(self.button)
- def do_unload(self, workbench):
+ # Add button to left
+ self.button = Gtk.Button(label='Click', action_name='win.hello', visible=True)
+ headerbar.add_primary(self.button)
+
+ # Add button to right
+ self.button = Gtk.Button(label='Click', action_name='win.hello', visible=True)
+ headerbar.add_secondary(self.button)
+
+ def do_unload(self, workspace):
# remove the button we added
self.button.destroy()
self.button = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]