Commit Graph

42 Commits

Author SHA1 Message Date
Mike Fleetwood ea7bd0d419 Rename Dialog_Progress member variable to m_curr_op
Having a member variable named 't' which is used to share state in a
Dialog_Progress object between on_signal_show() and on_cancel() methods
is horrible.  Rename to something more meaningful.

Also initialise m_curr_op in the constructor's initialisation list,
rather than later when first used in on_signal_show().  Not strictly
required, but avoids this POD (Plain Old Data) member variable being
undefined in the Dialog_Progress object between construction and when
on_signal_show() previously assigned to it for the first time and
started using it.

* C++ FAQ / Should my constructors use "initialization lists" or
  "assignment"?
  https://isocpp.org/wiki/faq/ctors#init-lists
2019-04-11 10:06:36 -06:00
Mike Fleetwood 4ccee8063c Rename method to Dialog_Progress::write_operation_details()
And update comment about replacing '\n' to reflect what the code
actually does.
2019-04-11 10:06:36 -06:00
Mike Fleetwood f779002972 Additionally write partition information to saved details (#639176)
Bug 639176 - Save partition layout to gparted_details.htm
2019-04-11 10:06:36 -06:00
Mike Fleetwood edb3afac7b Write starting device overview information to saved details (#639176)
Writes the starting device overview information of all known devices to
the top of the saved details HTML.  This is so that hopefully we don't
need to additionally ask users for their disk layouts via 'fdisk -l',
'parted print' and 'lsblk' when the saved details file is provided.

Also moves the equals separators "==================" from below to
above each operation so the each section is separated.

Bug 639176 - Save partition layout to gparted_details.htm
2019-04-11 10:06:36 -06:00
Mike Fleetwood 707aaea56f Remove now unused Dialog_Progress::signal_get_libparted_version (!34)
... and related GParted_Core::get_libparted_version() method.

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood 8c5c13d613 Rename OperationDetailStatus STATUS_N_A to STATUS_WARNING
Make the enumeration name match it's use as indicating a warning.  Also
spell SUCCESS correctly.  Follow on to icon variable names too.
2017-11-26 10:53:52 -07:00
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
Phillip Susi 947cd02857 Change OperationDetail to not store complex objects in STL containers (#729139)
OperationDetail was storing its children in a std::vector.  This means they
can be moved around in memory arbitrarily, going through indeterminate
lifetimes.  This is generally a bad thing for any non trivial object and
in the case of OperationDetail, it created havoc with the way it maintains
pointers between parent/child objects for signal connections.  It will now
keep only pointers to children in a std::vector instead, so their lifetime
can be controlled, fixing various crashes.

Bug 729139 - Refactor OperationDetail to address random behavior
2014-05-18 10:07:45 -06: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
Phillip Susi 4c249b4d65 Fix dialog progress details view size (#602635) (#662722)
The details view refused to use additional space, even after the window was
expanded, instead continuing to use the scrollbars.  Now resizing the
window will be allowed regardless of the state of the details expander, and
the details view will expand to use the extra space.  Also request enough
initial width to not need a horizontal scrollbar.

Closes:
Bug 602635 - list of tasks in apply dialog does not expand to the available
             vertical space

Bug 662722 - Increase default width of "applying..." dialog to include the
             "Details" status icons
2013-03-11 18:40:31 -06:00
Phillip Susi 89de9a5026 Add proper cancel support (#601239)
Interested operations can now connect a signal to their OperationDetail
to be notified of a cancelation request.  The internal copy/move code
will now cleanly stop on cancelation, allowing the partition to be
rolled back to its previous state.  This makes canceling a move
perfectly safe.

After clicking cancel, the button changes to "Force Cancel" and is
disabled for 5 seconds.  Operations that are safe to cancel will do so
and those that are not will continue to run.  Clicking force cancel
asks operations to cancel, even if doing so is unsafe.  For the
internal copy/move algorithm, canceling is always safe because an
error results in a rollback operation.  Canceling the rollback is
unsafe.  For external commands, filesystem modules may indicate
that the command is safe to cancel or not.  Canceled commands will
be terminated with SIGINT.

As a result of the new safe cancel vs force cancel distinction, the
scary warning about cancl causing corruption has been moved to
after clicking the force cancel button.

Part of Bug #601239 - Please allow 'Cancel after current operation'
2013-03-11 18:40:31 -06:00
Phillip Susi 52a2a9b00a Reduce threading (#685740)
Win_Gparted and Dialog_Progress were creating threads to perform most
functions in the background.  Most of the time, the only reason the
threads blocked was to execute an external command.  The external command
execution has been changed to spawn the command asynchronously and wait
for completion with a nested main loop.  While waiting for completion,
the pipe output is captured via events.  In the future, this will allow
for it to be parsed in real time to obtain progress information.

Those tasks in GParted_Core that still block now spawn a background thread
and wait for it to complete with a nested main loop to avoid hanging the
gui.

Part of Bug #685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Phillip Susi ddd92cf86a Switch Dialog_Progress to use Glib thread instead of pthread (#601239)
Dialog_Progress was using pthread_create() so that it could later
pthread_cancel() the thread.  pthread_cancel() is wildly unsafe and full
of errors.  Changed to use Glib's threads like the rest, and only cancel
between operations.  Because it can take some time to cancel, disable
the cancel button once it has been clicked once.

Bug 601239 - Please allow 'Cancel after current operation'
2013-03-11 18:40:31 -06:00
Phillip Susi 124342e979 Use a full fledged nested main loop while waiting and pulsing progress bars (#685740)
Win_Gparted and Dialog_Progress were looping on Gtk::Main::events_pending()
and iteration() with usleeps in between.  Use a full mainloop instead and
a proper timeout to trigger pulsebar updates instead of usleeps.

Part of Bug 685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Markus Elfring 91b971691d Bug #634090: Change some attributes to local variables
Some classes contained private attributes which were used only by a single
member function. Such items were moved to the corresponding function implementations
to stress their limited usage scope.

A few unused variables were also deleted.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-07-18 13:28:49 -06:00
Curtis Gedak 8cfb27b718 Cleanup file copyright entries
Restore copyright entries by original author to those of his last
known repository commit titled "released gparted-0.3.4 on
LarryT's request." on Feb 25, 2007.

Add my own copyright entries for files in which I changed source
code.  Files in which I only made spelling changes do not have my
copyright entry added.
2009-11-05 11:08:49 -07:00
Curtis Gedak 0af42af3d0 Add padding to progress dialog window 2009-10-22 10:19:47 -06:00
Bart Hakvoort 7a413f6401 added libparted version string to details export.
* include/Dialog_Progress.h,
  include/GParted_Core.h,
  src/Dialog_Progress.cc,
  src/GParted_Core.cc,
  src/Win_GParted.cc: added libparted version string to details
  export.
2006-12-01 13:01:46 +00:00
Bart Hakvoort 7044410a08 Show number of warnings after all operations are completed. Also urge
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: Show number of warnings after all operations
  are completed. Also urge people to save their details in case of
  error.
2006-09-09 10:58:48 +00:00
Bart Hakvoort 8abc8bf2e5 added format_time() keep track of elapsed time between STATUS_EXECUTE and
* include/Utils.h,
  src/Utils.cc: added format_time()
* include/OperationDetail.h,
  src/OperationDetail.cc: keep track of elapsed time between
  STATUS_EXECUTE and STATUS_[ERROR|SUCCES]
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: show elapsed time in the details per (sub)
  process
* src/GParted_Core.cc: use Utils::format_time()
2006-08-22 19:29:59 +00:00
Bart Hakvoort 889ab1232f changed progressfeedbackhandling a bit. Because this affected
* changed progressfeedbackhandling a bit. Because this affected
  OperationDetail i had to make changes in almost every file.
2006-08-20 09:33:54 +00:00
Bart Hakvoort 677a21f50a improved errorhandling a bit. At the initialscan we store errors/warnings
* improved errorhandling a bit. At the initialscan we store
  errors/warnings now in a list per partition and show the in the
  partitioninfo dialog.
  While executing an operation we collect all libparted exceptions in
  a list and attach this list to the operationdetails when everything
  is done.
2006-07-30 15:13:41 +00:00
Bart Hakvoort d52b0286c9 fixed Pango markup problems in operationdetails restructured
* fixed Pango markup problems in operationdetails
* restructured OperationDetail
* renamed some enums for improved readability of the source
2006-07-29 08:27:28 +00:00
Bart Hakvoort f7722d2bbf show warning in progressfeedback if a certain action is n/a. Of course we
* include/Dialog_Progress.h,
  include/Operation.h,
  src/Dialog_Progress.cc,
  src/GParted_Core.cc: show warning in progressfeedback if a certain
  action is n/a. Of course we only allow these actions if the results
  are non-lethal.
2006-07-19 20:54:08 +00:00
Bart Hakvoort 7bb7e8a84f Use ped_device_read and ped_device_write instead of 'dd' to copy
* Use ped_device_read and ped_device_write instead of 'dd' to copy
  filesystems.
  Modified progressdetails to provide more detailed feedback about a
  process.
  Basicly these were all changes to the infrastructure to make the
  incorporation of the 'move-code' a bit easier.

  ( sorry, not in the mood to list all affected files ;)
2006-05-23 21:17:34 +00:00
Bart Hakvoort 99cebc81d3 lots of cleanups in operationhandling. This resulted in cleaner/less code
* lots of cleanups in operationhandling. This resulted in cleaner/less
  code and the fixing of some longstanding issues.
2006-03-24 19:08:41 +00:00
Bart Hakvoort dbaf6df531 removed warning about busy device. It's not really needed and it confuses
* src/Win_GParted.cc: removed warning about busy device. It's not
  really needed and it confuses people.
* include/Operation.h: set default status of operationdetails to NONE
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: implemented export of operationdetails to
  external file. This can be very usefull for debugging. (#329968)
2006-02-07 15:17:44 +00:00
Bart Hakvoort 934b348b84 added markup to operationdetails
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc,
  src/FileSystem.cc: added markup to operationdetails
2006-01-28 15:09:50 +00:00
Bart Hakvoort e00e9cfa61 deal correctly with the progressdialog's delete_event.
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc,
  src/Win_GParted.cc: deal correctly with the progressdialog's
  delete_event.
2006-01-26 22:49:37 +00:00
Bart Hakvoort 1f854ffef3 made some changes to progressdialog behaviour.
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc,
  src/Win_GParted.cc: made some changes to progressdialog behaviour.
2006-01-26 15:54:44 +00:00
Bart Hakvoort b08a1a838d implemented real 'cancel'.
* include/Dialog_Progress.h,
  src/Dialog_Progress.cc: implemented real 'cancel'.
2006-01-25 23:30:43 +00:00
Bart Hakvoort 591a8f3db0 :get_tmp_dir() instead of hardcoding it as '/tmp' :find_program_in_path()
* use Glib::get_tmp_dir() instead of hardcoding it as '/tmp'
* use Glib::find_program_in_path() instead af a system/which combi
* display current device in windowtitle
2006-01-24 12:31:58 +00:00
Bart Hakvoort 97a9a5fa87 p
* added detailed progressfeedback. It still needs some polishing, but
  is already far better then the old situation. And what's more, it's
  finally threadsafe :p
2006-01-19 19:15:15 +00:00
Bart Hakvoort 4ccf831ec7 P) It still needs a lot of love, but the foundations are laid =)
* Rewrote a large part of gparteds internal code. Filesystemssupport is now much more separated from the rest of gparted and
  adding support for other filesystems should be a piece of cake now (hope that's true :P)
  It still needs a lot of love, but the foundations are laid =)
2004-11-17 13:00:25 +00:00
Bart Hakvoort bd3152788f implemented mk_label wherever possible 2004-10-06 19:06:43 +00:00
Bart Hakvoort 18b47725f8 enabled support for reiserfs 2004-10-06 15:32:40 +00:00
Bart Hakvoort d57a8eced7 removed unnecessary headerfiles 2004-10-02 13:18:25 +00:00
Bart Hakvoort 72f91cbc39 removed all stringstreams from the project (they were possibly responsible
* removed all stringstreams from the project (they were possibly responsible for rare chrashes in certain locales)
2004-10-02 09:39:16 +00:00
Bart Hakvoort 04e770ff17 changed some sentences on translators request 2004-09-25 01:10:21 +00:00
Bart Hakvoort cf33622e8a enabled i18n support 2004-09-20 15:46:21 +00:00
Bart Hakvoort 26d433260d Initial revision 2004-09-19 20:24:53 +00:00