2009-11-05 11:08:32 -07:00
|
|
|
/* Copyright (C) 2004 Bart
|
2010-03-23 13:06:26 -06:00
|
|
|
* Copyright (C) 2008, 2009, 2010 Curtis Gedak
|
2004-09-19 14:24:53 -06:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-01-23 03:59:48 -07:00
|
|
|
* GNU General Public License for more details.
|
2004-09-19 14:24:53 -06:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 03:59:48 -07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2004-09-19 14:24:53 -06:00
|
|
|
*/
|
2016-10-18 16:45:28 -06:00
|
|
|
|
|
|
|
#include "Dialog_Partition_Info.h"
|
|
|
|
#include "LVM2_PV_Info.h"
|
|
|
|
#include "Partition.h"
|
|
|
|
#include "PartitionLUKS.h"
|
|
|
|
#include "Utils.h"
|
|
|
|
#include "btrfs.h"
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2018-12-04 09:46:27 -07:00
|
|
|
#include <glibmm/miscutils.h>
|
2014-04-25 10:04:33 -06:00
|
|
|
#include <gtkmm/alignment.h>
|
2018-08-27 12:18:55 -06:00
|
|
|
#include <gtkmm/viewport.h>
|
2019-03-13 05:06:22 -06:00
|
|
|
#include <gtkmm/grid.h>
|
2021-10-02 07:43:06 -06:00
|
|
|
#include <gtkmm/label.h>
|
|
|
|
#include <atkmm/relation.h>
|
2018-08-02 10:41:40 -06:00
|
|
|
#include <gdkmm/general.h>
|
2014-04-22 11:40:34 -06:00
|
|
|
|
2021-10-02 07:43:06 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
2015-05-24 04:23:06 -06:00
|
|
|
Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition ) : partition( partition )
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2015-12-28 12:21:58 -07:00
|
|
|
// Set minimum dialog height so it fits on an 800x600 screen without too much
|
|
|
|
// whitespace (~500 px max for GNOME desktop). Allow extra space if have any
|
|
|
|
// messages or for LVM2 PV or LUKS encryption.
|
2019-06-12 05:03:51 -06:00
|
|
|
if (partition.have_messages() ||
|
|
|
|
partition.fstype == FS_LVM2_PV ||
|
|
|
|
partition.fstype == FS_LUKS )
|
2014-04-14 12:56:51 -06:00
|
|
|
this ->set_size_request( -1, 460) ;
|
|
|
|
else
|
|
|
|
this ->set_size_request( -1, 370 ) ; //Minimum 370 to avoid scrolling on Fedora 20
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
/*TO TRANSLATORS: dialogtitle, looks like Information about /dev/hda3 */
|
2019-03-25 14:41:08 -06:00
|
|
|
this ->set_title( Glib::ustring::compose( _("Information about %1"), partition .get_path() ) );
|
2014-04-14 12:56:51 -06:00
|
|
|
|
2006-03-15 09:56:28 -07:00
|
|
|
init_drawingarea() ;
|
2014-04-14 12:56:51 -06:00
|
|
|
|
2019-02-27 08:26:58 -07:00
|
|
|
// Place info and optional messages in scrollable window
|
|
|
|
info_msg_vbox.set_orientation(Gtk::ORIENTATION_VERTICAL);
|
2014-04-14 12:56:51 -06:00
|
|
|
info_msg_vbox .set_border_width( 6 ) ;
|
|
|
|
info_scrolled .set_policy( Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC ) ;
|
2019-05-01 04:57:38 -06:00
|
|
|
#if HAVE_SET_PROPAGATE_NATURAL_WIDTH
|
|
|
|
info_scrolled.set_propagate_natural_width(true);
|
|
|
|
#endif
|
2014-04-14 12:56:51 -06:00
|
|
|
info_scrolled .add( info_msg_vbox ) ;
|
2019-02-27 08:26:58 -07:00
|
|
|
// As Gtk::Box widget info_msg_vbox doesn't have a native scrolling capability a
|
2014-04-22 11:40:34 -06:00
|
|
|
// Gtk::Viewport is automatically created to contain it when it is added to the
|
|
|
|
// Gtk::ScrolledWindow widget info_scrolled. The Viewport widget is created with
|
2018-08-27 12:18:55 -06:00
|
|
|
// shadow type GTK_SHADOW_IN by default. Change to GTK_SHADOW_NONE.
|
|
|
|
Gtk::Viewport * child_viewport = dynamic_cast<Gtk::Viewport *>(info_scrolled.get_child());
|
|
|
|
if (child_viewport)
|
|
|
|
child_viewport->set_shadow_type(Gtk::SHADOW_NONE);
|
2014-04-25 10:04:33 -06:00
|
|
|
//horizontally center the information scrolled window to match partition graphic
|
|
|
|
Gtk::Alignment * center_widget = manage( new Gtk::Alignment(0.5, 0.5, 0.0, 1.0) ) ;
|
|
|
|
center_widget ->add( info_scrolled ) ;
|
2018-05-09 02:21:26 -06:00
|
|
|
this->get_content_area()->pack_start(*center_widget);
|
2014-04-14 12:56:51 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
//add label for detail and fill with relevant info
|
2006-03-15 09:56:28 -07:00
|
|
|
Display_Info() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2006-07-30 09:13:41 -06:00
|
|
|
//display messages (if any)
|
2015-12-31 09:32:08 -07:00
|
|
|
if ( partition.have_messages() )
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2006-03-15 09:56:28 -07:00
|
|
|
frame = manage( new Gtk::Frame() );
|
2014-04-14 12:56:51 -06:00
|
|
|
|
2011-06-26 06:03:37 -06:00
|
|
|
{
|
2019-03-27 07:07:39 -06:00
|
|
|
Gtk::Image* image = Utils::mk_image(Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_BUTTON);
|
2011-06-26 06:03:37 -06:00
|
|
|
|
2019-02-27 08:26:58 -07:00
|
|
|
hbox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
2011-06-26 06:03:37 -06:00
|
|
|
hbox->pack_start(*image, Gtk::PACK_SHRINK);
|
|
|
|
}
|
|
|
|
|
2006-07-30 09:13:41 -06:00
|
|
|
hbox ->pack_start( * Utils::mk_label( "<b> " + Glib::ustring(_("Warning:") ) + " </b>" ),
|
2006-03-15 09:56:28 -07:00
|
|
|
Gtk::PACK_SHRINK ) ;
|
2006-07-30 09:13:41 -06:00
|
|
|
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
frame ->set_label_widget( *hbox ) ;
|
2011-06-26 06:03:37 -06:00
|
|
|
|
2015-12-31 09:32:08 -07:00
|
|
|
// Concatenate all messages for display so that they can be selected
|
|
|
|
// together. Use a blank line between individual messages so that each
|
|
|
|
// message can be distinguished. Therefore each message should have been
|
|
|
|
// formatted as one or more non-blank lines, with an optional trailing new
|
|
|
|
// line. This is true of GParted internal messages and probably all
|
|
|
|
// external messages and errors from libparted and executed commands too.
|
|
|
|
std::vector<Glib::ustring> messages = partition.get_messages();
|
|
|
|
Glib::ustring concatenated_messages;
|
|
|
|
for ( unsigned int i = 0; i < messages.size(); i ++ )
|
2011-06-26 06:03:37 -06:00
|
|
|
{
|
2015-12-31 09:32:08 -07:00
|
|
|
if ( concatenated_messages.size() > 0 )
|
|
|
|
concatenated_messages += "\n\n";
|
2011-06-26 06:03:37 -06:00
|
|
|
|
2022-08-12 01:38:16 -06:00
|
|
|
concatenated_messages += "<i>" + Utils::trim_trailing_new_line(messages[i]) + "</i>";
|
2011-06-26 06:03:37 -06:00
|
|
|
}
|
2019-02-27 08:26:58 -07:00
|
|
|
Gtk::Box *vbox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
|
2013-10-10 02:31:32 -06:00
|
|
|
vbox ->set_border_width( 5 ) ;
|
2015-12-31 09:32:08 -07:00
|
|
|
vbox->pack_start( *Utils::mk_label( concatenated_messages, true, true, true ), Gtk::PACK_SHRINK );
|
2013-10-10 02:31:32 -06:00
|
|
|
frame ->add( *vbox ) ;
|
2011-06-26 06:03:37 -06:00
|
|
|
|
2014-04-14 12:56:51 -06:00
|
|
|
info_msg_vbox .pack_start( *frame, Gtk::PACK_EXPAND_WIDGET ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
2014-04-14 12:56:51 -06:00
|
|
|
|
2004-10-23 04:41:17 -06:00
|
|
|
this ->add_button( Gtk::Stock::CLOSE, Gtk::RESPONSE_OK ) ;
|
2006-03-15 09:56:28 -07:00
|
|
|
this ->show_all_children() ;
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-03 11:25:57 -06:00
|
|
|
bool Dialog_Partition_Info::drawingarea_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2019-02-20 04:20:20 -07:00
|
|
|
Gdk::Cairo::set_source_rgba(cr, color_partition);
|
2018-08-02 10:41:40 -06:00
|
|
|
cr->rectangle(0, 0, 400, 60);
|
|
|
|
cr->fill();
|
|
|
|
|
2019-06-12 05:03:51 -06:00
|
|
|
if (partition.fstype != FS_UNALLOCATED)
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2018-08-02 10:41:40 -06:00
|
|
|
// Used
|
2019-02-20 04:20:20 -07:00
|
|
|
Gdk::Cairo::set_source_rgba(cr, color_used);
|
2018-08-02 10:41:40 -06:00
|
|
|
cr->rectangle(BORDER,
|
|
|
|
BORDER,
|
|
|
|
used,
|
|
|
|
60 - 2 * BORDER);
|
|
|
|
cr->fill();
|
|
|
|
|
|
|
|
// Unused
|
2019-02-20 04:20:20 -07:00
|
|
|
Gdk::Cairo::set_source_rgba(cr, color_unused);
|
2018-08-02 10:41:40 -06:00
|
|
|
cr->rectangle(BORDER + used,
|
|
|
|
BORDER,
|
|
|
|
unused,
|
|
|
|
60 - 2 * BORDER);
|
|
|
|
cr->fill();
|
|
|
|
|
|
|
|
// Unallocated
|
2019-02-20 04:20:20 -07:00
|
|
|
Gdk::Cairo::set_source_rgba(cr, color_unallocated);
|
2018-08-02 10:41:40 -06:00
|
|
|
cr->rectangle(BORDER + used + unused,
|
|
|
|
BORDER,
|
|
|
|
unallocated,
|
|
|
|
60 - 2 * BORDER);
|
|
|
|
cr->fill();
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
2018-08-02 10:41:40 -06:00
|
|
|
|
|
|
|
// Text
|
2019-02-20 04:20:20 -07:00
|
|
|
Gdk::Cairo::set_source_rgba(cr, color_text);
|
2018-08-02 10:41:40 -06:00
|
|
|
cr->move_to(180, BORDER + 6);
|
|
|
|
pango_layout->show_in_cairo_context(cr);
|
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-03-15 09:56:28 -07:00
|
|
|
void Dialog_Partition_Info::init_drawingarea()
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2006-01-24 16:37:59 -07:00
|
|
|
drawingarea .set_size_request( 400, 60 ) ;
|
2018-08-03 11:25:57 -06:00
|
|
|
drawingarea.signal_draw().connect(sigc::mem_fun(*this, &Dialog_Partition_Info::drawingarea_on_draw));
|
|
|
|
|
2006-03-15 09:56:28 -07:00
|
|
|
frame = manage( new Gtk::Frame() ) ;
|
2004-10-23 04:41:17 -06:00
|
|
|
frame ->add( drawingarea ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2004-10-23 04:41:17 -06:00
|
|
|
frame ->set_shadow_type( Gtk::SHADOW_ETCHED_OUT ) ;
|
|
|
|
frame ->set_border_width( 10 ) ;
|
2019-02-27 08:26:58 -07:00
|
|
|
hbox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
|
2004-09-19 14:24:53 -06:00
|
|
|
hbox ->pack_start( *frame, Gtk::PACK_EXPAND_PADDING ) ;
|
2018-05-09 02:21:26 -06:00
|
|
|
|
|
|
|
this->get_content_area()->pack_start(*hbox, Gtk::PACK_SHRINK);
|
|
|
|
|
2012-01-10 07:44:03 -07:00
|
|
|
//calculate proportional width of used, unused and unallocated
|
2018-10-14 06:27:58 -06:00
|
|
|
if (partition.type == TYPE_EXTENDED)
|
2012-01-10 07:44:03 -07:00
|
|
|
{
|
|
|
|
//Specifically show extended partitions as unallocated
|
|
|
|
used = 0 ;
|
|
|
|
unused = 0 ;
|
|
|
|
unallocated = 400 - BORDER *2 ;
|
|
|
|
}
|
Don't show intrinsic unallocated space (#499202)
Most file systems report intrinsic unallocated space using the statvfs()
system call when mounted, but not using their own tools. They are:
ext2/3/4, fat16/32, hfs, nilfs2, reiserfs and xfs. Showing either a
little or no unallocated space, depending on whether a file system is
mounted or not, could be confusing to the user.
When all file systems are created filling their partitions the unused
figure reported by statvfs() and their own tools are the same or very
close. Also the used plus unallocated figure from statvfs() agrees with
the used figure from their own tools.
For all file systems don't display intrinsic unallocated space (that
below the threshold of 2 to 5%), instead include it as used space. As
soon as the amount of unallocated space becomes significant display it
everywhere and also trigger the warning.
For display purposes always use the new Partition methods:
get_sectors_used(), get_sectors_unused(), and get_sectors_unallocated().
When calculating new usage figures during Paste and Resize/Move
operations directly access sectors_used, sectors_unused and
sectors_unallocated members.
Bug #499202 - gparted does not see the difference if partition size
differs from filesystem size
2012-06-15 06:16:30 -06:00
|
|
|
else if ( partition .sector_usage_known() )
|
2012-01-10 07:44:03 -07:00
|
|
|
{
|
2012-06-21 14:47:11 -06:00
|
|
|
partition .get_usage_triple( 400 - BORDER *2, used, unused, unallocated ) ;
|
2012-01-10 07:44:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Specifically show unknown figures as unused
|
|
|
|
used = 0 ;
|
|
|
|
unused = 400 - BORDER *2 ;
|
|
|
|
unallocated = 0 ;
|
|
|
|
}
|
2004-09-19 14:24:53 -06:00
|
|
|
|
2018-08-02 10:41:40 -06:00
|
|
|
// Colors
|
|
|
|
color_used.set("#F8F8BA");
|
|
|
|
color_unused.set("white");
|
|
|
|
color_unallocated.set("darkgrey");
|
|
|
|
color_text.set("black");
|
2019-06-12 05:03:51 -06:00
|
|
|
color_partition.set(Utils::get_color(partition.get_filesystem_partition().fstype));
|
2018-08-02 10:41:40 -06:00
|
|
|
|
2004-09-19 14:24:53 -06:00
|
|
|
//set text of pangolayout
|
2006-01-24 16:37:59 -07:00
|
|
|
pango_layout = drawingarea .create_pango_layout(
|
2010-04-28 09:11:44 -06:00
|
|
|
partition .get_path() + "\n" + Utils::format_size( partition .get_sector_length(), partition .sector_size ) ) ;
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
|
|
|
|
2006-03-15 09:56:28 -07:00
|
|
|
void Dialog_Partition_Info::Display_Info()
|
2014-03-30 10:33:17 -06:00
|
|
|
{
|
|
|
|
//The information in this area is in table format.
|
|
|
|
//
|
|
|
|
//For example:
|
2014-04-13 13:14:31 -06:00
|
|
|
//<-------------------------- Column Numbers ----------------------------->
|
|
|
|
//0 1 2 3 4 5 6
|
|
|
|
//+-+------------+-------------+-------------+------------+---------------+
|
2014-03-30 10:33:17 -06:00
|
|
|
//Section
|
2014-04-13 13:14:31 -06:00
|
|
|
// Field Left: Value Left Field Right: Value Right Optional Right
|
|
|
|
//+-+------------+-------------+-------------+------------+---------------+
|
|
|
|
//0 1 2 3 4 5 6
|
2014-03-30 10:33:17 -06:00
|
|
|
|
2016-09-06 00:33:26 -06:00
|
|
|
// Refers to the Partition object containing the file system. Either the same as
|
|
|
|
// partition, or for an open LUKS mapping, the encrypted Partition object member
|
|
|
|
// within containing the encrypted file system.
|
|
|
|
const Partition & filesystem_ptn = partition.get_filesystem_partition();
|
|
|
|
|
2012-01-10 07:44:03 -07:00
|
|
|
Sector ptn_sectors = partition .get_sector_length() ;
|
2014-03-29 13:55:47 -06:00
|
|
|
|
|
|
|
Glib::ustring vgname = "" ; //Also used in partition status message
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype == FS_LVM2_PV)
|
2016-09-06 00:33:26 -06:00
|
|
|
vgname = LVM2_PV_Info::get_vg_name( filesystem_ptn.get_path() );
|
2015-12-28 12:21:58 -07:00
|
|
|
|
|
|
|
bool filesystem_accessible = false;
|
2019-06-12 05:03:51 -06:00
|
|
|
if (partition.fstype != FS_LUKS || partition.busy)
|
2015-12-28 12:21:58 -07:00
|
|
|
// As long as this is not a LUKS encrypted partition which is closed the
|
|
|
|
// file system is accessible.
|
|
|
|
filesystem_accessible = true;
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
Gtk::Grid *grid(Gtk::manage(new Gtk::Grid()));
|
2012-07-01 02:57:52 -06:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
grid->set_border_width(5);
|
|
|
|
grid->set_column_spacing(10);
|
|
|
|
info_msg_vbox.pack_start(*grid, Gtk::PACK_SHRINK);
|
2011-06-26 06:03:37 -06:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// FILE SYSTEM DETAIL SECTION
|
|
|
|
// File system headline
|
|
|
|
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("File System")) + "</b>"), 0, 0, 6, 1);
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Initialize grid top attach tracker (left side of the grid)
|
|
|
|
int top = 1;
|
2014-03-30 10:33:17 -06:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Left field & value pair area
|
|
|
|
// File system
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_filesystem = Utils::mk_label("<b>" + Glib::ustring(_("File system:")) + "</b>");
|
|
|
|
grid->attach(*label_filesystem, 1, top, 1, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
if ( filesystem_accessible )
|
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_filesystem = Utils::mk_label(Utils::get_filesystem_string(filesystem_ptn.fstype),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_filesystem, 2, top, 1, 1);
|
|
|
|
value_filesystem->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_filesystem->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
}
|
2019-03-13 05:06:22 -06:00
|
|
|
top++;
|
2008-04-07 13:41:18 -06:00
|
|
|
|
2014-03-29 13:55:47 -06:00
|
|
|
//label
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype != FS_UNALLOCATED && filesystem_ptn.type != TYPE_EXTENDED)
|
2004-09-28 15:12:20 -06:00
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_label = Utils::mk_label("<b>" + Glib::ustring(_("Label:")) + "</b>");
|
|
|
|
grid->attach(*label_label, 1, top, 1, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
if ( filesystem_accessible )
|
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_label = Utils::mk_label(filesystem_ptn.get_filesystem_label(),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_label, 2, top, 1, 1);
|
|
|
|
value_label->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_label->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
}
|
2019-03-13 05:06:22 -06:00
|
|
|
top++;
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
2012-07-07 02:32:35 -06:00
|
|
|
|
2015-12-28 12:21:58 -07:00
|
|
|
// file system uuid
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype != FS_UNALLOCATED && filesystem_ptn.type != TYPE_EXTENDED)
|
2004-09-28 15:12:20 -06:00
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_uuid = Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>");
|
|
|
|
grid->attach(*label_uuid, 1, top, 1, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
if ( filesystem_accessible )
|
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_uuid = Utils::mk_label(filesystem_ptn.uuid, true, false, true);
|
|
|
|
grid->attach(*value_uuid, 2, top, 1, 1);
|
|
|
|
value_uuid->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_uuid->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
}
|
2019-03-13 05:06:22 -06:00
|
|
|
top++;
|
2004-09-28 15:12:20 -06:00
|
|
|
}
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2015-12-28 12:21:58 -07:00
|
|
|
/* TO TRANSLATORS: Open
|
|
|
|
* means that the LUKS encryption is open and the encrypted data within is accessible.
|
|
|
|
*/
|
|
|
|
static Glib::ustring luks_open = _("Open");
|
|
|
|
/* TO TRANSLATORS: Closed
|
|
|
|
* means that the LUKS encryption is closed and the encrypted data within is not accessible.
|
|
|
|
*/
|
|
|
|
static Glib::ustring luks_closed = _("Closed");
|
|
|
|
|
2014-03-29 13:55:47 -06:00
|
|
|
//status
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype != FS_UNALLOCATED && filesystem_ptn.status != STAT_NEW)
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
2004-09-28 15:12:20 -06:00
|
|
|
//status
|
2004-10-02 03:39:16 -06:00
|
|
|
Glib::ustring str_temp ;
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_status = Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>",
|
|
|
|
true, false, false, Gtk::ALIGN_START);
|
|
|
|
grid->attach(*label_status, 1, top, 1, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
if ( ! filesystem_accessible )
|
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Not accessible (Encrypted)
|
|
|
|
* means that the data in encrypted and hasn't been made
|
|
|
|
* accessible by opening it with the passphrase.
|
|
|
|
*/
|
|
|
|
str_temp = _("Not accessible (Encrypted)");
|
|
|
|
}
|
2016-09-06 00:33:26 -06:00
|
|
|
else if ( filesystem_ptn.busy )
|
2005-12-08 10:03:29 -07:00
|
|
|
{
|
2016-09-06 00:33:26 -06:00
|
|
|
if ( filesystem_ptn.type == TYPE_EXTENDED )
|
2010-10-12 18:14:30 -06:00
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Busy (At least one logical partition is mounted)
|
|
|
|
* means that this extended partition contains at least one logical
|
|
|
|
* partition that is mounted or otherwise active.
|
|
|
|
*/
|
2014-03-29 13:55:47 -06:00
|
|
|
str_temp = _("Busy (At least one logical partition is mounted)") ;
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
2019-06-12 05:03:51 -06:00
|
|
|
else if (filesystem_ptn.fstype == FS_LINUX_SWAP ||
|
|
|
|
filesystem_ptn.fstype == FS_LINUX_SWRAID ||
|
|
|
|
filesystem_ptn.fstype == FS_ATARAID ||
|
2022-01-07 03:08:20 -07:00
|
|
|
filesystem_ptn.fstype == FS_LVM2_PV ||
|
Report busy status of jbds (#89)
Continuing from the state in the previous commit, create an ext4 file
system using the previously created external journal and mount it.
# mke2fs -t ext4 -J device=/dev/sdb1 -L test-ext4 /dev/sdb2
# mount /dev/sdb2 /mnt/2
Did some experimenting with trying to create a second file system using
the same external journal which is already in use.
# mke2fs -t ext4 -J device=/dev/sdb1 -L 2nd-test-ext4 /dev/sdb3
...
/dev/sdb1 is apparently in use by the system; will not make a journal here!
# exit $?
1
Examined the source code of mke2fs and found that it performs an
exclusive read-only open of the named journal block device to check if
it is in use by the system or not [1]. Use the same method in GParted.
Not used alternative method would be to mark the jbd active when the
ext3/4 file system using it is active, but that requires working out the
linkage between them. That can be done using either blkid or dumpe2fs
output but that involves parsing more fields and caching more data so is
much more code than just testing the block device busy status using the
same method which mke2fs uses.
Matching UUIDs via blkid output.
# blkid /dev/sdb1 /dev/sdb2
/dev/sdb1: LABEL="test-jbd" UUID="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="jbd"
/dev/sdb2: LABEL="test-ext4" UUID="cea5c2cd-b21c-4abf-a497-8c073bb12300" EXT_JOURNAL="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="ext4"
Matching UUIDs via dumpe2fs output.
# dumpe2fs -h /dev/sdb1 | egrep 'Filesystem UUID|Journal users'
dumpe2fs 1.46.3 (27-Jul-2021)
Filesystem UUID: 6e52858e-0479-432f-80a1-de42f9a4093e
Journal users: cea5c2cd-b21c-4abf-a497-8c073bb12300
# dumpe2fs -h /dev/sdb2 | egrep 'Filesystem UUID|Journal UUID'
dumpe2fs 1.46.3 (27-Jul-2021)
Filesystem UUID: cea5c2cd-b21c-4abf-a497-8c073bb12300
Journal UUID: 6e52858e-0479-432f-80a1-de42f9a4093e
If GParted was going to show the journal to file system linkage in the
UI then doing this would be needed. However so far there has only been
a single reported case of a GParted user using an external journal,
therefore adding the code complexity for this feature is not currently
justified. The simple busy detection method used by mke2fs is all that
is needed.
[1] mke2fs source code
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/
misc/mke2fs.c:main()
check_mount(journal_device, force, _("journal"));
misc/util.c:check_mount()
ext2fs_check_if_mounted(device, &mount_flags);
lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
ext2fs_check_mount_point(file, mount_flags, NULL, 0);
lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
if (stat(device, &st_buf) == 0 &&
ext2fsP_is_disk_device(st_buf.st_mode)) {
int fd = open(device, O_RDONLY | O_EXCL);
if (fd >= 0) {
/*
* The device is not busy so it's
* definitelly not mounted. No need to
* to perform any more checks.
*/
close(fd);
*mount_flags = 0;
return 0;
} else if (errno == EBUSY) {
busy = 1;
}
}
Closes #89 - GParted doesn't recognise EXT4 fs journal partition
2022-01-25 15:31:55 -07:00
|
|
|
filesystem_ptn.fstype == FS_BCACHE ||
|
|
|
|
filesystem_ptn.fstype == FS_JBD )
|
2010-10-12 18:14:30 -06:00
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Active
|
2014-04-25 10:24:08 -06:00
|
|
|
* means that this linux swap, linux software raid partition, or
|
|
|
|
* LVM physical volume is enabled and being used by the operating system.
|
2010-10-12 18:14:30 -06:00
|
|
|
*/
|
2005-12-08 10:03:29 -07:00
|
|
|
str_temp = _("Active") ;
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
2019-06-12 05:03:51 -06:00
|
|
|
else if (filesystem_ptn.fstype == FS_LUKS)
|
2015-12-28 12:21:58 -07:00
|
|
|
{
|
|
|
|
// NOTE: LUKS within LUKS
|
|
|
|
// Only ever display LUKS information in the file system
|
|
|
|
// section when the contents of a LUKS encryption is
|
|
|
|
// another LUKS encryption!
|
|
|
|
str_temp = luks_open;
|
|
|
|
}
|
2016-09-06 00:33:26 -06:00
|
|
|
else if ( filesystem_ptn.get_mountpoints().size() )
|
2010-10-12 18:14:30 -06:00
|
|
|
{
|
2019-03-25 14:41:08 -06:00
|
|
|
str_temp = Glib::ustring::compose(
|
2010-10-12 18:14:30 -06:00
|
|
|
/* TO TRANSLATORS: looks like Mounted on /mnt/mymountpoint */
|
|
|
|
_("Mounted on %1"),
|
2016-09-06 00:33:26 -06:00
|
|
|
Glib::build_path( ", ", filesystem_ptn.get_mountpoints() ) );
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
2005-12-08 10:03:29 -07:00
|
|
|
}
|
2016-09-06 00:33:26 -06:00
|
|
|
else if ( filesystem_ptn.type == TYPE_EXTENDED )
|
2010-10-12 18:14:30 -06:00
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Not busy (There are no mounted logical partitions)
|
|
|
|
* means that this extended partition contains no mounted or otherwise
|
|
|
|
* active partitions.
|
|
|
|
*/
|
2006-03-15 09:56:28 -07:00
|
|
|
str_temp = _("Not busy (There are no mounted logical partitions)") ;
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
2019-06-12 05:03:51 -06:00
|
|
|
else if (filesystem_ptn.fstype == FS_LINUX_SWAP ||
|
|
|
|
filesystem_ptn.fstype == FS_LINUX_SWRAID ||
|
2022-01-07 03:08:20 -07:00
|
|
|
filesystem_ptn.fstype == FS_ATARAID ||
|
Report busy status of jbds (#89)
Continuing from the state in the previous commit, create an ext4 file
system using the previously created external journal and mount it.
# mke2fs -t ext4 -J device=/dev/sdb1 -L test-ext4 /dev/sdb2
# mount /dev/sdb2 /mnt/2
Did some experimenting with trying to create a second file system using
the same external journal which is already in use.
# mke2fs -t ext4 -J device=/dev/sdb1 -L 2nd-test-ext4 /dev/sdb3
...
/dev/sdb1 is apparently in use by the system; will not make a journal here!
# exit $?
1
Examined the source code of mke2fs and found that it performs an
exclusive read-only open of the named journal block device to check if
it is in use by the system or not [1]. Use the same method in GParted.
Not used alternative method would be to mark the jbd active when the
ext3/4 file system using it is active, but that requires working out the
linkage between them. That can be done using either blkid or dumpe2fs
output but that involves parsing more fields and caching more data so is
much more code than just testing the block device busy status using the
same method which mke2fs uses.
Matching UUIDs via blkid output.
# blkid /dev/sdb1 /dev/sdb2
/dev/sdb1: LABEL="test-jbd" UUID="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="jbd"
/dev/sdb2: LABEL="test-ext4" UUID="cea5c2cd-b21c-4abf-a497-8c073bb12300" EXT_JOURNAL="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="ext4"
Matching UUIDs via dumpe2fs output.
# dumpe2fs -h /dev/sdb1 | egrep 'Filesystem UUID|Journal users'
dumpe2fs 1.46.3 (27-Jul-2021)
Filesystem UUID: 6e52858e-0479-432f-80a1-de42f9a4093e
Journal users: cea5c2cd-b21c-4abf-a497-8c073bb12300
# dumpe2fs -h /dev/sdb2 | egrep 'Filesystem UUID|Journal UUID'
dumpe2fs 1.46.3 (27-Jul-2021)
Filesystem UUID: cea5c2cd-b21c-4abf-a497-8c073bb12300
Journal UUID: 6e52858e-0479-432f-80a1-de42f9a4093e
If GParted was going to show the journal to file system linkage in the
UI then doing this would be needed. However so far there has only been
a single reported case of a GParted user using an external journal,
therefore adding the code complexity for this feature is not currently
justified. The simple busy detection method used by mke2fs is all that
is needed.
[1] mke2fs source code
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/
misc/mke2fs.c:main()
check_mount(journal_device, force, _("journal"));
misc/util.c:check_mount()
ext2fs_check_if_mounted(device, &mount_flags);
lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
ext2fs_check_mount_point(file, mount_flags, NULL, 0);
lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
if (stat(device, &st_buf) == 0 &&
ext2fsP_is_disk_device(st_buf.st_mode)) {
int fd = open(device, O_RDONLY | O_EXCL);
if (fd >= 0) {
/*
* The device is not busy so it's
* definitelly not mounted. No need to
* to perform any more checks.
*/
close(fd);
*mount_flags = 0;
return 0;
} else if (errno == EBUSY) {
busy = 1;
}
}
Closes #89 - GParted doesn't recognise EXT4 fs journal partition
2022-01-25 15:31:55 -07:00
|
|
|
filesystem_ptn.fstype == FS_BCACHE ||
|
|
|
|
filesystem_ptn.fstype == FS_JBD )
|
2010-10-12 18:14:30 -06:00
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Not active
|
2013-11-27 11:52:51 -07:00
|
|
|
* means that this linux swap or linux software raid partition
|
|
|
|
* is not enabled and is not in use by the operating system.
|
2010-10-12 18:14:30 -06:00
|
|
|
*/
|
2006-03-15 09:56:28 -07:00
|
|
|
str_temp = _("Not active") ;
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
2019-06-12 05:03:51 -06:00
|
|
|
else if (filesystem_ptn.fstype == FS_LUKS)
|
2015-12-28 12:21:58 -07:00
|
|
|
{
|
|
|
|
// NOTE: LUKS within LUKS
|
|
|
|
str_temp = luks_closed;
|
|
|
|
}
|
2019-06-12 05:03:51 -06:00
|
|
|
else if (filesystem_ptn.fstype == FS_LVM2_PV)
|
2012-01-05 15:57:27 -07:00
|
|
|
{
|
2012-07-07 02:32:35 -06:00
|
|
|
if ( vgname .empty() )
|
2012-02-12 06:41:41 -07:00
|
|
|
/* TO TRANSLATORS: Not active (Not a member of any volume group)
|
|
|
|
* means that the partition is not yet a member of an LVM volume
|
2012-01-05 15:57:27 -07:00
|
|
|
* group and therefore is not active and can not yet be used by
|
|
|
|
* the operating system.
|
|
|
|
*/
|
2012-02-12 06:41:41 -07:00
|
|
|
str_temp = _("Not active (Not a member of any volume group)") ;
|
2015-06-05 13:54:37 -06:00
|
|
|
else if ( LVM2_PV_Info::is_vg_exported( vgname ) )
|
2014-04-25 10:24:08 -06:00
|
|
|
/* TO TRANSLATORS: Not active and exported
|
2012-02-12 06:41:41 -07:00
|
|
|
* means that the partition is a member of an LVM volume group but
|
|
|
|
* the volume group is not active and not being used by the operating system.
|
|
|
|
* The volume group has also been exported making the LVM physical volumes
|
|
|
|
* ready for moving to a different computer system.
|
|
|
|
*/
|
2014-04-25 10:24:08 -06:00
|
|
|
str_temp = _("Not active and exported") ;
|
2012-01-05 15:57:27 -07:00
|
|
|
else
|
2014-04-25 10:24:08 -06:00
|
|
|
/* TO TRANSLATORS: Not active
|
2012-02-12 06:41:41 -07:00
|
|
|
* means that the partition is a member of an LVM volume group but
|
2012-01-05 15:57:27 -07:00
|
|
|
* the volume group is not active and not being used by the operating system.
|
|
|
|
*/
|
2014-04-25 10:24:08 -06:00
|
|
|
str_temp = _("Not active") ;
|
2012-01-05 15:57:27 -07:00
|
|
|
}
|
2010-10-12 18:14:30 -06:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* TO TRANSLATORS: Not mounted
|
|
|
|
* means that this partition is not mounted.
|
|
|
|
*/
|
2006-03-15 09:56:28 -07:00
|
|
|
str_temp = _("Not mounted") ;
|
2010-10-12 18:14:30 -06:00
|
|
|
}
|
|
|
|
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_status = Utils::mk_label(str_temp, true, true, true);
|
|
|
|
grid->attach(*value_status, 2, top++, 1, 1);
|
|
|
|
value_status->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_status->get_accessible());
|
2004-09-28 15:12:20 -06:00
|
|
|
}
|
2008-04-07 13:41:18 -06:00
|
|
|
|
2014-05-16 13:32:37 -06:00
|
|
|
//Optional, LVM2 Volume Group name
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype == FS_LVM2_PV)
|
2008-04-07 13:41:18 -06:00
|
|
|
{
|
2019-03-13 05:06:22 -06:00
|
|
|
// Volume Group
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_volume_group = Utils::mk_label("<b>" + Glib::ustring(_("Volume Group:")) + "</b>");
|
|
|
|
grid->attach(*label_volume_group, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_volume_group = Utils::mk_label(vgname, true, false, true);
|
|
|
|
grid->attach(*value_volume_group, 2, top++, 1, 1);
|
|
|
|
value_volume_group->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_volume_group->get_accessible());
|
2014-05-16 13:32:37 -06:00
|
|
|
}
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2014-05-16 13:32:37 -06:00
|
|
|
//Optional, members of multi-device file systems
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype == FS_LVM2_PV ||
|
|
|
|
filesystem_ptn.fstype == FS_BTRFS )
|
2014-05-16 13:32:37 -06:00
|
|
|
{
|
2019-03-13 05:06:22 -06:00
|
|
|
// Members
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_members = Utils::mk_label("<b>" + Glib::ustring(_("Members:")) + "</b>",
|
|
|
|
true, false, false, Gtk::ALIGN_START);
|
|
|
|
grid->attach(*label_members, 1, top, 1, 1);
|
2014-03-29 13:55:47 -06:00
|
|
|
|
|
|
|
std::vector<Glib::ustring> members ;
|
2019-06-12 05:03:51 -06:00
|
|
|
switch (filesystem_ptn.fstype)
|
2014-05-16 13:32:37 -06:00
|
|
|
{
|
|
|
|
case FS_BTRFS:
|
2016-09-06 00:33:26 -06:00
|
|
|
members = btrfs::get_members( filesystem_ptn.get_path() );
|
2014-05-16 13:32:37 -06:00
|
|
|
break ;
|
|
|
|
case FS_LVM2_PV:
|
|
|
|
if ( ! vgname .empty() )
|
2015-06-05 13:54:37 -06:00
|
|
|
members = LVM2_PV_Info::get_vg_members( vgname );
|
2014-05-16 13:32:37 -06:00
|
|
|
break ;
|
|
|
|
default:
|
|
|
|
break ;
|
|
|
|
}
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_members = Utils::mk_label(Glib::build_path("\n", members), true, false, true);
|
|
|
|
grid->attach(*value_members, 2, top++, 1, 1);
|
|
|
|
value_members->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_members->get_accessible());
|
2014-03-29 13:55:47 -06:00
|
|
|
}
|
|
|
|
|
2019-06-12 05:03:51 -06:00
|
|
|
if (filesystem_ptn.fstype == FS_LVM2_PV)
|
2015-09-06 13:46:31 -06:00
|
|
|
{
|
2019-03-13 05:06:22 -06:00
|
|
|
// Logical Volumes
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_logical_volumes = Utils::mk_label("<b>" + Glib::ustring(_("Logical Volumes:")) + "</b>",
|
|
|
|
true, false, false, Gtk::ALIGN_START);
|
|
|
|
grid->attach(*label_logical_volumes, 1, top, 1, 1);
|
2015-09-06 13:46:31 -06:00
|
|
|
|
2015-12-31 10:29:02 -07:00
|
|
|
std::vector<Glib::ustring> lvs = LVM2_PV_Info::get_vg_lvs( vgname );
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_logical_volumes = Utils::mk_label(Glib::build_path("\n", lvs), true, false, true);
|
|
|
|
grid->attach(*value_logical_volumes, 2, top++, 1, 1);
|
|
|
|
value_logical_volumes->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_logical_volumes->get_accessible());
|
2015-09-06 13:46:31 -06:00
|
|
|
}
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Initialize grid top attach tracker (right side of the grid)
|
|
|
|
int topright = 1;
|
|
|
|
|
2014-03-30 15:17:36 -06:00
|
|
|
//Right field & value pair area
|
2014-03-29 13:55:47 -06:00
|
|
|
if ( partition .sector_usage_known() )
|
|
|
|
{
|
|
|
|
//calculate relative diskusage
|
|
|
|
int percent_used, percent_unused, percent_unallocated ;
|
|
|
|
partition .get_usage_triple( 100, percent_used, percent_unused, percent_unallocated ) ;
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Used
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_used = Utils::mk_label("<b>" + Glib::ustring(_("Used:")) + "</b>");
|
|
|
|
grid->attach(*label_used, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_used = Utils::mk_label(Utils::format_size(partition.get_sectors_used(), partition.sector_size),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_used, 4, topright, 1, 1);
|
2019-03-13 05:06:22 -06:00
|
|
|
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_used) + "% )"),
|
|
|
|
5, topright++, 1, 1);
|
2021-10-02 07:43:06 -06:00
|
|
|
value_used->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_used->get_accessible());
|
2019-03-13 05:06:22 -06:00
|
|
|
|
|
|
|
// Unused
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_unused = Utils::mk_label("<b>" + Glib::ustring(_("Unused:")) + "</b>");
|
|
|
|
grid->attach(*label_unused, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_unused = Utils::mk_label(Utils::format_size(partition.get_sectors_unused(), partition.sector_size),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_unused, 4, topright, 1, 1);
|
2019-03-13 05:06:22 -06:00
|
|
|
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_unused) + "% )"),
|
|
|
|
5, topright++, 1, 1);
|
2021-10-02 07:43:06 -06:00
|
|
|
value_unused->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_unused->get_accessible());
|
2014-03-29 13:55:47 -06:00
|
|
|
|
|
|
|
//unallocated
|
|
|
|
Sector sectors_unallocated = partition .get_sectors_unallocated() ;
|
|
|
|
if ( sectors_unallocated > 0 )
|
|
|
|
{
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_unallocated = Utils::mk_label("<b>" + Glib::ustring(_("Unallocated:")) + "</b>");
|
|
|
|
grid->attach(*label_unallocated, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_unallocated = Utils::mk_label(Utils::format_size(sectors_unallocated, partition.sector_size),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_unallocated, 4, topright, 1, 1);
|
2019-03-13 05:06:22 -06:00
|
|
|
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_unallocated) + "% )"),
|
|
|
|
5, topright++, 1, 1);
|
2021-10-02 07:43:06 -06:00
|
|
|
value_unallocated->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_unallocated->get_accessible());
|
2014-03-29 13:55:47 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Size
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_size = Utils::mk_label("<b>" + Glib::ustring(_("Size:")) + "</b>");
|
|
|
|
grid->attach(*label_size, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_size = Utils::mk_label(Utils::format_size(ptn_sectors, partition.sector_size),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_size, 4, topright++, 1, 1);
|
|
|
|
value_size->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_size->get_accessible());
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2014-03-30 15:17:36 -06:00
|
|
|
//ensure left row tracker set to largest side (left/right)
|
|
|
|
top = std::max( top, topright );
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// One blank line
|
|
|
|
grid->attach(*Utils::mk_label(""), 0, top++, 6, 1);
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2019-06-12 05:03:51 -06:00
|
|
|
if (partition.fstype == FS_LUKS)
|
2015-12-28 12:21:58 -07:00
|
|
|
{
|
|
|
|
// ENCRYPTION DETAIL SECTION
|
2019-03-13 05:06:22 -06:00
|
|
|
// Encryption headline
|
|
|
|
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Encryption")) + "</b>"),
|
|
|
|
0, top++, 6, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
|
|
|
|
// Encryption
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_encryption = Utils::mk_label("<b>" + Glib::ustring(_("Encryption:")) + "</b>");
|
|
|
|
grid->attach(*label_encryption, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_encryption = Utils::mk_label(Utils::get_filesystem_string(partition.fstype),
|
|
|
|
true, false, true);
|
|
|
|
grid->attach(*value_encryption, 2, top++, 1, 1);
|
|
|
|
value_encryption->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_encryption->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
|
|
|
|
// LUKS path
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_path = Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>");
|
|
|
|
grid->attach(*label_path, 1, top, 1, 1);
|
|
|
|
if ( partition.busy ) {
|
|
|
|
Gtk::Label *value_path = Utils::mk_label(partition.get_mountpoint(), true, false, true);
|
|
|
|
grid->attach(*value_path, 2, top, 1, 1);
|
|
|
|
value_path->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_path->get_accessible());
|
|
|
|
}
|
2019-03-13 05:06:22 -06:00
|
|
|
top++;
|
2015-12-28 12:21:58 -07:00
|
|
|
|
|
|
|
// LUKS uuid
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_uuid = Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>");
|
|
|
|
grid->attach(*label_uuid, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_uuid = Utils::mk_label(partition.uuid, true, false, true);
|
|
|
|
grid->attach(*value_uuid, 2, top++, 1, 1);
|
|
|
|
value_uuid->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_uuid->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
|
|
|
|
// LUKS status
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_status = Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>");
|
|
|
|
grid->attach(*label_status, 1, top, 1, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
Glib::ustring str_temp;
|
|
|
|
if ( partition.busy )
|
|
|
|
str_temp = luks_open;
|
|
|
|
else
|
|
|
|
str_temp = luks_closed;
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *value_status = Utils::mk_label(str_temp, true, false, true);
|
|
|
|
grid->attach(*value_status, 2, top++, 1, 1);
|
|
|
|
value_status->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_status->get_accessible());
|
2015-12-28 12:21:58 -07:00
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// One blank line
|
|
|
|
grid->attach(*Utils::mk_label(""), 0, top++, 6, 1);
|
2015-12-28 12:21:58 -07:00
|
|
|
}
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// PARTITION DETAIL SECTION
|
|
|
|
// Partition headline
|
|
|
|
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Partition")) + "</b>"),
|
|
|
|
0, top++, 6, 1);
|
2014-03-30 10:33:17 -06:00
|
|
|
|
2014-03-30 15:17:36 -06:00
|
|
|
//use current left row tracker position as anchor for right
|
|
|
|
topright = top ;
|
2019-03-13 05:06:22 -06:00
|
|
|
|
|
|
|
// Left field & value pair area
|
|
|
|
// Path
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_path = Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>");
|
|
|
|
grid->attach(*label_path, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_path = Utils::mk_label(partition.get_path(), true, false, true);
|
|
|
|
grid->attach(*value_path, 2, top++, 1, 1);
|
|
|
|
value_path->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_path->get_accessible());
|
2014-03-29 13:55:47 -06:00
|
|
|
|
2019-06-12 05:03:51 -06:00
|
|
|
if (partition.fstype != FS_UNALLOCATED && partition.status != STAT_NEW)
|
2014-03-29 13:55:47 -06:00
|
|
|
{
|
2019-03-13 05:06:22 -06:00
|
|
|
// Name
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_name = Utils::mk_label("<b>" + Glib::ustring(_("Name:")) + "</b>");
|
|
|
|
grid->attach(*label_name, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_name = Utils::mk_label(partition.name, true, false, true);
|
|
|
|
grid->attach(*value_name, 2, top++, 1, 1);
|
|
|
|
value_name->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_name->get_accessible());
|
2019-03-13 05:06:22 -06:00
|
|
|
|
|
|
|
// Flags
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_flags = Utils::mk_label("<b>" + Glib::ustring(_("Flags:")) + "</b>");
|
|
|
|
grid->attach(*label_flags, 1, top, 1, 1);
|
|
|
|
Gtk::Label *value_flags = Utils::mk_label(Glib::build_path(", ", partition.flags), true, false, true);
|
|
|
|
grid->attach(*value_flags, 2, top++, 1, 1);
|
|
|
|
value_flags->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_flags->get_accessible());
|
2008-11-11 10:21:22 -07:00
|
|
|
}
|
|
|
|
|
2019-03-13 05:06:22 -06:00
|
|
|
// Right field & value pair area
|
|
|
|
// First sector
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_first_sector = Utils::mk_label("<b>" + Glib::ustring(_("First sector:")) + "</b>");
|
|
|
|
grid->attach(*label_first_sector, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_first_sector = Utils::mk_label(Utils::num_to_str(partition.sector_start), true, false, true);
|
|
|
|
grid->attach(*value_first_sector, 4, topright++, 1, 1);
|
|
|
|
value_first_sector->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_first_sector->get_accessible());
|
2019-03-13 05:06:22 -06:00
|
|
|
|
|
|
|
// Last sector
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_last_sector = Utils::mk_label("<b>" + Glib::ustring(_("Last sector:")) + "</b>");
|
|
|
|
grid->attach(*label_last_sector, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_last_sector = Utils::mk_label(Utils::num_to_str(partition.sector_end), true, false, true);
|
|
|
|
grid->attach(*value_last_sector, 4, topright++, 1, 1);
|
|
|
|
value_last_sector->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_last_sector->get_accessible());
|
2019-03-13 05:06:22 -06:00
|
|
|
|
|
|
|
// Total sectors
|
2021-10-02 07:43:06 -06:00
|
|
|
Gtk::Label *label_total_sectors = Utils::mk_label("<b>" + Glib::ustring(_("Total sectors:")) + "</b>");
|
|
|
|
grid->attach(*label_total_sectors, 3, topright, 1, 1);
|
|
|
|
Gtk::Label *value_total_sectors = Utils::mk_label(Utils::num_to_str(ptn_sectors), true, false, true);
|
|
|
|
grid->attach(*value_total_sectors, 4, topright++, 1, 1);
|
|
|
|
value_total_sectors->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
|
|
|
|
label_total_sectors->get_accessible());
|
2004-09-19 14:24:53 -06:00
|
|
|
}
|
|
|
|
|
2021-10-02 07:43:06 -06:00
|
|
|
|
2006-03-14 14:37:47 -07:00
|
|
|
Dialog_Partition_Info::~Dialog_Partition_Info()
|
2004-09-19 14:24:53 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
} //GParted
|