Commit Graph

23 Commits

Author SHA1 Message Date
Mike Fleetwood 8979913a3f Remove "../include/" from GParted header #includes
It made the code look a little messy, is easily resolved in the build
system and made the dependencies more complicated than needed.  Each
GParted header was tracked via multiple different names (different
numbers of "../include/" prefixes).  For example just looking at how
DialogFeatures.o depends on Utils.h:

    $ cd src
    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/../include/Utils.h \
     ../include/../include/../include/../include/../include/../include/Utils.h \
     ../include/../include/../include/Utils.h \

After removing "../include/" from the GParted header #includes, just
need to add "-I../include" to the compile command via the AM_CPPFLAGS in
src/Makefile.am.  Now the dependencies on GParted header files are
tracked under a single name (with a single "../include/" prefix).  Now
DialogFeatures.o only depends on a single name to Utils.h:

    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/Utils.h ../include/i18n.h \
2016-12-12 13:15:34 -07:00
Mike Fleetwood 43f2a4bd08 Reorder and rename params to TreeView_Detail::load_partitions()
Reorder the parameters into the same order in which they occur in the
row, i.e. Name first, then Mount Point and finally Label.  Rename local
variables in load_partitions(1 param) and parameters of
load_partitions(5 params) prefixing with "show_" to make it clearer the
variables track if that column will be displayed or not.
2016-12-02 10:06:01 -07:00
Mike Fleetwood 9e932ec7d0 Fix detection of empty mount point column for encrypted file systems (#775475)
create_row() populates the values for each row to be displayed in the UI
from the relevant Partition object.  However load_partitions(5 params)
independently decided if the Name, Mount Point and Label columns were
empty and should be displayed.

Getting the mount point value is more complex for encrypted file systems
because it has to call get_mountpoints() on the inner encrypted
Partition object.  load_partitions(5 params) didn't account for this.

Fix by making create_row() both copy the values into each row and at the
same time check if they are empty to decide if they should be displayed
or not.

Bug 775475 - Mount Point column displayed for encrypted file systems
             even when empty
2016-12-02 09:56:29 -07:00
Mike Fleetwood 85b6858702 Remove remaining vestiges of coloured text from the partition list
This commit stopped setting the text colours in the Partition, File
System and Mount Point columns to avoid hard coding text colours making
them impossible to read when using GNOME's High Contrast Inverse theme:
    ff2a6c00dd
    Changes post gparted-0.3.6 - code recreation from Source Forge

    * src/TreeView_Detail.cc: Removed text_color hard coding
      - Removed hard coding of Partition and Filesystem text_color
        which was based on if partition was TYPE_UNALLOCATED.
      - Removed hard coding of Mount text_color which was based
        on if partition was busy.  Lock symbol provides this indicator.
      - Closes GParted bug #413810 - Don't hardcode text colour in
        partition list

Now remove the remaining vestiges left behind.  Remove the unused color
text and mount_text_color columns from the tree model.  Also remove
setting of the column attributes which set the colour of the text in the
tree view from those unused columns in the tree model.

Unnecessary history.  Added by:
    b179990dc9
    show greyed-out mountpoint of unmounted partitions in the treeview
    as an improved way to identify partitions
    Bug #333027 -  Displaying unmounted partitions' default mount points
    in grey

and by commit only in CVS history:
    Bart Hakvoort <...> 2004-08-22 15:06:45
    Made text in Partition column darkgrey for unallocated. this offers
    more visual difference between partitions and unallocated space
2016-10-05 10:53:21 -06:00
Mike Fleetwood fae909897e Use PartitionVector class throughout the code (#759726)
Replace all occurrences of std::vector<Partition> with PartitionVector.

Bug 759726 - Implement Partition object polymorphism
2016-01-26 10:11:35 -07:00
Mike Fleetwood acd5d7e580 Store pointers to partition objects in TreeView_Details (#750168)
This stops copying of each displayed partition object into the
TreeView_Details class.

It also stops copy constructing lots of partition objects when just
clicking on a partition in the disk graphic.  The disk graphic needs to
inform the main GUI and then the partition list which partition has been
selected.  The call sequence goes like:

    DrawingAreaVisualDisk::on_button_press_event(event)
      Win_GParted::on_partition_selected(partition_ptr, src_is_treeview)
        TreeView_Detail::set_selected(partition_ptr)
          TreeView_Detail::set_selected(rows, partition_ptr,
                                        inside_extended)

Relevant source and highlighted comparison line:

   140  bool TreeView_Detail::set_selected( Gtk::TreeModel::Children rows,
   141                                      const Partition * partition_ptr, bool inside_extended )
   142  {
   143          for ( unsigned int t = 0 ; t < rows .size() ; t++ )
   144          {
>> 145                  if ( static_cast<Partition>( rows[t][treeview_detail_columns.partition] ) == *partition_ptr )
   146                  {
   147                          if ( inside_extended )
   148                                  expand_all() ;
   149
   150                          set_cursor( static_cast<Gtk::TreePath>( rows[ t ] ) ) ;
   151                          return true ;
   152                  }
   153
   154                  if ( set_selected( rows[t].children(), partition_ptr, true ) )
   155                          return true ;
   156          }
   157
   158          return false ;
   159  }

Then in this function the partition selected in the disk graphic
(partition_ptr parameter) is compared in turn with each partition object
stored in the Gtk::TreeView model to find the matching one to mark it as
selected.  This mere act of accessing the partition object stored in a
row of the Gtk::TreeView model causes it to be copy constructed.  So
clicking on the 5th partition in the disk graphic will copy construct
the first 5 partition objects just to do a compare to find the matching
one.

This is because it is not possible to get a reference from a
Gtk:TreeViewProxy in gtkmm.  Merely accessing a value in a Gtk::TreeView
model takes a copy of that value.

    Subject: get a reference from a Gtk::TreeValueProxy
    http://comments.gmane.org/gmane.comp.gnome.gtkmm/2217
    http://marc.info/?t=104400417500001&r=1&w=4

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:14 -06:00
Mike Fleetwood c430acf52a Pass by pointer in the signal_partition_selected callbacks (#750168)
Change from passing a reference to the selected partition, to passing a
pointer to the selected partition in the signal_partition_selected
callbacks between the disk graphic, partition list and core GUI modules.

This is an enabler for the following patches.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:14 -06:00
Michael Zimmermann 1f5841b4ad Add support for GPT partition names (#741424)
Embedded devices (Android) use GPT partition names to identify
partitions, instead of file system labels.  Add support for viewing and
changing them.

As partition names are used to provide unique identification they are
never copied when copying the contents of one partition to another.

Note that GNU/Linux uses file system labels, UUIDs or device names for
identification during the boot process and afterwards so while partition
names can be used, they are optional and purely for user information.

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Daniel Mustieles 3861b9257b Replace obsolete FSF postal address in copyright notices (#721565)
This is part of parent bug:
    Bug #721455 - Obsolete info in license text on multiple modules

and GNOME Goal:
    https://wiki.gnome.org/Initiatives/GnomeGoals/Proposals

    * verify all source files to make sure they have a license and a
      copyright, and that both are up-to-date

Bug #721565 -  License text contains obsolete FSF postal address
2014-01-26 10:53:23 +00:00
Mike Fleetwood 2b51d87147 Make include guards unique (#539297)
Include guards need to be unique within GParted code and all included
library header files.
    http://en.wikipedia.org/wiki/Include_guard#Difficulties

Use this model for all include guards:
    #ifndef GPARTED_FILE_NAME_H
    #define GPARTED_FILE_NAME_H
    ...
    #endif /* GPARTED_FILE_NAME_H */

Closes Bug #539297 - Make include guards unique
2013-06-05 10:57:39 -06:00
Bart Hakvoort 600e990a6e trivial cleanups
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: trivial cleanups
2006-09-16 15:00:25 +00:00
Bart Hakvoort e3b4a7316b added support for reading volumelabels. Atm we only read ext2/3, but the
* added support for reading volumelabels. Atm we only read ext2/3, but
  the infrastructure for adding the other filesystems is in place.
  It's simply a matter of finding the right commands and parsing the
  output. (see #338528 for more info)
2006-09-12 20:34:33 +00:00
Bart Hakvoort 9ccc70cb59 made icon behaviour more intelligent small improvement in
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: made icon behaviour more intelligent
* src/GParted_Core.cc: small improvement in open_device_and_disk()
2006-03-27 19:21:37 +00:00
Bart Hakvoort b179990dc9 show greyed-out mountpoint of unmounted partitions in the treeview as an
* include/GParted_Core.h,
  include/TreeView_Detail.h,
  src/GParted_Core.cc,
  src/TreeView_Detail.cc: show greyed-out mountpoint of unmounted
  partitions in the treeview as an improved way to identify
  partitions. (#333027)
* src/Win_GParted.cc: cleanups
2006-03-07 11:55:27 +00:00
Bart Hakvoort 0fd04602c1 support showing of warning icon even when a partition is mounted.
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: support showing of warning icon even when a
  partition is mounted.
2006-03-06 13:39:21 +00:00
Bart Hakvoort 35593e5747 added mountpointcolumn (#304688) added submenu 'Devices' which allows one
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc: added mountpointcolumn (#304688)
* include/Win_GParted.h,
  src/Win_GParted.cc: added submenu 'Devices' which allows one to
  select devices from the menu (#329415)
2006-02-02 10:59:44 +00:00
Bart Hakvoort 7ef6e3e5c8 emit proper signals for several events. cleanups..
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc,
  include/VBox_VisualDisk.h,
  src/VBox_VisualDisk.cc,
  include/Win_GParted.h,
  src/Win_GParted.cc: emit proper signals for several events.
* include/Partition.h,
  src/Partition.cc: cleanups..
2005-12-24 00:06:05 +00:00
Bart Hakvoort 9564cf841b added get_color_as_pixbuf() to create colored squares of custom sizes.
* include/Utils.h,
  src/Utils.cc: added get_color_as_pixbuf() to create colored squares
  of custom sizes. These can be use troughout the app to represent
  filesystems. e.g. in the treeview and convertmenu.
* include/TreeView_Detail.h,
  src/TreeView_Detail.cc,
  include/VBox_VisualDisk.h,
  src/VBox_VisualDisk.cc,
  include/Win_GParted.h,
  src/Win_GParted.cc: use Utils::get_color_as_pixbuf() instead of
  custom drawn widgets.
2005-12-15 15:10:34 +00:00
Bart Hakvoort 758f5e63a8 Fixed a bunch of bugs (some of them crashers) which showed up if no
* Fixed a bunch of bugs (some of them crashers) which showed up if no devices were detected.
2005-02-01 17:04:03 +00:00
Bart Hakvoort bd02bca613 P ). Resizing of ext2/3 works perfect now. I've even tested it on the
* Again way too many chances to create a detailed entry (i'm glad i'm the only dev atm :P ).
  Resizing of ext2/3 works perfect now. I've even tested it on the partition holding my SG seasons =)
  Implemented checking of filesystems (only internally used atm).
  Done some overall tweaking, finetuning etc.. release 0.0.7 is getting shape.
2004-11-21 21:49:38 +00:00
Bart Hakvoort d57a8eced7 removed unnecessary headerfiles 2004-10-02 13:18:25 +00:00
Bart Hakvoort 0d2ee545a7 added colored squares to the tree to highlight filesystems. 2004-09-30 18:26:34 +00:00
Bart Hakvoort 26d433260d Initial revision 2004-09-19 20:24:53 +00:00