From: <cod...@go...> - 2008-08-20 17:44:49
|
Author: M0E.lnx Date: Wed Aug 20 10:44:49 2008 New Revision: 131 Modified: branches/iVL/MdlDiskPart.module Log: - Modifications to the gparted embedder. This time the isntaller uses probedisk to determine what kind of drives are present in the system, and then uses it's results combined with the " - GParted" string to find the running instance of gparted in the desktop. Modified: branches/iVL/MdlDiskPart.module ============================================================================== --- branches/iVL/MdlDiskPart.module (original) +++ branches/iVL/MdlDiskPart.module Wed Aug 20 10:44:49 2008 @@ -27,30 +27,45 @@ DIM sDump AS String DIM sWins AS String = "gpartedbin,Gpartedbin" '" GParted, / dev / sda - GParted, / dev / hda - GParted "" DIM sWons AS String[] = Split(sWins, ",") + DIM sType AS String 'Desktop.Find("", "GParted") ' The window can be found on the Desktop WM_CLASS property which can be seen via the xprop application ' We may need to implement this method here instead of the win window title method. + ' For now, try to determine what type of drive thsi is.. + ' The following line will get the first listed drive (/dev/sda or /dev/hda) and use that + ' as a starting point to search for a running instance of gparted + SHELL "probedisk | grep -v \'cdrom\' | cut -f 1 -d \'|\' | grep \'a\'" TO sType + stype = Trim(sType) + 'Message(sType) + + + IF Exist("/usr/sbin/gparted") = FALSE THEN Message.Error("Gparted was not found on this system. Please install gparted and try again") RETURN END IF - FrmDiskPart.tlBanner.Text = "<h3>Loading gparted .... Please wait</h3>" + FrmDiskPart.tlBanner.Text = "<h3>Loading gparted ... Please wait</h3>" SHELL "/usr/sbin/gparted" - WAIT + WAIT 1.5 - i = 0 - aHandle = Desktop.Find("", Trim(sWons[i])) - IF aHandle.Count = 0 THEN - REPEAT - WAIT 2 - INC i - aHandle = Desktop.Find("", sWons[i]) - UNTIL - aHandle.Count > 0 OR i = sWons.count - 1 - END IF + 'aHandle = Desktop.Find("*" & " - GParted", "gpartedbin") + aHandle = Desktop.Find(sType & " - GParted") + + + ' i = 0 + ' aHandle = Desktop.Find("", Trim(sWons[i])) + ' WAIT + ' IF aHandle.Count = 0 THEN + ' REPEAT + ' WAIT 2 + ' INC i + ' aHandle = Desktop.Find("", sWons[i]) + ' UNTIL + ' aHandle.Count > 0 OR i = sWons.count - 1 + ' END IF IF aHandle.Count = 0 THEN @@ -60,7 +75,7 @@ 'END IF ELSE IF aHandle.Count >= 2 THEN - Message("Several windows found. I take the first one!") + Message("Several windows found. I will take the first one!") ENDIF 'ELSE iHandle = aHandle[0] |