[baobab/wip/gtkmaster] Convert Window to a Template
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/wip/gtkmaster] Convert Window to a Template
- Date: Sun, 2 Jun 2013 10:22:32 +0000 (UTC)
commit 048947cefa5832cf322d65d6b8002df8278e73a9
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sun Jun 2 12:06:56 2013 +0200
Convert Window to a Template
src/baobab-main-window.ui | 659 +++++++++++++++++++++++----------------------
src/baobab-window.vala | 91 +++----
2 files changed, 373 insertions(+), 377 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index c3aec28..8e8c81e 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -13,310 +13,302 @@
</item>
</section>
</menu>
- <object class="GtkGrid" id="window-contents">
+ <object class="GtkMenu" id="treeview_popup_menu">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkHeaderBar" id="header-bar">
+ <object class="GtkMenuItem" id="treeview_popup_open">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="back-button">
- <property name="valign">center</property>
- <property name="can_focus">True</property>
- <property name="action_name">win.show-home-page</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="back-button-image">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">go-previous-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="reload-button">
- <property name="valign">center</property>
- <property name="can_focus">True</property>
- <property name="action_name">win.reload</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="reload-button-image">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">view-refresh-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu-button">
- <property name="valign">center</property>
- <property name="menu_model">winmenu</property>
- <property name="action_name">win.gear-menu</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="menu-button-image">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">emblem-system-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
+ <property name="label" translatable="yes">_Open Folder</property>
+ <property name="use_underline">True</property>
</object>
</child>
<child>
- <object class="GtkInfoBar" id="infobar">
- <property name="visible">False</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="infobar-content-area">
+ <object class="GtkMenuItem" id="treeview_popup_copy">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Copy Path to Clipboard</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="treeview_popup_trash">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Mo_ve to Trash</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <template class="BaobabWindow" parent="Gtk.ApplicationWindow">
+ <property name="title" translatable="yes">Disk Usage Analyzer</property>
+ <child>
+ <object class="GtkGrid" id="window_contents">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">8</property>
- <property name="orientation">vertical</property>
- <property name="spacing">16</property>
<child>
- <object class="GtkLabel" id="infobar-primary-label">
- <property name="visible">True</property>
+ <object class="GtkButton" id="back_button">
+ <property name="valign">center</property>
<property name="can_focus">True</property>
- <property name="selectable">True</property>
- <property name="use-markup">True</property>
- <property name="halign">GTK_ALIGN_START</property>
+ <property name="action_name">win.show-home-page</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="back_button_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="pack_type">start</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="infobar-secondary-label">
- <property name="visible">True</property>
+ <object class="GtkButton" id="reload_button">
+ <property name="valign">center</property>
<property name="can_focus">True</property>
- <property name="selectable">True</property>
- <property name="use-markup">True</property>
- <property name="halign">GTK_ALIGN_START</property>
+ <property name="action_name">win.reload</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="reload_button_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">view-refresh-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="pack_type">end</property>
</packing>
</child>
- </object>
- </child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="infobar-action-area">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="infobar-close-button">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Close</property>
+ <object class="GtkMenuButton" id="menu_button">
+ <property name="valign">center</property>
+ <property name="menu_model">winmenu</property>
+ <property name="action_name">win.gear-menu</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="menu_button_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">emblem-system-symbolic</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="main-stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkGrid" id="home-page">
- <property name="can_focus">False</property>
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkScrolledWindow" id="location-scrolled-window">
+ <object class="GtkInfoBar" id="infobar">
+ <property name="visible">False</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="infobar_content_area">
<property name="visible">True</property>
- <property name="vexpand">True</property>
- <property name="hexpand">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">8</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">16</property>
<child>
- <object class="GtkViewport" id="location-viewport">
+ <object class="GtkLabel" id="infobar_primary_label">
<property name="visible">True</property>
- <child>
- <object class="BaobabLocationList" id="location-list">
- <property name="visible">True</property>
- <style>
- <class name="view"/>
- <class name="content-view"/>
- </style>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="selectable">True</property>
+ <property name="use-markup">True</property>
+ <property name="halign">GTK_ALIGN_START</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="infobar_secondary_label">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="selectable">True</property>
+ <property name="use-markup">True</property>
+ <property name="halign">GTK_ALIGN_START</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="infobar_action_area">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="infobar_close_button">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Close</property>
</object>
</child>
</object>
</child>
- </object>
+ </object>
</child>
<child>
- <object class="GtkGrid" id="result-page">
+ <object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkScrolledWindow" id="scrolled-window">
+ <object class="GtkGrid" id="home_page">
+ <property name="can_focus">False</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkTreeView" id="treeview">
+ <object class="GtkScrolledWindow" id="location_scrolled_window">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
- </child>
+ <property name="vexpand">True</property>
+ <property name="hexpand">True</property>
<child>
- <object class="GtkTreeViewColumn" id="folder-column">
- <property name="resizable">True</property>
- <property name="sizing">grow-only</property>
- <property name="title" translatable="yes">Folder</property>
- <property name="expand">True</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">0</property>
+ <object class="GtkViewport" id="location_viewport">
+ <property name="visible">True</property>
<child>
- <object class="BaobabCellRendererName" id="folder-column-text-renderer"/>
- <attributes>
- <attribute name="name">0</attribute>
- <attribute name="state">6</attribute>
- </attributes>
+ <object class="BaobabLocationList" id="location_list">
+ <property name="visible">True</property>
+ <style>
+ <class name="view"/>
+ <class name="content-view"/>
+ </style>
+ </object>
</child>
</object>
</child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkGrid" id="result_page">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <property name="hexpand">True</property>
<child>
- <object class="GtkTreeViewColumn" id="usage-column">
- <property name="resizable">True</property>
- <property name="sizing">grow-only</property>
- <property name="title" translatable="yes">Usage</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">2</property>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview_selection1"/>
+ </child>
<child>
- <object class="BaobabCellRendererProgress" id="usage-column-bar-renderer">
- <property name="xpad">4</property>
- <property name="ypad">4</property>
+ <object class="GtkTreeViewColumn" id="folder_column">
+ <property name="resizable">True</property>
+ <property name="sizing">grow-only</property>
+ <property name="title" translatable="yes">Folder</property>
+ <property name="expand">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">0</property>
+ <child>
+ <object class="BaobabCellRendererName" id="folder_column_text_renderer"/>
+ <attributes>
+ <attribute name="name">0</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="value">2</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
<child>
- <object class="BaobabCellRendererPercent" id="usage-column-percent-renderer">
- <property name="xalign">1.0</property>
+ <object class="GtkTreeViewColumn" id="usage_column">
+ <property name="resizable">True</property>
+ <property name="sizing">grow-only</property>
+ <property name="title" translatable="yes">Usage</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">2</property>
+ <child>
+ <object class="BaobabCellRendererProgress" id="usage_column_bar_renderer">
+ <property name="xpad">4</property>
+ <property name="ypad">4</property>
+ </object>
+ <attributes>
+ <attribute name="value">2</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="BaobabCellRendererPercent" id="usage_column_percent_renderer">
+ <property name="xalign">1.0</property>
+ </object>
+ <attributes>
+ <attribute name="percent">2</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="percent">2</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="size-column">
- <property name="resizable">True</property>
- <property name="sizing">grow-only</property>
- <property name="title" translatable="yes">Size</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">4</property>
<child>
- <object class="BaobabCellRendererSize" id="size-column-size-renderer">
- <property name="xalign">1.0</property>
- <property name="show-allocated-size">True</property>
+ <object class="GtkTreeViewColumn" id="size_column">
+ <property name="resizable">True</property>
+ <property name="sizing">grow-only</property>
+ <property name="title" translatable="yes">Size</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">4</property>
+ <child>
+ <object class="BaobabCellRendererSize" id="size_column_size_renderer">
+ <property name="xalign">1.0</property>
+ <property name="show-allocated-size">True</property>
+ </object>
+ <attributes>
+ <attribute name="size">3</attribute>
+ <attribute name="alloc-size">4</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="size">3</attribute>
- <attribute name="alloc-size">4</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="contents-column">
- <property name="resizable">True</property>
- <property name="sizing">grow-only</property>
- <property name="title" translatable="yes">Contents</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">5</property>
<child>
- <object class="BaobabCellRendererItems" id="contents-column-items-renderer">
- <property name="xalign">1.0</property>
+ <object class="GtkTreeViewColumn" id="contents_column">
+ <property name="resizable">True</property>
+ <property name="sizing">grow-only</property>
+ <property name="title" translatable="yes">Contents</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">5</property>
+ <child>
+ <object class="BaobabCellRendererItems" id="contents_column_items_renderer">
+ <property name="xalign">1.0</property>
+ </object>
+ <attributes>
+ <attribute name="items">5</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="items">5</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
</object>
</child>
</object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="chart-grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child>
- <object class="GtkStack" id="chart-stack">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="BaobabRingschart" id="rings-chart">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- </child>
- <child>
- <object class="BaobabTreemap" id="treemap-chart">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSpinner" id="spinner">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="width_request">128</property>
- <property name="height_request">128</property>
- <property name="halign">GTK_ALIGN_CENTER</property>
- <property name="valign">GTK_ALIGN_CENTER</property>
- </object>
- </child>
- </object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
@@ -325,126 +317,139 @@
</packing>
</child>
<child>
- <object class="GtkButtonBox" id="chart-buttonbox">
+ <object class="GtkGrid" id="chart_grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="margin_right">20</property>
- <property name="margin_top">6</property>
- <property name="margin_bottom">6</property>
- <property name="homogeneous">False</property>
- <property name="layout_style">end</property>
- <style>
- <class name="linked"/>
- </style>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkRadioButton" id="rings-button">
+ <object class="GtkStack" id="chart_stack">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="tooltip_markup" translatable="yes">Rings Chart</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <property name="action_name">win.active-chart</property>
- <property name="action_target">'rings'</property>
<child>
- <object class="GtkImage" id="ringschart-icon">
+ <object class="BaobabRingschart" id="rings_chart">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="BaobabTreemap" id="treemap_chart">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSpinner" id="spinner">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">view-ringschart-symbolic</property>
- <property name="icon_size">1</property>
+ <property name="width_request">128</property>
+ <property name="height_request">128</property>
+ <property name="halign">GTK_ALIGN_CENTER</property>
+ <property name="valign">GTK_ALIGN_CENTER</property>
</object>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <property name="non_homogeneous">True</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="treemap-button">
+ <object class="GtkButtonBox" id="chart_buttonbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="tooltip_markup" translatable="yes">Treemap Chart</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">rings-button</property>
- <property name="action_name">win.active-chart</property>
- <property name="action_target">'treemap'</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">20</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="homogeneous">False</property>
+ <property name="layout_style">end</property>
+ <style>
+ <class name="linked"/>
+ </style>
<child>
- <object class="GtkImage" id="treemap-icon">
+ <object class="GtkRadioButton" id="rings_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">view-treemap-symbolic</property>
- <property name="icon_size">1</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="tooltip_markup" translatable="yes">Rings Chart</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ <property name="action_name">win.active-chart</property>
+ <property name="action_target">'rings'</property>
+ <child>
+ <object class="GtkImage" id="ringschart_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">view-ringschart-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ <property name="non_homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="treemap_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="tooltip_markup" translatable="yes">Treemap Chart</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">rings_button</property>
+ <property name="action_name">win.active-chart</property>
+ <property name="action_target">'treemap'</property>
+ <child>
+ <object class="GtkImage" id="treemap_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">view-treemap-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ <property name="non_homogeneous">True</property>
+ </packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- <property name="non_homogeneous">True</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
</object>
</child>
- </object>
- <object class="GtkMenu" id="treeview-popup-menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="treeview-popup-open">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Open Folder</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="treeview-popup-copy">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Copy Path to Clipboard</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="treeview-popup-trash">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Mo_ve to Trash</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
+ </template>
</interface>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 10cba24..74efaba 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -22,24 +22,52 @@
namespace Baobab {
+ [GtkTemplate (ui = "/org/gnome/baobab/ui/baobab-main-window.ui")]
public class Window : Gtk.ApplicationWindow {
Settings ui_settings;
+ [GtkChild]
Gtk.HeaderBar header_bar;
+ [GtkChild]
Gtk.Button back_button;
+ [GtkChild]
Gtk.Button reload_button;
+ [GtkChild]
Gtk.MenuButton menu_button;
+ [GtkChild]
Gtk.Stack main_stack;
+ [GtkChild]
Gtk.Widget home_page;
+ [GtkChild]
Gtk.Widget result_page;
+ [GtkChild]
Gtk.InfoBar infobar;
- Gtk.Label infobar_primary;
- Gtk.Label infobar_secondary;
- Gtk.ScrolledWindow location_scroll;
+ [GtkChild]
+ Gtk.Label infobar_primary_label;
+ [GtkChild]
+ Gtk.Label infobar_secondary_label;
+ [GtkChild]
+ Gtk.Button infobar_close_button;
+ [GtkChild]
+ Gtk.ScrolledWindow location_scrolled_window;
+ [GtkChild]
LocationList location_list;
+ [GtkChild]
Gtk.TreeView treeview;
+ [GtkChild]
+ Gtk.Menu treeview_popup_menu;
+ [GtkChild]
+ Gtk.MenuItem treeview_popup_open;
+ [GtkChild]
+ Gtk.MenuItem treeview_popup_copy;
+ [GtkChild]
+ Gtk.MenuItem treeview_popup_trash;
+ [GtkChild]
Gtk.Stack chart_stack;
+ [GtkChild]
Chart rings_chart;
+ [GtkChild]
Chart treemap_chart;
+ [GtkChild]
Gtk.Spinner spinner;
Location? active_location;
ulong scan_completed_handler;
@@ -96,43 +124,15 @@ namespace Baobab {
add_action_entries (action_entries, this);
- // Build ourselves.
- var builder = new Gtk.Builder ();
- try {
- builder.add_from_resource ("/org/gnome/baobab/ui/baobab-main-window.ui");
- } catch (Error e) {
- error ("loading main builder file: %s", e.message);
- }
-
- // Cache some objects from the builder.
- main_stack = builder.get_object ("main-stack") as Gtk.Stack;
- home_page = builder.get_object ("home-page") as Gtk.Widget;
- result_page = builder.get_object ("result-page") as Gtk.Widget;
- header_bar = builder.get_object ("header-bar") as Gtk.HeaderBar;
- back_button = builder.get_object ("back-button") as Gtk.Button;
- reload_button = builder.get_object ("reload-button") as Gtk.Button;
- menu_button = builder.get_object ("menu-button") as Gtk.MenuButton;
- infobar = builder.get_object ("infobar") as Gtk.InfoBar;
- infobar_primary = builder.get_object ("infobar-primary-label") as Gtk.Label;
- infobar_secondary = builder.get_object ("infobar-secondary-label") as Gtk.Label;
- location_scroll = builder.get_object ("location-scrolled-window") as Gtk.ScrolledWindow;
- location_list = builder.get_object ("location-list") as LocationList;
- treeview = builder.get_object ("treeview") as Gtk.TreeView;
- chart_stack = builder.get_object ("chart-stack") as Gtk.Stack;
- rings_chart = builder.get_object ("rings-chart") as Chart;
- treemap_chart = builder.get_object ("treemap-chart") as Chart;
- spinner = builder.get_object ("spinner") as Gtk.Spinner;
-
- location_list.set_adjustment (location_scroll.get_vadjustment ());
+ location_list.set_adjustment (location_scrolled_window.get_vadjustment ());
location_list.set_action (on_scan_location_activate);
location_list.update ();
var action = lookup_action ("scan-remote") as SimpleAction;
action.set_enabled (ConnectServer.available ());
- setup_treeview (builder);
+ setup_treeview ();
- var infobar_close_button = builder.get_object ("infobar-close-button") as Gtk.Button;
infobar_close_button.clicked.connect (() => { clear_message (); });
ui_settings = Application.get_ui_settings ();
@@ -167,10 +167,6 @@ namespace Baobab {
return false;
});
- add (builder.get_object ("window-contents") as Gtk.Widget);
- title = _("Disk Usage Analyzer");
- set_hide_titlebar_when_maximized (true);
-
active_location = null;
scan_completed_handler = 0;
@@ -378,25 +374,20 @@ namespace Baobab {
return true;
}
- void setup_treeview (Gtk.Builder builder) {
- var popup = builder.get_object ("treeview-popup-menu") as Gtk.Menu;
- var open_item = builder.get_object ("treeview-popup-open") as Gtk.MenuItem;
- var copy_item = builder.get_object ("treeview-popup-copy") as Gtk.MenuItem;
- var trash_item = builder.get_object ("treeview-popup-trash") as Gtk.MenuItem;
-
+ void setup_treeview () {
treeview.button_press_event.connect ((event) => {
if (((Gdk.Event) (&event)).triggers_context_menu ()) {
- return show_treeview_popup (popup, event);
+ return show_treeview_popup (treeview_popup_menu, event);
}
return false;
});
treeview.popup_menu.connect (() => {
- return show_treeview_popup (popup, null);
+ return show_treeview_popup (treeview_popup_menu, null);
});
- open_item.activate.connect (() => {
+ treeview_popup_open.activate.connect (() => {
var selection = treeview.get_selection ();
Gtk.TreeIter iter;
if (selection.get_selected (null, out iter)) {
@@ -416,7 +407,7 @@ namespace Baobab {
}
});
- copy_item.activate.connect (() => {
+ treeview_popup_copy.activate.connect (() => {
var selection = treeview.get_selection ();
Gtk.TreeIter iter;
if (selection.get_selected (null, out iter)) {
@@ -428,7 +419,7 @@ namespace Baobab {
}
});
- trash_item.activate.connect (() => {
+ treeview_popup_trash.activate.connect (() => {
var selection = treeview.get_selection ();
Gtk.TreeIter iter;
if (selection.get_selected (null, out iter)) {
@@ -457,8 +448,8 @@ namespace Baobab {
void message (string primary_msg, string secondary_msg, Gtk.MessageType type) {
infobar.message_type = type;
- infobar_primary.set_label ("<b>%s</b>".printf (_(primary_msg)));
- infobar_secondary.set_label ("<small>%s</small>".printf (_(secondary_msg)));
+ infobar_primary_label.set_label ("<b>%s</b>".printf (_(primary_msg)));
+ infobar_secondary_label.set_label ("<small>%s</small>".printf (_(secondary_msg)));
infobar.show ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]