Commit 04a48164 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko
Browse files

Add AdwTabOverview

parent 792afd28
......@@ -200,6 +200,8 @@ content_images = [
"images/tab-bar-inline-dark.png",
"images/tab-button.png",
"images/tab-button-dark.png",
"images/tab-overview.png",
"images/tab-overview-dark.png",
"images/toast-action.png",
"images/toast-action-dark.png",
"images/toast-overlay.png",
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<object class="AdwWindow" id="widget">
<property name="title">Tab Bar</property>
<property name="default-width">600</property>
<property name="default-height">480</property>
<property name="content">
<object class="AdwTabOverview">
<property name="view">view</property>
<property name="open">True</property>
<property name="enable-new-tab">True</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkHeaderBar"/>
</child>
<child>
<object class="AdwTabView" id="view">
<property name="vexpand">True</property>
<child>
<object class="AdwTabPage">
<property name="title">Page 1</property>
<property name="child">
<object class="AdwBin">
<style>
<class name="overview-tab-page"/>
</style>
</object>
</property>
</object>
</child>
<child>
<object class="AdwTabPage">
<property name="title">Page 2</property>
<property name="child">
<object class="AdwBin"/>
</property>
</object>
</child>
<child>
<object class="AdwTabPage">
<property name="title">Page 3</property>
<property name="child">
<object class="AdwBin"/>
</property>
</object>
</child>
<child>
<object class="AdwTabPage">
<property name="title">Page 4</property>
<property name="child">
<object class="AdwBin"/>
</property>
</object>
</child>
<child>
<object class="AdwTabPage">
<property name="title">Page 5</property>
<property name="child">
<object class="AdwBin"/>
</property>
</object>
</child>
<child>
<object class="AdwTabPage">
<property name="title">Page 6</property>
<property name="child">
<object class="AdwBin"/>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</interface>
......@@ -19,6 +19,7 @@ typedef struct {
GdkPaintable *paintable;
char *name;
GtkCssProvider *provider;
GtkCssProvider *provider_dark;
} ScreenshotData;
static void
......@@ -27,6 +28,7 @@ screenshot_data_free (ScreenshotData *data)
g_object_unref (data->paintable);
gtk_window_destroy (GTK_WINDOW (gtk_widget_get_root (data->widget)));
g_object_unref (data->provider);
g_clear_object (&data->provider_dark);
g_free (data->name);
g_free (data);
}
......@@ -216,6 +218,10 @@ take_screenshot (const char *name,
data->paintable = gtk_widget_paintable_new (data->widget);
data->name = g_file_get_path (output_file);
data->provider = load_css ("style");
if (dark)
data->provider_dark = load_css ("style-dark");
if (hover_widget)
data->hover_widget = GTK_WIDGET (hover_widget);
......
......@@ -4,5 +4,6 @@
<file preprocess="xml-stripblanks">icons/scalable/apps/org.gnome.Boxes.svg</file>
<file compressed="true">style.css</file>
<file compressed="true">style-dark.css</file>
</gresource>
</gresources>
.overview-tab-page {
background: linear-gradient(to bottom right, @blue_5, @green_5 80%);
}
......@@ -12,3 +12,7 @@
color: @warning_fg_color;
background-color: @warning_bg_color;
}
.overview-tab-page {
background: linear-gradient(to bottom right, @blue_1 25%, @green_1);
}
......@@ -140,6 +140,11 @@ Slug: visual-index
<img src="tab-bar.png" alt="tab-bar">
</picture>](class.TabBar.html)
[<picture>
<source srcset="tab-overview-dark.png" media="(prefers-color-scheme: dark)">
<img src="tab-overview.png" alt="tab-overview">
</picture>](class.TabOverview.html)
[<picture>
<source srcset="tab-button-dark.png" media="(prefers-color-scheme: dark)">
<img src="tab-button.png" alt="tab-button">
......
/*
* Copyright (C) 2020-2022 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Author: Alexander Mikhaylenko <alexander.mikhaylenko@puri.sm>
*/
#pragma once
#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
#error "Only <adwaita.h> can be included directly."
#endif
#include <gtk/gtk.h>
#include "adw-tab-thumbnail-private.h"
#include "adw-tab-view.h"
G_BEGIN_DECLS
#define ADW_TYPE_TAB_GRID (adw_tab_grid_get_type())
G_DECLARE_FINAL_TYPE (AdwTabGrid, adw_tab_grid, ADW, TAB_GRID, GtkWidget)
void adw_tab_grid_set_view (AdwTabGrid *self,
AdwTabView *view);
void adw_tab_grid_attach_page (AdwTabGrid *self,
AdwTabPage *page,
int position);
void adw_tab_grid_detach_page (AdwTabGrid *self,
AdwTabPage *page);
void adw_tab_grid_select_page (AdwTabGrid *self,
AdwTabPage *page);
void adw_tab_grid_try_focus_selected_tab (AdwTabGrid *self,
gboolean animate);
gboolean adw_tab_grid_is_page_focused (AdwTabGrid *self,
AdwTabPage *page);
void adw_tab_grid_setup_extra_drop_target (AdwTabGrid *self,
GdkDragAction actions,
GType *types,
gsize n_types);
gboolean adw_tab_grid_get_inverted (AdwTabGrid *self);
void adw_tab_grid_set_inverted (AdwTabGrid *self,
gboolean inverted);
AdwTabThumbnail *adw_tab_grid_get_transition_thumbnail (AdwTabGrid *self);
void adw_tab_grid_set_visible_range (AdwTabGrid *self,
double lower,
double upper,
double page_size);
void adw_tab_grid_adjustment_shifted (AdwTabGrid *self,
double delta);
double adw_tab_grid_get_scrolled_tab_y (AdwTabGrid *self);
void adw_tab_grid_reset_scrolled_tab (AdwTabGrid *self);
void adw_tab_grid_scroll_to_page (AdwTabGrid *self,
AdwTabPage *page,
gboolean animate);
void adw_tab_grid_set_hovering (AdwTabGrid *self,
gboolean hovering);
void adw_tab_grid_set_search_terms (AdwTabGrid *self,
const char *terms);
gboolean adw_tab_grid_get_empty (AdwTabGrid *self);
gboolean adw_tab_grid_focus_first_row (AdwTabGrid *self,
int column);
gboolean adw_tab_grid_focus_last_row (AdwTabGrid *self,
int column);
void adw_tab_grid_focus_page (AdwTabGrid *self,
AdwTabPage *page);
int adw_tab_grid_measure_height_final (AdwTabGrid *self,
int for_width);
G_END_DECLS
This diff is collapsed.
/*
* Copyright (C) 2022 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Author: Alexander Mikhaylenko <alexander.mikhaylenko@puri.sm>
*/
#pragma once
#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
#error "Only <adwaita.h> can be included directly."
#endif
#include "adw-tab-overview.h"
#include "adw-tab-grid-private.h"
G_BEGIN_DECLS
AdwTabGrid *adw_tab_overview_get_tab_grid (AdwTabOverview *self);
AdwTabGrid *adw_tab_overview_get_pinned_tab_grid (AdwTabOverview *self);
G_END_DECLS
This diff is collapsed.
/*
* Copyright (C) 2021-2022 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*
* Author: Alexander Mikhaylenko <alexander.mikhaylenko@puri.sm>
*/
#pragma once
#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
#error "Only <adwaita.h> can be included directly."
#endif
#include "adw-version.h"
#include <gtk/gtk.h>
#include "adw-tab-view.h"
G_BEGIN_DECLS
#define ADW_TYPE_TAB_OVERVIEW (adw_tab_overview_get_type())
ADW_AVAILABLE_IN_1_3
G_DECLARE_FINAL_TYPE (AdwTabOverview, adw_tab_overview, ADW, TAB_OVERVIEW, GtkWidget)
ADW_AVAILABLE_IN_1_3
GtkWidget *adw_tab_overview_new (void) G_GNUC_WARN_UNUSED_RESULT;
ADW_AVAILABLE_IN_1_3
AdwTabView *adw_tab_overview_get_view (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_view (AdwTabOverview *self,
AdwTabView *view);
ADW_AVAILABLE_IN_1_3
GtkWidget *adw_tab_overview_get_child (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_child (AdwTabOverview *self,
GtkWidget *child);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_open (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_open (AdwTabOverview *self,
gboolean open);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_inverted (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_inverted (AdwTabOverview *self,
gboolean inverted);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_enable_search (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_enable_search (AdwTabOverview *self,
gboolean enable_search);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_search_active (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_enable_new_tab (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_enable_new_tab (AdwTabOverview *self,
gboolean enable_new_tab);
ADW_AVAILABLE_IN_1_3
GMenuModel *adw_tab_overview_get_secondary_menu (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_secondary_menu (AdwTabOverview *self,
GMenuModel *secondary_menu);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_show_start_title_buttons (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_show_start_title_buttons (AdwTabOverview *self,
gboolean show_start_title_buttons);
ADW_AVAILABLE_IN_1_3
gboolean adw_tab_overview_get_show_end_title_buttons (AdwTabOverview *self);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_set_show_end_title_buttons (AdwTabOverview *self,
gboolean show_end_title_buttons);
ADW_AVAILABLE_IN_1_3
void adw_tab_overview_setup_extra_drop_target (AdwTabOverview *self,
GdkDragAction actions,
GType *types,
gsize n_types);
G_END_DECLS
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="AdwTabOverview" parent="GtkWidget">
<child>
<object class="AdwBin" id="child_bin"/>
</child>
<child>
<object class="GtkBox" id="overview">
<property name="orientation">vertical</property>
<property name="can-focus">False</property>
<property name="can-target">False</property>
<style>
<class name="background"/>
<class name="overview"/>
<class name="scrolled-to-top"/>
</style>
<child>
<object class="AdwHeaderBar" id="header_bar">
<child type="start">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">edit-find-symbolic</property>
<property name="tooltip-text" translatable="yes">Search Tabs</property>
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle" id="title">
<style>
<class name="numeric"/>
</style>
</object>
</property>
<child type="end">
<object class="GtkMenuButton" id="secondary_menu_button">
<property name="visible">False</property>
<property name="icon-name">view-more-symbolic</property>
<property name="primary">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
<property name="key-capture-widget">overview</property>
<property name="child">
<object class="AdwClamp">
<property name="hexpand">True</property>
<property name="maximum-size">400</property>
<property name="child">
<object class="GtkSearchEntry" id="search_entry">
<property name="hexpand">True</property>
<property name="placeholder-text" translatable="yes">Search tabs</property>
<signal name="search-changed" handler="search_changed_cb" swapped="yes"/>
<signal name="stop-search" handler="stop_search_cb" swapped="yes"/>
</object>
</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkOverlay">
<property name="vexpand">True</property>
<property name="child">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="AdwTabOverviewScrollable" id="scrollable">
<property name="overview">overview</property>
<property name="new-button">new_tab_button</property>
<property name="pinned-grid">
<object class="AdwTabGrid" id="pinned_grid">
<property name="pinned">True</property>
<property name="tab-overview">AdwTabOverview</property>
<signal name="extra-drag-drop" handler="extra_drag_drop_cb" swapped="yes"/>
<signal name="notify::empty" handler="empty_changed_cb" swapped="yes"/>
</object>
</property>
<property name="grid">
<object class="AdwTabGrid" id="grid">
<property name="tab-overview">AdwTabOverview</property>
<signal name="extra-drag-drop" handler="extra_drag_drop_cb" swapped="yes"/>
<signal name="notify::empty" handler="empty_changed_cb" swapped="yes"/>
</object>
</property>
</object>
</property>
</object>
</property>
<child type="overlay">
<object class="AdwStatusPage" id="empty_state">
<property name="visible">False</property>
<property name="can-target">False</property>
<property name="can-focus">False</property>
<property name="icon-name">view-grid-symbolic</property>
<property name="title" translatable="yes">No Open Tabs</property>
<layout>
<property name="measure">True</property>
<property name="clip-overlay">True</property>
</layout>
</object>
</child>
<child type="overlay">
<object class="AdwStatusPage" id="search_empty_state">
<property name="visible">False</property>
<property name="can-target">False</property>
<property name="can-focus">False</property>
<property name="icon-name">edit-find-symbolic</property>
<property name="title" translatable="yes">No Tabs Found</property>
<property name="description" translatable="yes">Try a different search.</property>
<layout>
<property name="measure">True</property>
<property name="clip-overlay">True</property>
</layout>
</object>
</child>
<child type="overlay">
<object class="GtkButton" id="new_tab_button">
<property name="visible">False</property>
<property name="halign">center</property>
<property name="valign">end</property>
<signal name="clicked" handler="new_tab_clicked_cb" swapped="yes"/>
<layout>
<property name="measure">True</property>
<property name="clip-overlay">True</property>
</layout>
<property name="child">
<object class="AdwButtonContent">
<property name="icon-name">tab-new-symbolic</property>
<property name="label" translatable="yes">New _Tab</property>
<property name="use-underline">True</property>
</object>
</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
<class name="new-tab-button"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
/*
* Copyright (C) 2022 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* Author: Alexander Mikhaylenko <alexander.mikhaylenko@puri.sm>
*/
#pragma once
#if !defined(_ADWAITA_INSIDE) && !defined(ADWAITA_COMPILATION)
#error "Only <adwaita.h> can be included directly."
#endif
#include <gtk/gtk.h>
#include "adw-tab-view.h"
G_BEGIN_DECLS
#define ADW_TYPE_TAB_THUMBNAIL (adw_tab_thumbnail_get_type())
G_DECLARE_FINAL_TYPE (AdwTabThumbnail, adw_tab_thumbnail, ADW, TAB_THUMBNAIL, GtkWidget)
AdwTabThumbnail *adw_tab_thumbnail_new (AdwTabView *view,
gboolean pinned) G_GNUC_WARN_UNUSED_RESULT;
AdwTabPage *adw_tab_thumbnail_get_page (AdwTabThumbnail *self);
void adw_tab_thumbnail_set_page (AdwTabThumbnail *self,
AdwTabPage *page);
gboolean adw_tab_thumbnail_get_inverted (AdwTabThumbnail *self);
void adw_tab_thumbnail_set_inverted (AdwTabThumbnail *self,
gboolean inverted);
void adw_tab_thumbnail_setup_extra_drop_target (AdwTabThumbnail *self,
GdkDragAction actions,
GType *types,
gsize n_types);
GtkWidget *adw_tab_thumbnail_get_thumbnail (AdwTabThumbnail *self);
void adw_tab_thumbnail_fade_out (AdwTabThumbnail *self);
void adw_tab_thumbnail_fade_in (AdwTabThumbnail *self);
G_END_DECLS
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="libadwaita">
<requires lib="gtk" version="4.0"/>
<template class="AdwTabThumbnail" parent="GtkWidget">
<child>
<object class="GtkDropTarget" id="drop_target">
<signal name="drop" handler="drop_cb" swapped="true"/>
</object>
</child>
<child>
<object class="GtkBox" id="contents">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="vexpand">False</property>
<child>
<object class="GtkOverlay">
<style>
<class name="thumbnail"/>
</style>
<property name="child">
<object class="GtkOverlay" id="overlay">
<property name="overflow">hidden</property>
<style>
<class name="card"/>
</style>
<property name="child">
<object class="GtkPicture" id="picture">
<property name="can-shrink">True</property>
<property name="keep-aspect-ratio">False</property>
<property name="vexpand">True</property>
</object>
</property>
<child type="overlay">
<object class="GtkButton" id="close_btn">
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Close Tab</property>
<property name="icon-name">window-close-symbolic</property>
<property name="valign">start</property>
<property name="halign">end</property>
<signal name="clicked" handler="close_clicked_cb" swapped="true"/>
<layout>
<property name="measure">True</property>
</layout>
<style>
<class name="circular"/>
<class name="tab-close-button"/>
</style>
</object>
</child>
<child type="overlay">