[gnome-disk-utility] Use GtkHeaderBar and CSD
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Use GtkHeaderBar and CSD
- Date: Mon, 20 Jan 2014 07:29:35 +0000 (UTC)
commit dd6c6bd4df9cf71f6e4875125760c1700067fa2d
Author: David Zeuthen <zeuthen gmail com>
Date: Sat Jan 18 15:26:47 2014 -0800
Use GtkHeaderBar and CSD
This involves removing the ability to select multiple devices, hence
the ability to create RAID arrays. The RAID functionality will be
completely removed in a follow-up commit.
Signed-off-by: David Zeuthen <zeuthen gmail com>
data/ui/disks.ui | 761 +++++------------------------------------
src/disks/gduwindow.c | 920 ++++++++++++++-----------------------------------
2 files changed, 338 insertions(+), 1343 deletions(-)
---
diff --git a/data/ui/disks.ui b/data/ui/disks.ui
index 1d51f6e..f359741 100644
--- a/data/ui/disks.ui
+++ b/data/ui/disks.ui
@@ -1,98 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 on Sat Jan 18 15:06:33 2014 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <object class="GtkActionGroup" id="devtab-actions">
- <child>
- <object class="GtkAction" id="devtab-action-partition-create">
- <property name="tooltip" translatable="yes">Create a new partition</property>
- <property name="icon_name">list-add-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-mount">
- <property name="tooltip" translatable="yes">Mount the filesystem</property>
- <property name="icon_name">media-playback-start-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-unmount">
- <property name="tooltip" translatable="yes">Unmount the filesystem</property>
- <property name="icon_name">media-playback-stop-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-eject">
- <property name="tooltip" translatable="yes">Eject the media</property>
- <property name="icon_name">media-eject-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-power-off">
- <property name="tooltip" translatable="yes">Power off the drive</property>
- <property name="icon_name">system-shutdown-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-unlock">
- <property name="tooltip" translatable="yes">Unlock the encrypted device</property>
- <property name="icon_name">changes-allow-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-activate-swap">
- <property name="tooltip" translatable="yes">Activate the swap space</property>
- <property name="icon_name">media-playback-start-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-deactivate-swap">
- <property name="tooltip" translatable="yes">Deactivate the swap space</property>
- <property name="icon_name">media-playback-stop-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-lock">
- <property name="tooltip" translatable="yes">Lock the encrypted device</property>
- <property name="icon_name">changes-prevent-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-generic">
- <property name="tooltip" translatable="yes">More actions</property>
- <property name="icon_name">system-run-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-action-partition-delete">
- <property name="tooltip" translatable="yes">Delete partition</property>
- <property name="icon_name">list-remove-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-generic">
- <property name="tooltip" translatable="yes">More actions</property>
- <property name="icon_name">emblem-system-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-raid-start">
- <property name="tooltip" translatable="yes">Start RAID Array</property>
- <property name="icon_name">media-playback-start-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-raid-stop">
- <property name="tooltip" translatable="yes">Stop RAID Array</property>
- <property name="icon_name">media-playback-stop-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkAction" id="devtab-drive-action-loop-detach">
- <property name="tooltip" translatable="yes">Detach Loop Device</property>
- <property name="icon_name">list-remove-symbolic</property>
- </object>
- </child>
- </object>
+ <!-- interface-requires gtk+ 3.10 -->
<object class="GtkWindow" id="disks-window">
<property name="can_focus">False</property>
<property name="border_width">12</property>
@@ -102,196 +11,30 @@
<object class="GtkHPaned" id="main-hpane">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="position">300</property>
+ <property name="position">250</property>
<property name="position_set">True</property>
<child>
- <object class="GtkVBox" id="device-tree-vbox">
+ <object class="GtkScrolledWindow" id="device-tree-scrolledwindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">6</property>
- <child>
- <object class="GtkToolbar" id="device-tree-selection-toolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">icons</property>
- <property name="show_arrow">False</property>
- <property name="icon_size">1</property>
- <style>
- <class name="menubar"/>
- </style>
- <child>
- <object class="GtkToolItem" id="device-tree-selection-toolbar-left">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="toolbutton2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="draw">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="device-tree-selection-toolbar-center">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkNotebook" id="device-tree-selection-toolbar-center-notebook">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <child>
- <object class="GtkLabel" id="device-tree-selection-toolbar-static-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Devices</property>
- <property name="use_underline">True</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <object class="GtkLabel" id="device-tree-selection-toolbar-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">No _Devices Selected</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child type="tab">
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="toolbutton1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="draw">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="device-tree-selection-toolbar-right">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="device-tree-selection-toolbar-select-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Click to select multiple
disks to perform operations on</property>
- <property name="icon_name">object-select-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="device-tree-selection-toolbar-done-button">
- <property name="label" translatable="yes">Done</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="min_content_width">0</property>
<child>
- <object class="GtkOverlay" id="device-tree-overlay">
+ <object class="GtkTreeView" id="device-tree-treeview">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkScrolledWindow" id="device-tree-scrolledwindow">
- <property name="width_request">300</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="device-tree-treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="show_expanders">False</property>
- <property name="level_indentation">12</property>
- </object>
- </child>
- </object>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="show_expanders">False</property>
+ <property name="level_indentation">12</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
- <property name="resize">True</property>
- <property name="shrink">False</property>
+ <property name="resize">False</property>
+ <property name="shrink">True</property>
</packing>
</child>
<child>
@@ -299,6 +42,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">6</property>
+ <property name="margin_right">12</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">12</property>
<property name="hexpand">True</property>
<child>
<object class="GtkAlignment" id="alignment1">
@@ -359,7 +105,7 @@
<object class="GtkTable" id="devtab-drive-table">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">16</property>
+ <property name="n_rows">15</property>
<property name="n_columns">2</property>
<property name="column_spacing">10</property>
<child>
@@ -373,8 +119,6 @@
</style>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -392,8 +136,6 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -410,8 +152,8 @@
</style>
</object>
<packing>
- <property name="top_attach">11</property>
- <property name="bottom_attach">12</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -429,8 +171,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">11</property>
- <property name="bottom_attach">12</property>
+ <property name="top_attach">10</property>
+ <property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -447,8 +189,8 @@
</style>
</object>
<packing>
- <property name="top_attach">12</property>
- <property name="bottom_attach">13</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -466,8 +208,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">12</property>
- <property name="bottom_attach">13</property>
+ <property name="top_attach">11</property>
+ <property name="bottom_attach">12</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -484,8 +226,8 @@
</style>
</object>
<packing>
- <property name="top_attach">13</property>
- <property name="bottom_attach">14</property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -503,8 +245,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">13</property>
- <property name="bottom_attach">14</property>
+ <property name="top_attach">12</property>
+ <property name="bottom_attach">13</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -521,8 +263,8 @@
</style>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -540,27 +282,14 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkImage" id="devtab-drive-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="stock">gtk-harddisk</property>
- <property name="icon-size">6</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="devtab-drive-smart-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -571,8 +300,8 @@
</style>
</object>
<packing>
- <property name="top_attach">14</property>
- <property name="bottom_attach">15</property>
+ <property name="top_attach">13</property>
+ <property name="bottom_attach">14</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -590,242 +319,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">14</property>
- <property name="bottom_attach">15</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="devtab-drive-box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="devtab-drive-vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkLabel" id="devtab-drive-desc-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="single_line_mode">True</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="devtab-drive-devices-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <property name="single_line_mode">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButtonBox" id="devtab-drive-buttonbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="linked"/>
- </style>
- <child>
- <object class="GtkButton" id="devtab-drive-power-off-button">
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-power-off</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="image9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Power off the
drive</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">system-shutdown-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- <property name="non_homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="devtab-drive-eject-button">
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-eject</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Eject the medium in the
drive</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">media-eject-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- <property name="non_homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="devtab-drive-raid-start-button">
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-raid-start</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Start RAID
Array</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">media-playback-start-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- <property name="non_homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="devtab-drive-raid-stop-button">
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-raid-stop</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Stop RAID
Array</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">media-playback-stop-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- <property name="non_homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="devtab-drive-loop-detach-button">
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-loop-detach</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <child>
- <object class="GtkImage" id="image7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Detach Loop
Device</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="pixel_size">16</property>
- <property name="icon_name">list-remove-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
- <property name="non_homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="devtab-drive-generic-button">
- <property name="popup">generic-drive-menu</property>
- <property name="use_action_appearance">False</property>
- <property name="related_action">devtab-drive-action-generic</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="related_action">devtab-drive-action-generic</property>
- <property name="use_action_appearance">False</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">More actions</property>
- <property name="pixel_size">16</property>
- <property name="margin_top">5</property>
- <property name="margin_bottom">5</property>
- <property name="icon_name">emblem-system-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">10</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>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="top_attach">13</property>
+ <property name="bottom_attach">14</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -843,8 +338,8 @@
</style>
</object>
<packing>
- <property name="top_attach">15</property>
- <property name="bottom_attach">16</property>
+ <property name="top_attach">14</property>
+ <property name="bottom_attach">15</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="y_padding">4</property>
@@ -925,8 +420,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">15</property>
- <property name="bottom_attach">16</property>
+ <property name="top_attach">14</property>
+ <property name="bottom_attach">15</property>
<property name="y_options"/>
</packing>
</child>
@@ -941,8 +436,8 @@
</style>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -960,8 +455,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -979,8 +474,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -997,8 +492,8 @@
</style>
</object>
<packing>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1015,8 +510,8 @@
</style>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1034,8 +529,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1053,8 +548,8 @@
</style>
</object>
<packing>
- <property name="top_attach">10</property>
- <property name="bottom_attach">11</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="y_padding">4</property>
@@ -1109,8 +604,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">10</property>
- <property name="bottom_attach">11</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
<property name="y_options"/>
</packing>
</child>
@@ -1125,8 +620,8 @@
</style>
</object>
<packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1151,8 +646,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -1168,8 +663,8 @@
</style>
</object>
<packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1187,8 +682,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1205,8 +700,8 @@
</style>
</object>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1224,8 +719,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1242,8 +737,8 @@
</style>
</object>
<packing>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
<property name="y_padding">4</property>
@@ -1268,8 +763,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
@@ -1335,7 +830,6 @@
<property name="icon_size">1</property>
<child>
<object class="GtkToolButton" id="toolbutton-mount">
- <property name="related_action">devtab-action-mount</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1348,7 +842,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-unmount">
- <property name="related_action">devtab-action-unmount</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1361,7 +854,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-activate-swap">
- <property name="related_action">devtab-action-activate-swap</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1374,7 +866,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-deactivate-swap">
- <property name="related_action">devtab-action-deactivate-swap</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1387,7 +878,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-unlock">
- <property name="related_action">devtab-action-unlock</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1400,7 +890,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-lock">
- <property name="related_action">devtab-action-lock</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1413,7 +902,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-partition-create">
- <property name="related_action">devtab-action-partition-create</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1426,7 +914,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-partition-delete">
- <property name="related_action">devtab-action-partition-delete</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1439,7 +926,6 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton-generic-menu">
- <property name="related_action">devtab-action-generic</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
@@ -1770,6 +1256,7 @@
<object class="GtkMenu" id="generic-drive-menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">center</property>
<child>
<object class="GtkMenuItem" id="generic-drive-menu-item-format-disk">
<property name="visible">True</property>
@@ -1885,6 +1372,7 @@
<object class="GtkMenu" id="generic-menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">center</property>
<child>
<object class="GtkMenuItem" id="generic-menu-item-format-volume">
<property name="visible">True</property>
@@ -1975,97 +1463,4 @@
</object>
</child>
</object>
- <object class="GtkWindow" id="overlay-toolbar-dummy-window">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkToolbar" id="overlay-toolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">icons</property>
- <property name="show_arrow">False</property>
- <property name="icon_size">1</property>
- <style>
- <class name="osd"/>
- </style>
- <child>
- <object class="GtkToolItem" id="overlay-toolbar-left">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <style>
- <class name="linked"/>
- </style>
- <child>
- <object class="GtkButton" id="overlay-toolbar-erase-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <child>
- <object class="GtkImage" id="image10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip_text" translatable="yes">Click to select multiple disks to
perform operations on</property>
- <property name="icon_name">edit-clear-all-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkSeparatorToolItem" id="toolbutton3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="overlay-toolbar-center">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkBox" id="box3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="overlay-toolbar-create-raid-button">
- <property name="label" translatable="yes">Create RAID</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
</interface>
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 5d30bb4..04847d3 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -46,9 +46,6 @@ struct _GduWindow
{
GtkApplicationWindow parent_instance;
- gboolean in_selection_mode;
- GtkTreeViewColumn *selection_column;
-
GduApplication *application;
UDisksClient *client;
@@ -61,58 +58,34 @@ struct _GduWindow
GtkWidget *volume_grid;
GtkWidget *toolbutton_generic_menu;
+ GtkWidget *toolbutton_partition_create;
+ GtkWidget *toolbutton_partition_delete;
+ GtkWidget *toolbutton_mount;
+ GtkWidget *toolbutton_unmount;
+ GtkWidget *toolbutton_unlock;
+ GtkWidget *toolbutton_lock;
+ GtkWidget *toolbutton_activate_swap;
+ GtkWidget *toolbutton_deactivate_swap;
- GtkWidget *overlay_toolbar;
- GtkWidget *overlay_toolbar_erase_button;
- GtkWidget *overlay_toolbar_create_raid_button;
+ GtkWidget *header;
GtkWidget *main_hpane;
GtkWidget *details_notebook;
- GtkWidget *device_tree_overlay;
GtkWidget *device_tree_scrolledwindow;
GtkWidget *device_tree_treeview;
- GtkWidget *device_tree_selection_toolbar;
- GtkWidget *device_tree_selection_toolbar_center_notebook;
- GtkWidget *device_tree_selection_toolbar_select_button;
- GtkWidget *device_tree_selection_toolbar_done_button;
- GtkWidget *device_tree_selection_toolbar_static_label;
- GtkWidget *device_tree_selection_toolbar_label;
-
- GtkWidget *devtab_drive_box;
- GtkWidget *devtab_drive_vbox;
- GtkWidget *devtab_drive_buttonbox;
+
GtkWidget *devtab_drive_raid_start_button;
GtkWidget *devtab_drive_raid_stop_button;
GtkWidget *devtab_drive_loop_detach_button;
GtkWidget *devtab_drive_eject_button;
GtkWidget *devtab_drive_power_off_button;
GtkWidget *devtab_drive_generic_button;
- GtkWidget *devtab_drive_desc_label;
- GtkWidget *devtab_drive_devices_label;
- GtkWidget *devtab_drive_image;
GtkWidget *devtab_table;
GtkWidget *devtab_drive_table;
GtkWidget *devtab_grid_hbox;
GtkWidget *devtab_volumes_label;
GtkWidget *devtab_grid_toolbar;
- GtkAction *devtab_action_generic;
- GtkAction *devtab_action_partition_create;
- GtkAction *devtab_action_partition_delete;
- GtkAction *devtab_action_mount;
- GtkAction *devtab_action_unmount;
- GtkAction *devtab_action_unlock;
- GtkAction *devtab_action_lock;
- GtkAction *devtab_action_activate_swap;
- GtkAction *devtab_action_deactivate_swap;
-
- GtkAction *devtab_drive_action_raid_start;
- GtkAction *devtab_drive_action_raid_stop;
- GtkAction *devtab_drive_action_loop_detach;
- GtkAction *devtab_drive_action_eject;
- GtkAction *devtab_drive_action_power_off;
- GtkAction *devtab_drive_action_generic;
-
GtkWidget *generic_drive_menu;
GtkWidget *generic_drive_menu_item_format_disk;
GtkWidget *generic_drive_menu_item_create_disk_image;
@@ -175,55 +148,25 @@ static const struct {
const gchar *name;
} widget_mapping[] = {
{G_STRUCT_OFFSET (GduWindow, toolbutton_generic_menu), "toolbutton-generic-menu"},
- {G_STRUCT_OFFSET (GduWindow, overlay_toolbar), "overlay-toolbar"},
- {G_STRUCT_OFFSET (GduWindow, overlay_toolbar_erase_button), "overlay-toolbar-erase-button"},
- {G_STRUCT_OFFSET (GduWindow, overlay_toolbar_create_raid_button), "overlay-toolbar-create-raid-button"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_partition_create), "toolbutton-partition-create"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_partition_delete), "toolbutton-partition-delete"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_mount), "toolbutton-mount"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_unmount), "toolbutton-unmount"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_unlock), "toolbutton-unlock"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_lock), "toolbutton-lock"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_activate_swap), "toolbutton-activate-swap"},
+ {G_STRUCT_OFFSET (GduWindow, toolbutton_deactivate_swap), "toolbutton-deactivate-swap"},
{G_STRUCT_OFFSET (GduWindow, main_hpane), "main-hpane"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_overlay), "device-tree-overlay"},
{G_STRUCT_OFFSET (GduWindow, device_tree_scrolledwindow), "device-tree-scrolledwindow"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar), "device-tree-selection-toolbar"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar_center_notebook),
"device-tree-selection-toolbar-center-notebook"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar_select_button),
"device-tree-selection-toolbar-select-button"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar_done_button),
"device-tree-selection-toolbar-done-button"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar_static_label),
"device-tree-selection-toolbar-static-label"},
- {G_STRUCT_OFFSET (GduWindow, device_tree_selection_toolbar_label), "device-tree-selection-toolbar-label"},
{G_STRUCT_OFFSET (GduWindow, device_tree_treeview), "device-tree-treeview"},
{G_STRUCT_OFFSET (GduWindow, details_notebook), "disks-notebook"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_table), "devtab-drive-table"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_box), "devtab-drive-box"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_vbox), "devtab-drive-vbox"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_buttonbox), "devtab-drive-buttonbox"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_raid_start_button), "devtab-drive-raid-start-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_raid_stop_button), "devtab-drive-raid-stop-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_loop_detach_button), "devtab-drive-loop-detach-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_eject_button), "devtab-drive-eject-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_power_off_button), "devtab-drive-power-off-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_generic_button), "devtab-drive-generic-button"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_desc_label), "devtab-drive-desc-label"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_devices_label), "devtab-drive-devices-label"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_image), "devtab-drive-image"},
{G_STRUCT_OFFSET (GduWindow, devtab_table), "devtab-table"},
{G_STRUCT_OFFSET (GduWindow, devtab_grid_hbox), "devtab-grid-hbox"},
{G_STRUCT_OFFSET (GduWindow, devtab_volumes_label), "devtab-volumes-label"},
{G_STRUCT_OFFSET (GduWindow, devtab_grid_toolbar), "devtab-grid-toolbar"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_generic), "devtab-action-generic"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_partition_create), "devtab-action-partition-create"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_partition_delete), "devtab-action-partition-delete"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_mount), "devtab-action-mount"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_unmount), "devtab-action-unmount"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_unlock), "devtab-action-unlock"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_lock), "devtab-action-lock"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_activate_swap), "devtab-action-activate-swap"},
- {G_STRUCT_OFFSET (GduWindow, devtab_action_deactivate_swap), "devtab-action-deactivate-swap"},
-
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_raid_start), "devtab-drive-action-raid-start"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_raid_stop), "devtab-drive-action-raid-stop"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_loop_detach), "devtab-drive-action-loop-detach"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_eject), "devtab-drive-action-eject"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_power_off), "devtab-drive-action-power-off"},
- {G_STRUCT_OFFSET (GduWindow, devtab_drive_action_generic), "devtab-drive-action-generic"},
{G_STRUCT_OFFSET (GduWindow, devtab_loop_autoclear_switch), "devtab-loop-autoclear-switch"},
{G_STRUCT_OFFSET (GduWindow, devtab_drive_raid_bitmap_switch), "devtab-drive-raid-bitmap-switch"},
@@ -365,21 +308,21 @@ static void update_all (GduWindow *window);
static void on_volume_grid_changed (GduVolumeGrid *grid,
gpointer user_data);
-static void on_devtab_action_generic_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_partition_create_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_partition_delete_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_mount_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_unmount_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_unlock_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_lock_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_activate_swap_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_action_deactivate_swap_activated (GtkAction *action, gpointer user_data);
-
-static void on_devtab_drive_action_raid_start_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_drive_action_raid_stop_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_drive_action_loop_detach_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_drive_action_eject_activated (GtkAction *action, gpointer user_data);
-static void on_devtab_drive_action_power_off_activated (GtkAction *action, gpointer user_data);
+static void on_generic_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_partition_create_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_partition_delete_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_mount_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_unmount_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_unlock_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_lock_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_activate_swap_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+static void on_deactivate_swap_tool_button_clicked (GtkToolButton *button, gpointer user_data);
+
+static void on_devtab_drive_raid_start_button_clicked (GtkButton *button, gpointer user_data);
+static void on_devtab_drive_raid_stop_button_clicked (GtkButton *button, gpointer user_data);
+static void on_devtab_drive_loop_detach_button_clicked (GtkButton *button, gpointer user_data);
+static void on_devtab_drive_eject_button_clicked (GtkButton *button, gpointer user_data);
+static void on_devtab_drive_power_off_button_clicked (GtkButton *button, gpointer user_data);
static void on_generic_drive_menu_item_view_smart (GtkMenuItem *menu_item,
gpointer user_data);
@@ -443,12 +386,6 @@ static gboolean on_activate_link (GtkLabel *label,
const gchar *uri,
gpointer user_data);
-static void on_overlay_toolbar_erase_button_clicked (GtkButton *button,
- gpointer user_data);
-
-static void on_overlay_toolbar_create_raid_button_clicked (GtkButton *button,
- gpointer user_data);
-
G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_APPLICATION_WINDOW);
static void
@@ -464,6 +401,10 @@ gdu_window_finalize (GObject *object)
{
GduWindow *window = GDU_WINDOW (object);
+ gtk_window_remove_mnemonic (GTK_WINDOW (window),
+ 'd',
+ window->device_tree_treeview);
+
g_signal_handlers_disconnect_by_func (window->client,
G_CALLBACK (on_client_changed),
window);
@@ -515,51 +456,32 @@ static void
update_for_show_flags (GduWindow *window,
ShowFlags *show_flags)
{
- gtk_action_set_sensitive (GTK_ACTION (window->devtab_drive_action_raid_start),
- show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_RAID_START);
- gtk_action_set_visible (GTK_ACTION (window->devtab_drive_action_raid_start), TRUE);
gtk_widget_set_visible (window->devtab_drive_raid_start_button,
show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_RAID_START);
-
- gtk_action_set_sensitive (GTK_ACTION (window->devtab_drive_action_raid_stop),
- show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_RAID_STOP);
- gtk_action_set_visible (GTK_ACTION (window->devtab_drive_action_raid_stop), TRUE);
gtk_widget_set_visible (window->devtab_drive_raid_stop_button,
show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_RAID_STOP);
-
- gtk_action_set_sensitive (GTK_ACTION (window->devtab_drive_action_loop_detach),
- show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_LOOP_DETACH);
- gtk_action_set_visible (GTK_ACTION (window->devtab_drive_action_loop_detach), TRUE);
gtk_widget_set_visible (window->devtab_drive_loop_detach_button,
show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_LOOP_DETACH);
-
- gtk_action_set_sensitive (GTK_ACTION (window->devtab_drive_action_eject),
- show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_EJECT);
- gtk_action_set_visible (GTK_ACTION (window->devtab_drive_action_eject), TRUE);
gtk_widget_set_visible (window->devtab_drive_eject_button,
show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_EJECT);
-
- gtk_action_set_sensitive (GTK_ACTION (window->devtab_drive_action_power_off),
- show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_POWER_OFF);
- gtk_action_set_visible (GTK_ACTION (window->devtab_drive_action_power_off), TRUE);
gtk_widget_set_visible (window->devtab_drive_power_off_button,
show_flags->drive_buttons & SHOW_FLAGS_DRIVE_BUTTONS_POWER_OFF);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_partition_create),
+ gtk_widget_set_visible (window->toolbutton_partition_create,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_PARTITION_CREATE);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_partition_delete),
+ gtk_widget_set_visible (window->toolbutton_partition_delete,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_PARTITION_DELETE);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_unmount),
+ gtk_widget_set_visible (window->toolbutton_unmount,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_UNMOUNT);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_mount),
+ gtk_widget_set_visible (window->toolbutton_mount,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_MOUNT);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_activate_swap),
+ gtk_widget_set_visible (window->toolbutton_activate_swap,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_ACTIVATE_SWAP);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_deactivate_swap),
+ gtk_widget_set_visible (window->toolbutton_deactivate_swap,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_DEACTIVATE_SWAP);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_unlock),
+ gtk_widget_set_visible (window->toolbutton_unlock,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_ENCRYPTED_UNLOCK);
- gtk_action_set_visible (GTK_ACTION (window->devtab_action_lock),
+ gtk_widget_set_visible (window->toolbutton_lock,
show_flags->volume_buttons & SHOW_FLAGS_VOLUME_BUTTONS_ENCRYPTED_LOCK);
gtk_widget_set_sensitive (GTK_WIDGET (window->generic_drive_menu_item_format_disk),
@@ -776,8 +698,8 @@ loop_delete_ensure_unused_cb (GduWindow *window,
static void
-on_devtab_drive_action_loop_detach_activated (GtkAction *action,
- gpointer user_data)
+on_devtab_drive_loop_detach_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
gdu_window_ensure_unused (window,
@@ -927,61 +849,89 @@ gdu_window_show_attach_disk_image (GduWindow *window)
g_clear_object (&folder);
}
+
/* ---------------------------------------------------------------------------------------------------- */
+
static void
-device_tree_selection_toolbar_select_done_toggle (GduWindow *window,
- gboolean set_clicked)
+init_css (GduWindow *window)
{
- GtkStyleContext *context;
+ GtkCssProvider *provider;
+ GError *error;
+ const gchar *css =
+"#devtab-grid-toolbar.toolbar {\n"
+" border-width: 1px;\n"
+" border-radius: 3px;\n"
+" border-style: solid;\n"
+" background-color: @theme_base_color;\n"
+"}\n"
+"\n"
+".gnome-disk-utility-grid {\n"
+" border-radius: 3px;\n"
+"}\n"
+"\n"
+".gnome-disk-utility-grid:selected {\n"
+" background-image: -gtk-gradient(radial,\n"
+" center center, 0,\n"
+" center center, 1,\n"
+" from(@theme_selected_bg_color),\n"
+" to(shade (@theme_selected_bg_color, 0.80)));\n"
+" -adwaita-focus-border-color: mix(@theme_selected_fg_color, @theme_selected_bg_color, 0.30);\n"
+"}\n"
+"\n"
+".gnome-disk-utility-grid:selected:backdrop {\n"
+" background-image: -gtk-gradient(radial,\n"
+" center center, 0,\n"
+" center center, 1,\n"
+" from(@theme_unfocused_selected_bg_color),\n"
+" to(shade (@theme_unfocused_selected_bg_color, 0.80)));\n"
+" -adwaita-focus-border-color: mix(@theme_unfocused_selected_fg_color, @theme_unfocused_selected_bg_color,
0.30);\n"
+"}\n"
+;
- context = gtk_widget_get_style_context (window->device_tree_selection_toolbar);
- if (set_clicked)
- {
- window->in_selection_mode = TRUE;
- gtk_widget_set_visible (GTK_WIDGET (window->device_tree_selection_toolbar_select_button), FALSE);
- gtk_widget_set_visible (GTK_WIDGET (window->device_tree_selection_toolbar_done_button), TRUE);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (window->device_tree_selection_toolbar_center_notebook),
1);
- gtk_style_context_add_class (context, "selection-mode");
- gdu_device_tree_model_clear_selected (window->model);
- }
- else
+ provider = gtk_css_provider_new ();
+ error = NULL;
+ if (!gtk_css_provider_load_from_data (provider,
+ css,
+ -1,
+ &error))
{
- window->in_selection_mode = FALSE;
- gtk_widget_set_visible (GTK_WIDGET (window->device_tree_selection_toolbar_select_button), TRUE);
- gtk_widget_set_visible (GTK_WIDGET (window->device_tree_selection_toolbar_done_button), FALSE);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (window->device_tree_selection_toolbar_center_notebook),
0);
- gtk_style_context_remove_class (context, "selection-mode");
+ g_warning ("Can’t parse custom CSS: %s\n", error->message);
+ g_error_free (error);
+ goto out;
}
- update_all (window);
- gtk_tree_view_column_set_visible (window->selection_column, window->in_selection_mode);
+ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+ out:
+ ;
}
-/* ---------------------------------------------------------------------------------------------------- */
-static void
-on_device_tree_selection_toolbar_select_button_clicked (GtkButton *button,
- gpointer user_data)
+static gint
+device_sort_function (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer user_data)
{
- GduWindow *window = GDU_WINDOW (user_data);
- device_tree_selection_toolbar_select_done_toggle (window, TRUE);
- update_all (window);
-}
-
+ gchar *sa, *sb;
+ gint ret;
-static void
-on_device_tree_selection_toolbar_done_button_clicked (GtkButton *button,
- gpointer user_data)
-{
- GduWindow *window = GDU_WINDOW (user_data);
- device_tree_selection_toolbar_select_done_toggle (window, FALSE);
- update_all (window);
+ gtk_tree_model_get (model, a,
+ GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, &sa,
+ -1);
+ gtk_tree_model_get (model, b,
+ GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, &sb,
+ -1);
+ ret = g_strcmp0 (sa, sb);
+ g_free (sa);
+ g_free (sb);
+ return ret;
}
-/* ---------------------------------------------------------------------------------------------------- */
-
gboolean
gdu_window_select_object (GduWindow *window,
UDisksObject *object)
@@ -1068,88 +1018,6 @@ gdu_window_select_object (GduWindow *window,
return ret;
}
-/* ---------------------------------------------------------------------------------------------------- */
-
-
-static void
-init_css (GduWindow *window)
-{
- GtkCssProvider *provider;
- GError *error;
- const gchar *css =
-"#devtab-grid-toolbar.toolbar {\n"
-" border-width: 1px;\n"
-" border-radius: 3px;\n"
-" border-style: solid;\n"
-" background-color: @theme_base_color;\n"
-"}\n"
-"\n"
-".gnome-disk-utility-grid {\n"
-" border-radius: 3px;\n"
-"}\n"
-"\n"
-".gnome-disk-utility-grid:selected {\n"
-" background-image: -gtk-gradient(radial,\n"
-" center center, 0,\n"
-" center center, 1,\n"
-" from(@theme_selected_bg_color),\n"
-" to(shade (@theme_selected_bg_color, 0.80)));\n"
-" -adwaita-focus-border-color: mix(@theme_selected_fg_color, @theme_selected_bg_color, 0.30);\n"
-"}\n"
-"\n"
-".gnome-disk-utility-grid:selected:backdrop {\n"
-" background-image: -gtk-gradient(radial,\n"
-" center center, 0,\n"
-" center center, 1,\n"
-" from(@theme_unfocused_selected_bg_color),\n"
-" to(shade (@theme_unfocused_selected_bg_color, 0.80)));\n"
-" -adwaita-focus-border-color: mix(@theme_unfocused_selected_fg_color, @theme_unfocused_selected_bg_color,
0.30);\n"
-"}\n"
-;
-
- provider = gtk_css_provider_new ();
- error = NULL;
- if (!gtk_css_provider_load_from_data (provider,
- css,
- -1,
- &error))
- {
- g_warning ("Can’t parse custom CSS: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- g_object_unref (provider);
-
- out:
- ;
-}
-
-
-static gint
-device_sort_function (GtkTreeModel *model,
- GtkTreeIter *a,
- GtkTreeIter *b,
- gpointer user_data)
-{
- gchar *sa, *sb;
- gint ret;
-
- gtk_tree_model_get (model, a,
- GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, &sa,
- -1);
- gtk_tree_model_get (model, b,
- GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, &sb,
- -1);
- ret = g_strcmp0 (sa, sb);
- g_free (sa);
- g_free (sb);
- return ret;
-}
-
static void
power_state_cell_func (GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
@@ -1171,71 +1039,60 @@ power_state_cell_func (GtkTreeViewColumn *column,
gtk_cell_renderer_set_visible (renderer, visible);
}
-static void
-selected_cell_func (GtkTreeViewColumn *column,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer user_data)
-{
- gboolean visible = FALSE;
- gboolean selected = FALSE;
- UDisksObject *object = NULL;
-
- gtk_tree_model_get (model,
- iter,
- GDU_DEVICE_TREE_MODEL_COLUMN_OBJECT, &object,
- GDU_DEVICE_TREE_MODEL_COLUMN_SELECTED, &selected,
- -1);
-
- if (object != NULL)
- visible = TRUE;
-
- gtk_cell_renderer_set_visible (renderer, visible);
- gtk_cell_renderer_toggle_set_active (GTK_CELL_RENDERER_TOGGLE (renderer), selected);
-
- g_clear_object (&object);
-}
-
-static void
-on_selected_toggled (GtkCellRendererToggle *renderer,
- const gchar *path_string,
- gpointer user_data)
-{
- GduWindow *window = GDU_WINDOW (user_data);
- GtkTreeIter iter;
-
- if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (window->model),
- &iter,
- path_string))
- goto out;
-
- gdu_device_tree_model_toggle_selected (window->model, &iter);
-
- update_all (window);
-
- out:
- ;
-}
-
-static gboolean
-device_tree_overlay_on_get_child_position (GtkOverlay *overlay,
- GtkWidget *widget,
- GdkRectangle *allocation,
- gpointer user_data)
-{
- //GduWindow *window = GDU_WINDOW (user_data);
- gint border = 16;
- gint height = 56;
-
- /* TODO: choose height so we get square buttons */
-
- allocation->x = border;
- allocation->y = gtk_widget_get_allocated_height (GTK_WIDGET (overlay)) - height - border;
- allocation->width = gtk_widget_get_allocated_width (GTK_WIDGET (overlay)) - 2 * border;
- allocation->height = height;
-
- return TRUE; /* allocation was filled in */
+/* TODO: load from .ui file */
+static GtkWidget *
+create_header (GduWindow *window)
+{
+ GtkWidget *header;
+ GtkWidget *button;
+ GtkWidget *image;
+
+ header = gtk_header_bar_new ();
+ gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
+
+ button = window->devtab_drive_raid_start_button = gtk_button_new ();
+ image = gtk_image_new_from_icon_name ("media-playback-start-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+
+ button = window->devtab_drive_raid_stop_button = gtk_button_new ();
+ image = gtk_image_new_from_icon_name ("media-playback-stop-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+
+ button = window->devtab_drive_loop_detach_button = gtk_button_new ();
+ image = gtk_image_new_from_icon_name ("list-remove-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+
+ button = window->devtab_drive_eject_button = gtk_button_new ();
+ image = gtk_image_new_from_icon_name ("media-eject-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+
+ button = window->devtab_drive_power_off_button = gtk_button_new ();
+ image = gtk_image_new_from_icon_name ("system-shutdown-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+
+ button = window->devtab_drive_generic_button = gtk_menu_button_new ();
+ gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), window->generic_drive_menu);
+ image = gtk_image_new_from_icon_name ("emblem-system-symbolic", GTK_ICON_SIZE_MENU);
+ gtk_widget_set_margin_left (image, 4);
+ gtk_widget_set_margin_right (image, 4);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+ return header;
}
static void
@@ -1269,24 +1126,19 @@ gdu_window_constructed (GObject *object)
g_warn_if_fail (*p != NULL);
}
- /* bah, glade deletes this property because it does not know about GtkOverlay :-/ */
- gtk_label_set_mnemonic_widget (GTK_LABEL (window->device_tree_selection_toolbar_label),
window->device_tree_treeview);
- gtk_label_set_mnemonic_widget (GTK_LABEL (window->device_tree_selection_toolbar_static_label),
window->device_tree_treeview);
+ window->header = create_header (window);
+ gtk_window_set_titlebar (GTK_WINDOW (window), window->header);
+ gtk_widget_show_all (window->header);
gtk_widget_reparent (window->main_hpane, GTK_WIDGET (window));
gtk_window_set_title (GTK_WINDOW (window), _("Disks"));
- /* Fortunately the window manager resizes the window if it's too tall for the monitor.. so 900 pixels is
fine */
- gtk_window_set_default_size (GTK_WINDOW (window), 800, 900);
+ gtk_window_set_default_size (GTK_WINDOW (window), 800, 700);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
- gtk_container_set_border_width (GTK_CONTAINER (window), 12);
-
- /* detach overlay toolbar and attach it to the right place - see also update_for_multi_selection() */
- gtk_widget_unparent (window->overlay_toolbar);
- gtk_overlay_add_overlay (GTK_OVERLAY (window->device_tree_overlay), window->overlay_toolbar);
- g_signal_connect (window->device_tree_overlay,
- "get-child-position",
- G_CALLBACK (device_tree_overlay_on_get_child_position),
- window);
+
+ /* set up mnemonic */
+ gtk_window_add_mnemonic (GTK_WINDOW (window),
+ 'd',
+ window->device_tree_treeview);
/* hide all children in the devtab list, otherwise the dialog is going to be huge by default */
children = gtk_container_get_children (GTK_CONTAINER (window->devtab_drive_table));
@@ -1308,9 +1160,6 @@ gdu_window_constructed (GObject *object)
context = gtk_widget_get_style_context (window->device_tree_scrolledwindow);
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
- context = gtk_widget_get_style_context (window->device_tree_selection_toolbar);
- //gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
window->model = gdu_device_tree_model_new (window->application,
GDU_DEVICE_TREE_MODEL_FLAGS_UPDATE_POWER_STATE |
@@ -1393,24 +1242,6 @@ gdu_window_constructed (GObject *object)
/* -------------------- */
- column = gtk_tree_view_column_new ();
- gtk_tree_view_append_column (GTK_TREE_VIEW (window->device_tree_treeview), column);
- renderer = gtk_cell_renderer_toggle_new ();
- //g_object_set (G_OBJECT (renderer), "indicator-size", 20, NULL);
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- selected_cell_func,
- window, /* user_data */
- NULL); /* user_data GDestroyNotify */
- window->selection_column = column;
- g_signal_connect (renderer,
- "toggled",
- G_CALLBACK (on_selected_toggled),
- window);
-
- /* -------------------- */
-
/* expand on insertion - hmm, I wonder if there's an easier way to do this */
g_signal_connect (window->model,
"row-inserted",
@@ -1441,74 +1272,64 @@ gdu_window_constructed (GObject *object)
gtk_widget_set_name (window->devtab_grid_toolbar, "devtab-grid-toolbar");
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
- /* main toolbar */
- g_signal_connect (window->device_tree_selection_toolbar_select_button,
+ /* toolbar buttons */
+ g_signal_connect (window->toolbutton_generic_menu,
"clicked",
- G_CALLBACK (on_device_tree_selection_toolbar_select_button_clicked),
+ G_CALLBACK (on_generic_tool_button_clicked),
window);
- g_signal_connect (window->device_tree_selection_toolbar_done_button,
+ g_signal_connect (window->toolbutton_partition_create,
"clicked",
- G_CALLBACK (on_device_tree_selection_toolbar_done_button_clicked),
+ G_CALLBACK (on_partition_create_tool_button_clicked),
window);
-
- /* actions */
- g_signal_connect (window->devtab_action_generic,
- "activate",
- G_CALLBACK (on_devtab_action_generic_activated),
- window);
- g_signal_connect (window->devtab_action_partition_create,
- "activate",
- G_CALLBACK (on_devtab_action_partition_create_activated),
- window);
- g_signal_connect (window->devtab_action_partition_delete,
- "activate",
- G_CALLBACK (on_devtab_action_partition_delete_activated),
+ g_signal_connect (window->toolbutton_partition_delete,
+ "clicked",
+ G_CALLBACK (on_partition_delete_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_mount,
- "activate",
- G_CALLBACK (on_devtab_action_mount_activated),
+ g_signal_connect (window->toolbutton_mount,
+ "clicked",
+ G_CALLBACK (on_mount_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_unmount,
- "activate",
- G_CALLBACK (on_devtab_action_unmount_activated),
+ g_signal_connect (window->toolbutton_unmount,
+ "clicked",
+ G_CALLBACK (on_unmount_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_unlock,
- "activate",
- G_CALLBACK (on_devtab_action_unlock_activated),
+ g_signal_connect (window->toolbutton_unlock,
+ "clicked",
+ G_CALLBACK (on_unlock_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_lock,
- "activate",
- G_CALLBACK (on_devtab_action_lock_activated),
+ g_signal_connect (window->toolbutton_lock,
+ "clicked",
+ G_CALLBACK (on_lock_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_activate_swap,
- "activate",
- G_CALLBACK (on_devtab_action_activate_swap_activated),
+ g_signal_connect (window->toolbutton_activate_swap,
+ "clicked",
+ G_CALLBACK (on_activate_swap_tool_button_clicked),
window);
- g_signal_connect (window->devtab_action_deactivate_swap,
- "activate",
- G_CALLBACK (on_devtab_action_deactivate_swap_activated),
+ g_signal_connect (window->toolbutton_deactivate_swap,
+ "clicked",
+ G_CALLBACK (on_deactivate_swap_tool_button_clicked),
window);
- /* drive actions */
- g_signal_connect (window->devtab_drive_action_raid_start,
- "activate",
- G_CALLBACK (on_devtab_drive_action_raid_start_activated),
+ /* drive buttons */
+ g_signal_connect (window->devtab_drive_raid_start_button,
+ "clicked",
+ G_CALLBACK (on_devtab_drive_raid_start_button_clicked),
window);
- g_signal_connect (window->devtab_drive_action_raid_stop,
- "activate",
- G_CALLBACK (on_devtab_drive_action_raid_stop_activated),
+ g_signal_connect (window->devtab_drive_raid_stop_button,
+ "clicked",
+ G_CALLBACK (on_devtab_drive_raid_stop_button_clicked),
window);
- g_signal_connect (window->devtab_drive_action_loop_detach,
- "activate",
- G_CALLBACK (on_devtab_drive_action_loop_detach_activated),
+ g_signal_connect (window->devtab_drive_loop_detach_button,
+ "clicked",
+ G_CALLBACK (on_devtab_drive_loop_detach_button_clicked),
window);
- g_signal_connect (window->devtab_drive_action_eject,
- "activate",
- G_CALLBACK (on_devtab_drive_action_eject_activated),
+ g_signal_connect (window->devtab_drive_eject_button,
+ "clicked",
+ G_CALLBACK (on_devtab_drive_eject_button_clicked),
window);
- g_signal_connect (window->devtab_drive_action_power_off,
- "activate",
- G_CALLBACK (on_devtab_drive_action_power_off_activated),
+ g_signal_connect (window->devtab_drive_power_off_button,
+ "clicked",
+ G_CALLBACK (on_devtab_drive_power_off_button_clicked),
window);
/* drive menu */
@@ -1629,20 +1450,7 @@ gdu_window_constructed (GObject *object)
G_CALLBACK (on_activate_link),
window);
- /* multiple-selection toolbar */
- g_signal_connect (window->overlay_toolbar_erase_button,
- "clicked",
- G_CALLBACK (on_overlay_toolbar_erase_button_clicked),
- window);
-
- /* Create RAID array */
- g_signal_connect (window->overlay_toolbar_create_raid_button,
- "clicked",
- G_CALLBACK (on_overlay_toolbar_create_raid_button_clicked),
- window);
-
ensure_something_selected (window);
- device_tree_selection_toolbar_select_done_toggle (window, FALSE);
gtk_widget_grab_focus (window->device_tree_treeview);
update_all (window);
@@ -1694,11 +1502,18 @@ gdu_window_constructed (GObject *object)
* The Shift modifier must not be translated or parsing will fail.
* You can however change to another English modifier (e.g. <Ctrl>).
*/
+ /* TODO: This results in
+ *
+ * Gtk-CRITICAL **: gtk_widget_set_accel_path: assertion 'GTK_WIDGET_GET_CLASS (widget)->activate_signal
!= 0' failed
+ *
+ * so comment it out for now.
+ */
+#if 0
gtk_accelerator_parse (C_("accelerator", "<Shift>F10"), &key, &mod);
gtk_accel_map_add_entry ("<Disks>/VolumeMenu", key, mod);
- gtk_action_set_accel_group (window->devtab_action_generic, accelgroup);
- gtk_action_set_accel_path (window->devtab_action_generic, "<Disks>/VolumeMenu");
- gtk_action_connect_accelerator (window->devtab_action_generic);
+ gtk_widget_set_accel_path (window->toolbutton_generic_menu, "<Disks>/VolumeMenu", accelgroup);
+#endif
+
/* Translators: This is the short-cut to format a volume.
* The Shift and Ctrl modifiers must not be translated or parsing will fail.
@@ -1942,7 +1757,6 @@ block_compare_on_preferred (UDisksObject *a,
/* ---------------------------------------------------------------------------------------------------- */
static void update_device_page (GduWindow *window, ShowFlags *show_flags);
-static void update_for_multi_selection (GduWindow *window, ShowFlags *show_flags);
/* Keep in sync with tabs in disks.ui file */
typedef enum
@@ -1979,8 +1793,6 @@ update_all (GduWindow *window)
}
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->details_notebook), page);
- update_for_multi_selection (window, &show_flags);
-
switch (page)
{
case DETAILS_PAGE_NOT_SELECTED:
@@ -2025,7 +1837,7 @@ get_device_file_for_display (UDisksBlock *block)
if (udisks_block_get_read_only (block))
{
/* Translators: Shown for a read-only device. The %s is the device file, e.g. /dev/sdb1 */
- ret = g_strdup_printf (_("%s <span size=\"smaller\">(Read-Only)</span>"),
+ ret = g_strdup_printf (_("%s (Read-Only)"),
udisks_block_get_preferred_device (block));
}
else
@@ -2410,23 +2222,9 @@ update_device_page_for_mdraid (GduWindow *window,
jobs = g_list_concat (jobs, gdu_application_get_local_jobs_for_object (window->application, object));
update_generic_drive_bits (window, block, jobs, show_flags);
- gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image),
- udisks_object_info_get_icon (info),
- GTK_ICON_SIZE_DIALOG);
- gtk_widget_show (window->devtab_drive_image);
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), desc);
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), device_desc);
- s = g_strdup_printf ("<big><b>%s</b></big>", desc);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
- gtk_widget_show (window->devtab_drive_desc_label);
- g_free (s);
- s = g_strdup_printf ("<small>%s</small>", device_desc);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
- gtk_widget_show (window->devtab_drive_devices_label);
- g_free (s);
-
- gtk_widget_show (window->devtab_drive_box);
- gtk_widget_show (window->devtab_drive_vbox);
- gtk_widget_show (window->devtab_drive_buttonbox);
gtk_widget_show (window->devtab_drive_generic_button);
/* -------------------------------------------------- */
@@ -2796,26 +2594,11 @@ update_device_page_for_drive (GduWindow *window,
g_string_append (str, s);
g_free (s);
}
- s = g_strdup_printf ("<big><b>%s</b></big>", udisks_object_info_get_description (info));
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
- gtk_widget_show (window->devtab_drive_desc_label);
- g_free (s);
- s = g_strdup_printf ("<small>%s</small>", str->str);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
- gtk_widget_show (window->devtab_drive_devices_label);
- g_free (s);
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), str->str);
g_string_free (str, TRUE);
- gtk_widget_show (window->devtab_drive_box);
- gtk_widget_show (window->devtab_drive_vbox);
- gtk_widget_show (window->devtab_drive_buttonbox);
gtk_widget_show (window->devtab_drive_generic_button);
- if (udisks_object_info_get_media_icon (info) != NULL)
- gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), udisks_object_info_get_media_icon
(info), GTK_ICON_SIZE_DIALOG);
- else
- gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image), udisks_object_info_get_icon (info),
GTK_ICON_SIZE_DIALOG);
- gtk_widget_show (window->devtab_drive_image);
-
str = g_string_new (NULL);
if (strlen (drive_vendor) == 0)
g_string_append (str, drive_model);
@@ -3028,23 +2811,9 @@ update_device_page_for_loop (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image),
- udisks_object_info_get_icon (info),
- GTK_ICON_SIZE_DIALOG);
- gtk_widget_show (window->devtab_drive_image);
-
- s = g_strdup_printf ("<big><b>%s</b></big>", udisks_object_info_get_description (info));
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
- gtk_widget_show (window->devtab_drive_desc_label);
- g_free (s);
- s = g_strdup_printf ("<small>%s</small>", device_desc);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
- gtk_widget_show (window->devtab_drive_devices_label);
- g_free (s);
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), device_desc);
- gtk_widget_show (window->devtab_drive_box);
- gtk_widget_show (window->devtab_drive_vbox);
- gtk_widget_show (window->devtab_drive_buttonbox);
gtk_widget_show (window->devtab_drive_generic_button);
update_generic_drive_bits (window, block, NULL, show_flags);
@@ -3086,7 +2855,6 @@ update_device_page_for_fake_block (GduWindow *window,
ShowFlags *show_flags)
{
UDisksObjectInfo *info = NULL;
- gchar *s = NULL;
gchar *device_desc = NULL;
gdu_volume_grid_set_no_media_string (GDU_VOLUME_GRID (window->volume_grid),
@@ -3095,23 +2863,9 @@ update_device_page_for_fake_block (GduWindow *window,
info = udisks_client_get_object_info (window->client, object);
device_desc = get_device_file_for_display (block);
- gtk_image_set_from_gicon (GTK_IMAGE (window->devtab_drive_image),
- udisks_object_info_get_icon (info),
- GTK_ICON_SIZE_DIALOG);
- gtk_widget_show (window->devtab_drive_image);
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), udisks_object_info_get_description (info));
+ gtk_header_bar_set_subtitle (GTK_HEADER_BAR (window->header), device_desc);
- s = g_strdup_printf ("<big><b>%s</b></big>", udisks_object_info_get_description (info));
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_desc_label), s);
- gtk_widget_show (window->devtab_drive_desc_label);
- g_free (s);
- s = g_strdup_printf ("<small>%s</small>", device_desc);
- gtk_label_set_markup (GTK_LABEL (window->devtab_drive_devices_label), s);
- gtk_widget_show (window->devtab_drive_devices_label);
- g_free (s);
-
- gtk_widget_show (window->devtab_drive_box);
- gtk_widget_show (window->devtab_drive_vbox);
- gtk_widget_show (window->devtab_drive_buttonbox);
gtk_widget_show (window->devtab_drive_generic_button);
update_generic_drive_bits (window, block, NULL, show_flags);
@@ -3587,17 +3341,12 @@ maybe_hide (GtkWidget *widget,
{
GduWindow *window = GDU_WINDOW (user_data);
- /* Don't hide drive box since visibility of its children (buttons)
- * are controlled in update_for_show_flags() - hiding it here only
- * to show it later may cause focus problems so the buttons can't
- * be clicked if the window is continously updated (say, a job is
- * running).
- *
- * Same for the grid containing the job widgets. Their visibility is
- * manually controlled in update_jobs().
+ /* Don't hide grid containing job widgets. The visibility of its
+ * children (e.g. buttons) are controlled in update_jobs() - hiding
+ * it here only to show it later may cause focus problems so the
+ * buttons can't be clicked if the window is continously updated.
*/
- if (widget == window->devtab_drive_box ||
- widget == window->devtab_drive_job_grid ||
+ if (widget == window->devtab_drive_job_grid ||
widget == window->devtab_job_grid)
{
/* do nothing */
@@ -3646,11 +3395,6 @@ update_device_page (GduWindow *window,
/* ensure grid is set to the right volumes */
device_page_ensure_grid (window);
- /* always show the generic toolbar item */
- gtk_action_set_visible (GTK_ACTION (gtk_builder_get_object (window->builder,
- "devtab-action-generic")), TRUE);
-
-
object = window->current_object;
block = udisks_object_peek_block (window->current_object);
drive = udisks_object_peek_drive (window->current_object);
@@ -4151,8 +3895,8 @@ on_generic_drive_menu_item_power_off (GtkMenuItem *menu_item,
}
static void
-on_devtab_drive_action_power_off_activated (GtkAction *action,
- gpointer user_data)
+on_devtab_drive_power_off_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
do_power_off (window);
@@ -4211,8 +3955,7 @@ mount_cb (UDisksFilesystem *filesystem,
}
static void
-on_devtab_action_mount_activated (GtkAction *action,
- gpointer user_data)
+on_mount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4251,8 +3994,7 @@ unmount_cb (UDisksFilesystem *filesystem,
}
static void
-on_devtab_action_unmount_activated (GtkAction *action,
- gpointer user_data)
+on_unmount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4336,8 +4078,7 @@ generic_menu_position_func (GtkMenu *menu,
}
static void
-on_devtab_action_generic_activated (GtkAction *action,
- gpointer user_data)
+on_generic_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
GdkEventButton *event = NULL;
@@ -4358,8 +4099,7 @@ on_devtab_action_generic_activated (GtkAction *action,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_devtab_action_partition_create_activated (GtkAction *action,
- gpointer user_data)
+on_partition_create_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4416,8 +4156,7 @@ partition_delete_ensure_unused_cb (GduWindow *window,
}
static void
-on_devtab_action_partition_delete_activated (GtkAction *action,
- gpointer user_data)
+on_partition_delete_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4486,8 +4225,8 @@ eject_ensure_unused_cb (GduWindow *window,
}
static void
-on_devtab_drive_action_eject_activated (GtkAction *action,
- gpointer user_data)
+on_devtab_drive_eject_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
gdu_window_ensure_unused (window,
@@ -4524,8 +4263,8 @@ mdraid_start_cb (UDisksMDRaid *mdraid,
}
static void
-on_devtab_drive_action_raid_start_activated (GtkAction *action,
- gpointer user_data)
+on_devtab_drive_raid_start_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
GVariantBuilder options_builder;
@@ -4583,8 +4322,8 @@ raid_stop_ensure_unused_cb (GduWindow *window,
}
static void
-on_devtab_drive_action_raid_stop_activated (GtkAction *action,
- gpointer user_data)
+on_devtab_drive_raid_stop_button_clicked (GtkButton *button,
+ gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksMDRaid *mdraid = NULL;
@@ -4618,8 +4357,7 @@ on_devtab_drive_action_raid_stop_activated (GtkAction *action,
/* ---------------------------------------------------------------------------------------------------- */
static void
-on_devtab_action_unlock_activated (GtkAction *action,
- gpointer user_data)
+on_unlock_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4671,8 +4409,7 @@ lock_ensure_unused_cb (GduWindow *window,
}
static void
-on_devtab_action_lock_activated (GtkAction *action,
- gpointer user_data)
+on_lock_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4718,7 +4455,7 @@ swapspace_start_cb (UDisksSwapspace *swapspace,
}
static void
-on_devtab_action_activate_swap_activated (GtkAction *action, gpointer user_data)
+on_activate_swap_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -4755,7 +4492,7 @@ swapspace_stop_cb (UDisksSwapspace *swapspace,
}
static void
-on_devtab_action_deactivate_swap_activated (GtkAction *action, gpointer user_data)
+on_deactivate_swap_tool_button_clicked (GtkToolButton *button, gpointer user_data)
{
GduWindow *window = GDU_WINDOW (user_data);
UDisksObject *object;
@@ -5034,143 +4771,6 @@ on_activate_link (GtkLabel *label,
/* ---------------------------------------------------------------------------------------------------- */
-static void
-update_for_multi_selection (GduWindow *window, ShowFlags *show_flags)
-{
- GList *selected;
- GList *selected_blocks;
- GList *l;
- guint num_disks = 0;
- guint num_blocks = 0;
- guint64 total_size = 0;
- guint64 total_size_block = 0;
- gchar *s, *s2;
-
- selected_blocks = gdu_device_tree_model_get_selected_blocks (window->model);
- for (l = selected_blocks; l != NULL; l = l->next)
- {
- UDisksBlock *block = UDISKS_BLOCK (l->data);
- total_size_block += udisks_block_get_size (block);
- num_blocks++;
- }
-
- selected = gdu_device_tree_model_get_selected (window->model);
- for (l = selected; l != NULL; l = l->next)
- {
- UDisksObject *object = UDISKS_OBJECT (l->data);
- UDisksDrive *drive = NULL;
- UDisksBlock *block = NULL;
- UDisksMDRaid *mdraid = NULL;
-
- drive = udisks_object_peek_drive (object);
- block = udisks_object_peek_block (object);
- mdraid = udisks_object_peek_mdraid (object);
-
- if (drive != NULL)
- {
- total_size += udisks_drive_get_size (drive);
- num_disks++;
- }
- else if (block != NULL)
- {
- total_size += udisks_block_get_size (block);
- num_disks++;
- }
- else if (mdraid != NULL)
- {
- total_size += udisks_mdraid_get_size (mdraid);
- num_disks++;
- }
- else
- {
- g_warning ("unhandled object of with path %s", g_dbus_object_get_object_path (G_DBUS_OBJECT
(object)));
- }
- }
-
- if (num_disks == 0)
- {
- /* Translators: Shown when no devices are selected but multiple selection is active.
- */
- s = g_strdup (C_("multi-disk-menu", "No _Devices Selected"));
- }
- else
- {
- s2 = udisks_client_get_size_for_display (window->client, total_size, FALSE, FALSE);
- /* Translators: Shown when N>=1 devices are selected.
- * The %d is the number of disks selected (e.g. 4).
- * The %s is a string with the combined size (e.g. '42.0 GB').
- */
- s = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
- "%d _Device Selected (%s)",
- "%d _Devices Selected (%s)",
- num_disks),
- num_disks, s2);
- g_free (s2);
- }
- gtk_label_set_markup_with_mnemonic (GTK_LABEL (window->device_tree_selection_toolbar_label), s);
- g_free (s);
-
- /* visibility - TODO: use ShowFlags instead */
- if (window->in_selection_mode && num_blocks > 0)
- {
- guint64 disk_size;
- gtk_widget_show (window->overlay_toolbar);
-
- gtk_widget_show (window->overlay_toolbar_erase_button);
-
- /* Createing a RAID array requires at all disks are the same size and that there are at least two of
them */
- if (gdu_util_is_same_size (selected_blocks, &disk_size) && num_blocks >= 2)
- {
- gtk_widget_show (window->overlay_toolbar_create_raid_button);
- }
- else
- {
- gtk_widget_hide (window->overlay_toolbar_create_raid_button);
- }
- }
- else
- {
- gtk_widget_hide (window->overlay_toolbar);
- }
-
- g_list_free_full (selected, g_object_unref);
- g_list_free_full (selected_blocks, g_object_unref);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-on_overlay_toolbar_erase_button_clicked (GtkButton *button,
- gpointer user_data)
-{
- GduWindow *window = GDU_WINDOW (user_data);
- GList *selected_blocks;
-
- selected_blocks = gdu_device_tree_model_get_selected_blocks (window->model);
- /* exit multiple selection mode UNLESS user cancelled */
- if (gdu_erase_multiple_disks_dialog_show (window, selected_blocks))
- device_tree_selection_toolbar_select_done_toggle (window, FALSE);
- g_list_free_full (selected_blocks, g_object_unref);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-on_overlay_toolbar_create_raid_button_clicked (GtkButton *button,
- gpointer user_data)
-{
- GduWindow *window = GDU_WINDOW (user_data);
- GList *selected_blocks;
-
- selected_blocks = gdu_device_tree_model_get_selected_blocks (window->model);
- /* exit multiple selection mode UNLESS user cancelled */
- if (gdu_create_raid_array_dialog_show (window, selected_blocks))
- device_tree_selection_toolbar_select_done_toggle (window, FALSE);
- g_list_free_full (selected_blocks, g_object_unref);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
typedef struct {
GSimpleAsyncResult *simple;
GduWindow *window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]